kopia lustrzana https://github.com/micropython/micropython
py/Makefile: Add helper to declare variables as dependencies.
depend_var is a function that can be used to add a virtual dependency to a target based on the given make variable, eg: $(OBJ): $(call depend_var, MY_VAR)pull/9072/head
rodzic
bd4e45fd68
commit
6050ab7add
|
@ -29,6 +29,11 @@ else
|
||||||
Q =
|
Q =
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# depend_var is a function that can be used to add a virtual dependency
|
||||||
|
# to a target based on the given make variable.
|
||||||
|
# eg. $(OBJ): $(call depend_var, MY_VAR)
|
||||||
|
depend_var = $(BUILD)/dependvar/$(strip $(1))+$(shell echo $($(strip $(1))) | md5sum | cut -d ' ' -f 1)
|
||||||
|
|
||||||
# default settings; can be overridden in main Makefile
|
# default settings; can be overridden in main Makefile
|
||||||
|
|
||||||
PY_SRC ?= $(TOP)/py
|
PY_SRC ?= $(TOP)/py
|
||||||
|
|
|
@ -25,6 +25,14 @@ QSTR_GEN_CFLAGS += $(QSTR_GEN_FLAGS)
|
||||||
QSTR_GEN_CXXFLAGS := $(CXXFLAGS)
|
QSTR_GEN_CXXFLAGS := $(CXXFLAGS)
|
||||||
QSTR_GEN_CXXFLAGS += $(QSTR_GEN_FLAGS)
|
QSTR_GEN_CXXFLAGS += $(QSTR_GEN_FLAGS)
|
||||||
|
|
||||||
|
# depend_var is a function that can be used to add a virtual dependency
|
||||||
|
# to a target based on the given make variable.
|
||||||
|
# eg. $(OBJ): $(call depend_var, MY_VAR)
|
||||||
|
$(BUILD)/dependvar/%:
|
||||||
|
@mkdir -p $(BUILD)/dependvar
|
||||||
|
@rm -f $(BUILD)/dependvar/$(firstword $(subst +, ,$*))+*
|
||||||
|
$(Q)echo $($(firstword $(subst +, ,$*))) > $@
|
||||||
|
|
||||||
# This file expects that OBJ contains a list of all of the object files.
|
# This file expects that OBJ contains a list of all of the object files.
|
||||||
# The directory portion of each object file is used to locate the source
|
# The directory portion of each object file is used to locate the source
|
||||||
# and should not contain any ..'s but rather be relative to the top of the
|
# and should not contain any ..'s but rather be relative to the top of the
|
||||||
|
|
Ładowanie…
Reference in New Issue