forked from espressif/esp-idf
build system: Generated makefiles should contain environment-variable-relative paths where possible
Means that moving directories around then partial building should succeed when possible.
This commit is contained in:
@@ -58,19 +58,33 @@ COMPONENT_ADD_LDFLAGS ?= -l$(COMPONENT_NAME)
|
|||||||
OWN_INCLUDES:=$(abspath $(addprefix $(COMPONENT_PATH)/,$(COMPONENT_ADD_INCLUDEDIRS) $(COMPONENT_PRIV_INCLUDEDIRS)))
|
OWN_INCLUDES:=$(abspath $(addprefix $(COMPONENT_PATH)/,$(COMPONENT_ADD_INCLUDEDIRS) $(COMPONENT_PRIV_INCLUDEDIRS)))
|
||||||
COMPONENT_INCLUDES := $(OWN_INCLUDES) $(filter-out $(OWN_INCLUDES),$(COMPONENT_INCLUDES))
|
COMPONENT_INCLUDES := $(OWN_INCLUDES) $(filter-out $(OWN_INCLUDES),$(COMPONENT_INCLUDES))
|
||||||
|
|
||||||
# This target is used to take component.mk variables COMPONENT_ADD_INCLUDEDIRS,
|
# macro to generate relative paths inside component_project_vars.mk, whenever possible
|
||||||
# COMPONENT_ADD_LDFLAGS and COMPONENT_DEPENDS and inject them into the project
|
# ie put literal $(IDF_PATH), $(PROJECT_PATH) and $(BUILD_DIR_BASE) into the generated
|
||||||
# makefile level.
|
# makefiles where possible.
|
||||||
|
#
|
||||||
|
# This means if directories move (breaking absolute paths), don't need to 'make clean'
|
||||||
|
define MakeRelativePath
|
||||||
|
$(subst $(IDF_PATH),$$(IDF_PATH),$(subst $(PROJECT_PATH),$$(PROJECT_PATH),$(subst $(BUILD_DIR_BASE),\$$(BUILD_DIR_BASE),$(1))))
|
||||||
|
endef
|
||||||
|
|
||||||
|
# This target generates component_project_vars.mk for the
|
||||||
|
# component. This is used to take component.mk variables
|
||||||
|
# COMPONENT_ADD_INCLUDEDIRS, COMPONENT_ADD_LDFLAGS and
|
||||||
|
# COMPONENT_DEPENDS and inject those into the project makefile.
|
||||||
#
|
#
|
||||||
# The target here has no dependencies, as the parent target in
|
# The target here has no dependencies, as the parent target in
|
||||||
# project.mk evaluates dependencies before calling down to here. See
|
# project.mk evaluates dependencies before calling down to here. See
|
||||||
# GenerateProjectVarsTarget in project.mk.
|
# GenerateComponentTargets macro in project.mk.
|
||||||
|
#
|
||||||
|
# If you are thinking of editing the output of this makefile for a
|
||||||
|
# component-specific feature, please don't! What you want is a
|
||||||
|
# Makefile.projbuild for your component (see docs/build-system.rst for more.)
|
||||||
component_project_vars.mk::
|
component_project_vars.mk::
|
||||||
$(details) "Building component project variables list $(abspath $@)"
|
$(details) "Building component project variables list $(abspath $@)"
|
||||||
@echo "# Automatically generated build file. Do not edit." > $@
|
@echo '# Automatically generated build file. Do not edit.' > $@
|
||||||
@echo "COMPONENT_INCLUDES += $(addprefix $(COMPONENT_PATH)/,$(COMPONENT_ADD_INCLUDEDIRS))" >> $@
|
@echo 'COMPONENT_INCLUDES += $(call MakeRelativePath,$(addprefix $(COMPONENT_PATH)/,$(COMPONENT_ADD_INCLUDEDIRS)))' >> $@
|
||||||
@echo "COMPONENT_LDFLAGS += $(COMPONENT_ADD_LDFLAGS)" >> $@
|
@echo 'COMPONENT_LDFLAGS += $(call MakeRelativePath,$(COMPONENT_ADD_LDFLAGS))' >> $@
|
||||||
@echo "$(COMPONENT_NAME)-build: $(addsuffix -build,$(COMPONENT_DEPENDS))" >> $@
|
@echo '$(COMPONENT_NAME)-build: $(addsuffix -build,$(COMPONENT_DEPENDS))' >> $@
|
||||||
|
|
||||||
#Targets for build/clean. Use builtin recipe if component Makefile
|
#Targets for build/clean. Use builtin recipe if component Makefile
|
||||||
#hasn't defined its own.
|
#hasn't defined its own.
|
||||||
|
Reference in New Issue
Block a user