1
0
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:
Kaspar Schleiser 2016-08-10 16:03:53 +02:00
parent afb6cb4507
commit 1f9a87972b
2 changed files with 10 additions and 5 deletions

View File

@ -23,7 +23,7 @@ ${DIRS:%=CLEAN--%}:
"$(MAKE)" -C ${@:CLEAN--%=%} clean
ifeq ($(strip $(SRC)),)
SRC := $(wildcard *.c)
SRC := $(filter-out $(SRC_NOLTO), $(wildcard *.c))
endif
ifeq ($(strip $(SRCXX)),)
SRCXX := $(wildcard *.cpp)
@ -35,7 +35,9 @@ ifeq ($(strip $(ASSMSRC)),)
ASSMSRC := $(wildcard *.S)
endif
OBJC := $(SRC:%.c=$(BINDIR)$(MODULE)/%.o)
OBJC_LTO := $(SRC:%.c=$(BINDIR)$(MODULE)/%.o)
OBJC_NOLTO := $(SRC_NOLTO:%.c=$(BINDIR)$(MODULE)/%.o)
OBJC := $(OBJC_NOLTO) $(OBJC_LTO)
OBJCXX := $(SRCXX:%.cpp=$(BINDIR)$(MODULE)/%.o)
ASMOBJ := $(ASMSRC:%.s=$(BINDIR)$(MODULE)/%.o)
ASSMOBJ := $(ASSMSRC:%.S=$(BINDIR)$(MODULE)/%.o)
@ -56,6 +58,8 @@ CXXFLAGS = $(filter-out $(CXXUWFLAGS), $(CFLAGS)) $(CXXEXFLAGS)
# compile and generate dependency info
$(OBJC_LTO): CFLAGS+=$(LTOFLAGS)
$(OBJC): $(BINDIR)$(MODULE)/%.o: %.c $(RIOTBUILD_CONFIG_HEADER_C)
$(AD)$(CCACHE) $(CC) \
-DRIOT_FILE_RELATIVE=\"$(patsubst $(RIOTBASE)/%,%,$(abspath $<))\" \

View File

@ -35,6 +35,7 @@ export AS # 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 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 OFLAGS # The parameter for OBJCOPY, e.g. to strip the debug information.
export OBJDUMP # The command used to create the assembly listing.