1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

make: add GENSRC (generated source files) support

This commit is contained in:
Kaspar Schleiser 2018-09-14 13:53:24 +02:00
parent 04712dbcfc
commit 4c3d473e4e

View File

@ -52,6 +52,10 @@ ifeq ($(strip $(ASSMSRC))$(NO_AUTO_SRC),)
ASSMSRC := $(wildcard *.S) ASSMSRC := $(wildcard *.S)
endif endif
# include makefile snippets that modify GENSRC here:
#include foo/bar.inc.mk
GENOBJC := $(GENSRC:%.c=%.o)
OBJC_LTO := $(SRC:%.c=$(BINDIR)/$(MODULE)/%.o) OBJC_LTO := $(SRC:%.c=$(BINDIR)/$(MODULE)/%.o)
OBJC_NOLTO := $(SRC_NOLTO:%.c=$(BINDIR)/$(MODULE)/%.o) OBJC_NOLTO := $(SRC_NOLTO:%.c=$(BINDIR)/$(MODULE)/%.o)
OBJC := $(OBJC_NOLTO) $(OBJC_LTO) OBJC := $(OBJC_NOLTO) $(OBJC_LTO)
@ -59,7 +63,7 @@ OBJCXX := $(SRCXX:%.cpp=$(BINDIR)/$(MODULE)/%.o)
ASMOBJ := $(ASMSRC:%.s=$(BINDIR)/$(MODULE)/%.o) ASMOBJ := $(ASMSRC:%.s=$(BINDIR)/$(MODULE)/%.o)
ASSMOBJ := $(ASSMSRC:%.S=$(BINDIR)/$(MODULE)/%.o) ASSMOBJ := $(ASSMSRC:%.S=$(BINDIR)/$(MODULE)/%.o)
OBJ := $(OBJC) $(OBJCXX) $(ASMOBJ) $(ASSMOBJ) OBJ := $(OBJC) $(OBJCXX) $(ASMOBJ) $(ASSMOBJ) $(GENOBJC)
DEP := $(OBJC:.o=.d) $(OBJCXX:.o=.d) $(ASSMOBJ:.o=.d) DEP := $(OBJC:.o=.d) $(OBJCXX:.o=.d) $(ASSMOBJ:.o=.d)
$(BINDIR)/$(MODULE)/: $(BINDIR)/$(MODULE)/:
@ -87,6 +91,12 @@ $(OBJC): $(BINDIR)/$(MODULE)/%.o: %.c $(RIOTBUILD_CONFIG_HEADER_C)
-DRIOT_FILE_NOPATH=\"$(notdir $<)\" \ -DRIOT_FILE_NOPATH=\"$(notdir $<)\" \
$(CFLAGS) $(INCLUDES) -MD -MP -c -o $@ $(abspath $<) $(CFLAGS) $(INCLUDES) -MD -MP -c -o $@ $(abspath $<)
$(GENOBJC): %.o: %.c $(RIOTBUILD_CONFIG_HEADER_C)
$(Q) $(CCACHE) $(CC) \
-DRIOT_FILE_RELATIVE=\"$(patsubst $(RIOTBASE)/%,%,$<)\" \
-DRIOT_FILE_NOPATH=\"$(notdir $<)\" \
$(CFLAGS) $(INCLUDES) -MD -MP -c -o $@ $<
$(OBJCXX): $(BINDIR)/$(MODULE)/%.o: %.cpp $(RIOTBUILD_CONFIG_HEADER_C) $(OBJCXX): $(BINDIR)/$(MODULE)/%.o: %.cpp $(RIOTBUILD_CONFIG_HEADER_C)
$(Q)$(CCACHE) $(CXX) \ $(Q)$(CCACHE) $(CXX) \
-DRIOT_FILE_RELATIVE=\"$(patsubst $(RIOTBASE)/%,%,$(abspath $<))\" \ -DRIOT_FILE_RELATIVE=\"$(patsubst $(RIOTBASE)/%,%,$(abspath $<))\" \