From fb10a181a0957b695b308ef306c8e873dcd438cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Mon, 23 Apr 2018 13:59:39 +0200 Subject: [PATCH 1/4] make: Add 'BUILDDEPS' variable BUILDDEPS are files / make targets that should be build before compiling. It can include packages source download, generating headers, modules. It is the equivalent of `APPDEPS` but not limited to the application. It cannot be done right now with `APPDEPS` as it is used in `BASELIBS` and fixing it requires changing mips using it for source files. --- Makefile.include | 6 +++--- makefiles/vars.inc.mk | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile.include b/Makefile.include index 4dbc9b08e277..449b8c61ddd2 100644 --- a/Makefile.include +++ b/Makefile.include @@ -387,7 +387,7 @@ endif # RIOTNOLINK $(ELFFILE): $(BASELIBS) $(Q)$(_LINK) -o $@ -$(BINDIR)/$(APPLICATION_MODULE).a: $(RIOTBUILD_CONFIG_HEADER_C) $(USEPKG:%=$(BINDIR)/%.a) $(APPDEPS) +$(BINDIR)/$(APPLICATION_MODULE).a: $(RIOTBUILD_CONFIG_HEADER_C) $(USEPKG:%=$(BINDIR)/%.a) $(APPDEPS) $(BUILDDEPS) $(Q)DIRS="$(DIRS)" "$(MAKE)" -C $(APPDIR) -f $(RIOTMAKE)/application.inc.mk $(BINDIR)/$(APPLICATION_MODULE).a: FORCE @@ -425,14 +425,14 @@ endef # The `clean` needs to be serialized before everything else. ifneq (, $(filter clean, $(MAKECMDGOALS))) - all $(BASELIBS) $(USEPKG:%=$(RIOTPKG)/%/Makefile.include) $(RIOTBUILD_CONFIG_HEADER_C) pkg-prepare: clean + all $(BASELIBS) $(USEPKG:%=$(RIOTPKG)/%/Makefile.include) $(RIOTBUILD_CONFIG_HEADER_C) pkg-prepare $(BUILDDEPS): clean endif .PHONY: pkg-prepare $(USEPKG:%=$(BINDIR)/%.a) pkg-prepare: -@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i prepare ; done -$(USEPKG:%=$(BINDIR)/%.a): $(RIOTBUILD_CONFIG_HEADER_C) pkg-prepare +$(USEPKG:%=$(BINDIR)/%.a): $(RIOTBUILD_CONFIG_HEADER_C) pkg-prepare $(BUILDDEPS) @mkdir -p $(BINDIR) $(QQ)"$(MAKE)" -C $(RIOTPKG)/$(patsubst $(BINDIR)/%.a,%,$@) diff --git a/makefiles/vars.inc.mk b/makefiles/vars.inc.mk index b0cbac747491..300fedbb2d11 100644 --- a/makefiles/vars.inc.mk +++ b/makefiles/vars.inc.mk @@ -17,6 +17,7 @@ export USEMODULE # Sys Module dependencies of the application. Set i export USEPKG # Pkg dependencies (third party modules) of the application. Set in the application's Makefile. export DISABLE_MODULE # Used in the application's Makefile to suppress DEFAULT_MODULEs. export APPDEPS # Files / Makefile targets that need to be created before the application can be build. Set in the application's Makefile. +# BUILDDEPS # Files / Makefile targets that need to be created before starting to build. export RIOTBASE # The root folder of RIOT. The folder where this very file lives in. export RIOTCPU # For third party CPUs this folder is the base of the CPUs. From ba83f1c9c67b25e229b0c763e3295e7418507703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Mon, 23 Apr 2018 14:19:13 +0200 Subject: [PATCH 2/4] Makefile.include: set RIOTBUILD_CONFIG_HEADER_C as BUILDDEPS Use BUILDDEPS to define the RIOTBUILD_CONFIG_HEADER_C dependency --- Makefile.include | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile.include b/Makefile.include index 449b8c61ddd2..cb15c637239a 100644 --- a/Makefile.include +++ b/Makefile.include @@ -364,6 +364,9 @@ LINKFLAGPREFIX ?= -Wl, DIRS += $(EXTERNAL_MODULE_DIRS) +# Define dependencies required for building (headers, downloading source files,) +BUILDDEPS += $(RIOTBUILD_CONFIG_HEADER_C) + # Save value to verify it is not modified later _BASELIBS_VALUE_BEFORE_USAGE := $(BASELIBS) @@ -387,7 +390,7 @@ endif # RIOTNOLINK $(ELFFILE): $(BASELIBS) $(Q)$(_LINK) -o $@ -$(BINDIR)/$(APPLICATION_MODULE).a: $(RIOTBUILD_CONFIG_HEADER_C) $(USEPKG:%=$(BINDIR)/%.a) $(APPDEPS) $(BUILDDEPS) +$(BINDIR)/$(APPLICATION_MODULE).a: $(USEPKG:%=$(BINDIR)/%.a) $(APPDEPS) $(BUILDDEPS) $(Q)DIRS="$(DIRS)" "$(MAKE)" -C $(APPDIR) -f $(RIOTMAKE)/application.inc.mk $(BINDIR)/$(APPLICATION_MODULE).a: FORCE @@ -425,14 +428,14 @@ endef # The `clean` needs to be serialized before everything else. ifneq (, $(filter clean, $(MAKECMDGOALS))) - all $(BASELIBS) $(USEPKG:%=$(RIOTPKG)/%/Makefile.include) $(RIOTBUILD_CONFIG_HEADER_C) pkg-prepare $(BUILDDEPS): clean + all $(BASELIBS) $(USEPKG:%=$(RIOTPKG)/%/Makefile.include) pkg-prepare $(BUILDDEPS): clean endif .PHONY: pkg-prepare $(USEPKG:%=$(BINDIR)/%.a) pkg-prepare: -@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i prepare ; done -$(USEPKG:%=$(BINDIR)/%.a): $(RIOTBUILD_CONFIG_HEADER_C) pkg-prepare $(BUILDDEPS) +$(USEPKG:%=$(BINDIR)/%.a): pkg-prepare $(BUILDDEPS) @mkdir -p $(BINDIR) $(QQ)"$(MAKE)" -C $(RIOTPKG)/$(patsubst $(BINDIR)/%.a,%,$@) From 2f41244adc2562ab9288e82894178309a84f8ded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Mon, 23 Apr 2018 14:31:27 +0200 Subject: [PATCH 3/4] Makefile.include: set APPDEPS as BUILDDEPS Use BUILDDEPS to define the APPDEPS dependency --- Makefile.include | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile.include b/Makefile.include index cb15c637239a..3e8e85a4c35b 100644 --- a/Makefile.include +++ b/Makefile.include @@ -366,6 +366,7 @@ DIRS += $(EXTERNAL_MODULE_DIRS) # Define dependencies required for building (headers, downloading source files,) BUILDDEPS += $(RIOTBUILD_CONFIG_HEADER_C) +BUILDDEPS += $(APPDEPS) # Save value to verify it is not modified later _BASELIBS_VALUE_BEFORE_USAGE := $(BASELIBS) @@ -390,7 +391,7 @@ endif # RIOTNOLINK $(ELFFILE): $(BASELIBS) $(Q)$(_LINK) -o $@ -$(BINDIR)/$(APPLICATION_MODULE).a: $(USEPKG:%=$(BINDIR)/%.a) $(APPDEPS) $(BUILDDEPS) +$(BINDIR)/$(APPLICATION_MODULE).a: $(USEPKG:%=$(BINDIR)/%.a) $(BUILDDEPS) $(Q)DIRS="$(DIRS)" "$(MAKE)" -C $(APPDIR) -f $(RIOTMAKE)/application.inc.mk $(BINDIR)/$(APPLICATION_MODULE).a: FORCE From 61f13baf14d087c377dac8e4a033a06db2ff362e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Mon, 23 Apr 2018 14:49:35 +0200 Subject: [PATCH 4/4] Makefile.include: set pkg-prepare as BUILDDEPS Use BUILDDEPS to define pkg-prepare dependency --- Makefile.include | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile.include b/Makefile.include index 3e8e85a4c35b..275d0ceefd24 100644 --- a/Makefile.include +++ b/Makefile.include @@ -366,6 +366,7 @@ DIRS += $(EXTERNAL_MODULE_DIRS) # Define dependencies required for building (headers, downloading source files,) BUILDDEPS += $(RIOTBUILD_CONFIG_HEADER_C) +BUILDDEPS += pkg-prepare BUILDDEPS += $(APPDEPS) # Save value to verify it is not modified later @@ -429,14 +430,14 @@ endef # The `clean` needs to be serialized before everything else. ifneq (, $(filter clean, $(MAKECMDGOALS))) - all $(BASELIBS) $(USEPKG:%=$(RIOTPKG)/%/Makefile.include) pkg-prepare $(BUILDDEPS): clean + all $(BASELIBS) $(USEPKG:%=$(RIOTPKG)/%/Makefile.include) $(BUILDDEPS): clean endif .PHONY: pkg-prepare $(USEPKG:%=$(BINDIR)/%.a) pkg-prepare: -@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i prepare ; done -$(USEPKG:%=$(BINDIR)/%.a): pkg-prepare $(BUILDDEPS) +$(USEPKG:%=$(BINDIR)/%.a): $(BUILDDEPS) @mkdir -p $(BINDIR) $(QQ)"$(MAKE)" -C $(RIOTPKG)/$(patsubst $(BINDIR)/%.a,%,$@)