From d8a264312c5a4efab31d670ae55b120fa62c13ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Mon, 18 Jun 2018 17:52:48 +0200 Subject: [PATCH] Makefile.include: process 'modules.inc.mk' before using BASELIBS Build targets were using the immediate value of '$(BASELIBS)' before it was actually set. bindist.inc.mk should also be processed before as it is adding `BIN_USEMODULE` to `USEMODULE`. This fixes use before define problems for: * `make -C examples/hello-world` * `make -C examples/bindist` --- Makefile.include | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Makefile.include b/Makefile.include index 4d7da693b5..45f1ff95ab 100644 --- a/Makefile.include +++ b/Makefile.include @@ -310,6 +310,14 @@ APPLICATION_MODULE ?= application_$(APPLICATION) BASELIBS += $(BINDIR)/$(APPLICATION_MODULE).a BASELIBS += $(APPDEPS) + +# include bindist target +include $(RIOTMAKE)/bindist.inc.mk + +# Add all USEMODULE modules to CFLAGS and populate BASELIBS +include $(RIOTMAKE)/modules.inc.mk + + .PHONY: all link clean flash flash-only term doc debug debug-server reset objdump help info-modules .PHONY: print-size elffile binfile hexfile .PHONY: ..in-docker-container @@ -603,12 +611,6 @@ endif # Include desvirt Makefile include $(RIOTTOOLS)/desvirt/Makefile.desvirt -# include bindist target -include $(RIOTMAKE)/bindist.inc.mk - -# Add all USEMODULE modules to CFLAGS -include $(RIOTMAKE)/modules.inc.mk - # Build a header file with all common macro definitions and undefinitions # make it phony to force re-run of the script every time even if the file exists # The script will only touch the file if anything has changed since last time.