forked from espressif/esp-idf
build system: Don't error out if an already-build project or IDF directory has moved
This commit is contained in:
committed by
Angus Gratton
parent
d664e32394
commit
8d42fe3953
@@ -181,6 +181,18 @@ endif
|
|||||||
# Include all dependency files already generated
|
# Include all dependency files already generated
|
||||||
-include $(COMPONENT_OBJS:.o=.d)
|
-include $(COMPONENT_OBJS:.o=.d)
|
||||||
|
|
||||||
|
# This is a fix for situation where the project or IDF dir moves, and instead
|
||||||
|
# of rebuilding the target the build fails until make clean is run
|
||||||
|
#
|
||||||
|
# It adds an empty dependency rule for the (possibly non-existent) source file itself,
|
||||||
|
# which prevents it not being found from failing the build
|
||||||
|
#
|
||||||
|
# $1 == Source File, $2 == .o file used for .d file name
|
||||||
|
define AppendSourceToDependencies
|
||||||
|
echo "$1:" >> $$(patsubst %.o,%.d,$2)
|
||||||
|
endef
|
||||||
|
|
||||||
|
|
||||||
# This pattern is generated for each COMPONENT_SRCDIR to compile the files in it.
|
# This pattern is generated for each COMPONENT_SRCDIR to compile the files in it.
|
||||||
define GenerateCompileTargets
|
define GenerateCompileTargets
|
||||||
# $(1) - directory containing source files, relative to $(COMPONENT_PATH) - one of $(COMPONENT_SRCDIRS)
|
# $(1) - directory containing source files, relative to $(COMPONENT_PATH) - one of $(COMPONENT_SRCDIRS)
|
||||||
@@ -188,14 +200,17 @@ define GenerateCompileTargets
|
|||||||
$(1)/%.o: $$(COMPONENT_PATH)/$(1)/%.c $(COMMON_MAKEFILES) $(COMPONENT_MAKEFILE) | $(COMPONENT_SRCDIRS)
|
$(1)/%.o: $$(COMPONENT_PATH)/$(1)/%.c $(COMMON_MAKEFILES) $(COMPONENT_MAKEFILE) | $(COMPONENT_SRCDIRS)
|
||||||
$$(summary) CC $$@
|
$$(summary) CC $$@
|
||||||
$$(CC) $$(CFLAGS) $$(CPPFLAGS) $$(addprefix -I ,$$(COMPONENT_INCLUDES)) $$(addprefix -I ,$$(COMPONENT_EXTRA_INCLUDES)) -I$(1) -c $$< -o $$@
|
$$(CC) $$(CFLAGS) $$(CPPFLAGS) $$(addprefix -I ,$$(COMPONENT_INCLUDES)) $$(addprefix -I ,$$(COMPONENT_EXTRA_INCLUDES)) -I$(1) -c $$< -o $$@
|
||||||
|
$(call AppendSourceToDependencies,$$<,$$@)
|
||||||
|
|
||||||
$(1)/%.o: $$(COMPONENT_PATH)/$(1)/%.cpp $(COMMON_MAKEFILES) $(COMPONENT_MAKEFILE) | $(COMPONENT_SRCDIRS)
|
$(1)/%.o: $$(COMPONENT_PATH)/$(1)/%.cpp $(COMMON_MAKEFILES) $(COMPONENT_MAKEFILE) | $(COMPONENT_SRCDIRS)
|
||||||
$$(summary) CXX $$@
|
$$(summary) CXX $$@
|
||||||
$$(CXX) $$(CXXFLAGS) $$(CPPFLAGS) $$(addprefix -I,$$(COMPONENT_INCLUDES)) $$(addprefix -I,$$(COMPONENT_EXTRA_INCLUDES)) -I$(1) -c $$< -o $$@
|
$$(CXX) $$(CXXFLAGS) $$(CPPFLAGS) $$(addprefix -I,$$(COMPONENT_INCLUDES)) $$(addprefix -I,$$(COMPONENT_EXTRA_INCLUDES)) -I$(1) -c $$< -o $$@
|
||||||
|
$(call AppendSourceToDependencies,$$<,$$@)
|
||||||
|
|
||||||
$(1)/%.o: $$(COMPONENT_PATH)/$(1)/%.S $(COMMON_MAKEFILES) $(COMPONENT_MAKEFILE) | $(COMPONENT_SRCDIRS)
|
$(1)/%.o: $$(COMPONENT_PATH)/$(1)/%.S $(COMMON_MAKEFILES) $(COMPONENT_MAKEFILE) | $(COMPONENT_SRCDIRS)
|
||||||
$$(summary) AS $$@
|
$$(summary) AS $$@
|
||||||
$$(CC) $$(CPPFLAGS) $$(DEBUG_FLAGS) $$(addprefix -I ,$$(COMPONENT_INCLUDES)) $$(addprefix -I ,$$(COMPONENT_EXTRA_INCLUDES)) -I$(1) -c $$< -o $$@
|
$$(CC) $$(CPPFLAGS) $$(DEBUG_FLAGS) $$(addprefix -I ,$$(COMPONENT_INCLUDES)) $$(addprefix -I ,$$(COMPONENT_EXTRA_INCLUDES)) -I$(1) -c $$< -o $$@
|
||||||
|
$(call AppendSourceToDependencies,$$<,$$@)
|
||||||
|
|
||||||
# CWD is build dir, create the build subdirectory if it doesn't exist
|
# CWD is build dir, create the build subdirectory if it doesn't exist
|
||||||
#
|
#
|
||||||
|
Reference in New Issue
Block a user