Merge pull request #9451 from cladmi/pr/make/makefile_include/define_baselibs
Makefile.include: fully define BASELIBS before using its value
This commit is contained in:
commit
534b0da9a5
@ -312,6 +312,33 @@ APPLICATION_MODULE ?= application_$(APPLICATION)
|
|||||||
BASELIBS += $(BINDIR)/$(APPLICATION_MODULE).a
|
BASELIBS += $(BINDIR)/$(APPLICATION_MODULE).a
|
||||||
BASELIBS += $(APPDEPS)
|
BASELIBS += $(APPDEPS)
|
||||||
|
|
||||||
|
|
||||||
|
# add extra include paths for packages in $(USEMODULE)
|
||||||
|
export USEMODULE_INCLUDES =
|
||||||
|
|
||||||
|
include $(RIOTBASE)/sys/Makefile.include
|
||||||
|
include $(RIOTBASE)/drivers/Makefile.include
|
||||||
|
|
||||||
|
# include Makefile.includes for packages in $(USEPKG)
|
||||||
|
$(RIOTPKG)/%/Makefile.include::
|
||||||
|
$(Q)"$(MAKE)" -C $(RIOTPKG)/$* Makefile.include
|
||||||
|
|
||||||
|
$(info $(USEPKG:%=$(RIOTPKG)/%/Makefile.include))
|
||||||
|
.PHONY: $(USEPKG:%=$(RIOTPKG)/%/Makefile.include)
|
||||||
|
-include $(USEPKG:%=$(RIOTPKG)/%/Makefile.include)
|
||||||
|
|
||||||
|
USEMODULE_INCLUDES_ = $(shell echo $(USEMODULE_INCLUDES) | tr ' ' '\n' | awk '!a[$$0]++' | tr '\n' ' ')
|
||||||
|
|
||||||
|
INCLUDES += $(USEMODULE_INCLUDES_:%=-I%)
|
||||||
|
|
||||||
|
|
||||||
|
# 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: all link clean flash flash-only term doc debug debug-server reset objdump help info-modules
|
||||||
.PHONY: print-size elffile binfile hexfile
|
.PHONY: print-size elffile binfile hexfile
|
||||||
.PHONY: ..in-docker-container
|
.PHONY: ..in-docker-container
|
||||||
@ -337,6 +364,9 @@ LINKFLAGPREFIX ?= -Wl,
|
|||||||
|
|
||||||
DIRS += $(EXTERNAL_MODULE_DIRS)
|
DIRS += $(EXTERNAL_MODULE_DIRS)
|
||||||
|
|
||||||
|
# Save value to verify it is not modified later
|
||||||
|
_BASELIBS_VALUE_BEFORE_USAGE := $(BASELIBS)
|
||||||
|
|
||||||
# Linker rule
|
# Linker rule
|
||||||
$(ELFFILE): FORCE
|
$(ELFFILE): FORCE
|
||||||
ifeq ($(BUILDOSXNATIVE),1)
|
ifeq ($(BUILDOSXNATIVE),1)
|
||||||
@ -393,28 +423,11 @@ endef
|
|||||||
@$(COLOR_ECHO) '$(COLOR_GREEN)Building application "$(APPLICATION)" for "$(BOARD)" with MCU "$(MCU)".$(COLOR_RESET)'
|
@$(COLOR_ECHO) '$(COLOR_GREEN)Building application "$(APPLICATION)" for "$(BOARD)" with MCU "$(MCU)".$(COLOR_RESET)'
|
||||||
@$(COLOR_ECHO)
|
@$(COLOR_ECHO)
|
||||||
|
|
||||||
# add extra include paths for packages in $(USEMODULE)
|
|
||||||
export USEMODULE_INCLUDES =
|
|
||||||
|
|
||||||
include $(RIOTBASE)/sys/Makefile.include
|
|
||||||
include $(RIOTBASE)/drivers/Makefile.include
|
|
||||||
|
|
||||||
# The `clean` needs to be serialized before everything else.
|
# The `clean` needs to be serialized before everything else.
|
||||||
ifneq (, $(filter clean, $(MAKECMDGOALS)))
|
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: clean
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# include Makefile.includes for packages in $(USEPKG)
|
|
||||||
$(RIOTPKG)/%/Makefile.include::
|
|
||||||
$(Q)"$(MAKE)" -C $(RIOTPKG)/$* Makefile.include
|
|
||||||
|
|
||||||
.PHONY: $(USEPKG:%=$(RIOTPKG)/%/Makefile.include)
|
|
||||||
-include $(USEPKG:%=$(RIOTPKG)/%/Makefile.include)
|
|
||||||
|
|
||||||
USEMODULE_INCLUDES_ = $(shell echo $(USEMODULE_INCLUDES) | tr ' ' '\n' | awk '!a[$$0]++' | tr '\n' ' ')
|
|
||||||
|
|
||||||
INCLUDES += $(USEMODULE_INCLUDES_:%=-I%)
|
|
||||||
|
|
||||||
.PHONY: pkg-prepare $(USEPKG:%=$(BINDIR)/%.a)
|
.PHONY: pkg-prepare $(USEPKG:%=$(BINDIR)/%.a)
|
||||||
pkg-prepare:
|
pkg-prepare:
|
||||||
-@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i prepare ; done
|
-@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i prepare ; done
|
||||||
@ -605,12 +618,6 @@ endif
|
|||||||
# Include desvirt Makefile
|
# Include desvirt Makefile
|
||||||
include $(RIOTTOOLS)/desvirt/Makefile.desvirt
|
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
|
# 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
|
# 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.
|
# The script will only touch the file if anything has changed since last time.
|
||||||
@ -642,4 +649,12 @@ ifneq (all, $(.DEFAULT_GOAL))
|
|||||||
$(error .DEFAULT_GOAL := $(.DEFAULT_GOAL))
|
$(error .DEFAULT_GOAL := $(.DEFAULT_GOAL))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
# Detect if BASELIBS changed since its first use
|
||||||
|
ifneq ($(_BASELIBS_VALUE_BEFORE_USAGE),$(BASELIBS))
|
||||||
|
$(warning $(sort $(filter-out $(_BASELIBS_VALUE_BEFORE_USAGE), $(BASELIBS)) \
|
||||||
|
$(filter-out $(BASELIBS), $(_BASELIBS_VALUE_BEFORE_USAGE))))
|
||||||
|
$(error BASELIBS value changed)
|
||||||
|
endif
|
||||||
|
|
||||||
endif # BOARD=none
|
endif # BOARD=none
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user