mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
make: allow per-file conditional LTO compile
This commit is contained in:
parent
afb6cb4507
commit
1f9a87972b
@ -23,7 +23,7 @@ ${DIRS:%=CLEAN--%}:
|
|||||||
"$(MAKE)" -C ${@:CLEAN--%=%} clean
|
"$(MAKE)" -C ${@:CLEAN--%=%} clean
|
||||||
|
|
||||||
ifeq ($(strip $(SRC)),)
|
ifeq ($(strip $(SRC)),)
|
||||||
SRC := $(wildcard *.c)
|
SRC := $(filter-out $(SRC_NOLTO), $(wildcard *.c))
|
||||||
endif
|
endif
|
||||||
ifeq ($(strip $(SRCXX)),)
|
ifeq ($(strip $(SRCXX)),)
|
||||||
SRCXX := $(wildcard *.cpp)
|
SRCXX := $(wildcard *.cpp)
|
||||||
@ -35,10 +35,12 @@ ifeq ($(strip $(ASSMSRC)),)
|
|||||||
ASSMSRC := $(wildcard *.S)
|
ASSMSRC := $(wildcard *.S)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
OBJC := $(SRC:%.c=$(BINDIR)$(MODULE)/%.o)
|
OBJC_LTO := $(SRC:%.c=$(BINDIR)$(MODULE)/%.o)
|
||||||
OBJCXX := $(SRCXX:%.cpp=$(BINDIR)$(MODULE)/%.o)
|
OBJC_NOLTO := $(SRC_NOLTO:%.c=$(BINDIR)$(MODULE)/%.o)
|
||||||
ASMOBJ := $(ASMSRC:%.s=$(BINDIR)$(MODULE)/%.o)
|
OBJC := $(OBJC_NOLTO) $(OBJC_LTO)
|
||||||
ASSMOBJ := $(ASSMSRC:%.S=$(BINDIR)$(MODULE)/%.o)
|
OBJCXX := $(SRCXX:%.cpp=$(BINDIR)$(MODULE)/%.o)
|
||||||
|
ASMOBJ := $(ASMSRC:%.s=$(BINDIR)$(MODULE)/%.o)
|
||||||
|
ASSMOBJ := $(ASSMSRC:%.S=$(BINDIR)$(MODULE)/%.o)
|
||||||
|
|
||||||
OBJ := $(OBJC) $(OBJCXX) $(ASMOBJ) $(ASSMOBJ)
|
OBJ := $(OBJC) $(OBJCXX) $(ASMOBJ) $(ASSMOBJ)
|
||||||
DEP := $(OBJC:.o=.d) $(OBJCXX:.o=.d) $(ASSMOBJ:.o=.d)
|
DEP := $(OBJC:.o=.d) $(OBJCXX:.o=.d) $(ASSMOBJ:.o=.d)
|
||||||
@ -56,6 +58,8 @@ CXXFLAGS = $(filter-out $(CXXUWFLAGS), $(CFLAGS)) $(CXXEXFLAGS)
|
|||||||
|
|
||||||
# compile and generate dependency info
|
# compile and generate dependency info
|
||||||
|
|
||||||
|
$(OBJC_LTO): CFLAGS+=$(LTOFLAGS)
|
||||||
|
|
||||||
$(OBJC): $(BINDIR)$(MODULE)/%.o: %.c $(RIOTBUILD_CONFIG_HEADER_C)
|
$(OBJC): $(BINDIR)$(MODULE)/%.o: %.c $(RIOTBUILD_CONFIG_HEADER_C)
|
||||||
$(AD)$(CCACHE) $(CC) \
|
$(AD)$(CCACHE) $(CC) \
|
||||||
-DRIOT_FILE_RELATIVE=\"$(patsubst $(RIOTBASE)/%,%,$(abspath $<))\" \
|
-DRIOT_FILE_RELATIVE=\"$(patsubst $(RIOTBASE)/%,%,$(abspath $<))\" \
|
||||||
|
@ -35,6 +35,7 @@ export AS # The assembler.
|
|||||||
export ASFLAGS # Flags for the assembler.
|
export ASFLAGS # Flags for the assembler.
|
||||||
export LINK # The command used to link the files. Must take the same parameters as GCC, i.e. "ld" won't work.
|
export LINK # The command used to link the files. Must take the same parameters as GCC, i.e. "ld" won't work.
|
||||||
export LINKFLAGS # Flags to supply in the linking step.
|
export LINKFLAGS # Flags to supply in the linking step.
|
||||||
|
export LTOFLAGS # extra CFLAGS for compiling with link time optimization
|
||||||
export OBJCOPY # The command used to create the HEXFILE.
|
export OBJCOPY # The command used to create the HEXFILE.
|
||||||
export OFLAGS # The parameter for OBJCOPY, e.g. to strip the debug information.
|
export OFLAGS # The parameter for OBJCOPY, e.g. to strip the debug information.
|
||||||
export OBJDUMP # The command used to create the assembly listing.
|
export OBJDUMP # The command used to create the assembly listing.
|
||||||
|
Loading…
Reference in New Issue
Block a user