Makefile: add an option flag for flto
e.g. for make regressiontests you could disable it for little faster test simple: make regresstiontests USE_FLTO=no
This commit is contained in:
parent
963a1ad76f
commit
c5c58c82a8
|
|
@ -125,6 +125,10 @@ else ifeq ($(MCU), stm32f411)
|
||||||
STARTUP_FILE = cmsis-startup_stm32f411xe.s
|
STARTUP_FILE = cmsis-startup_stm32f411xe.s
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Link time optimization is on by default
|
||||||
|
ifeq ($(USE_FLTO),)
|
||||||
|
USE_FLTO=yes
|
||||||
|
endif
|
||||||
# Startup definitions. Not target MCU specific.
|
# Startup definitions. Not target MCU specific.
|
||||||
CFLAGS = -D__STARTUP_CLEAR_BSS -D__START=main
|
CFLAGS = -D__STARTUP_CLEAR_BSS -D__START=main
|
||||||
ifeq ($(MCU), lpc1114)
|
ifeq ($(MCU), lpc1114)
|
||||||
|
|
@ -145,7 +149,9 @@ endif
|
||||||
CFLAGS += -Wall
|
CFLAGS += -Wall
|
||||||
CFLAGS += -Wstrict-prototypes
|
CFLAGS += -Wstrict-prototypes
|
||||||
CFLAGS += -Os
|
CFLAGS += -Os
|
||||||
CFLAGS += -flto
|
ifeq ($(USE_FLTO),yes)
|
||||||
|
CFLAGS += -flto
|
||||||
|
endif
|
||||||
CFLAGS += -ffunction-sections
|
CFLAGS += -ffunction-sections
|
||||||
CFLAGS += -fdata-sections
|
CFLAGS += -fdata-sections
|
||||||
#CFLAGS += -dM -E # To list all predefined macros into the .o file.
|
#CFLAGS += -dM -E # To list all predefined macros into the .o file.
|
||||||
|
|
|
||||||
|
|
@ -113,6 +113,10 @@ TARGET = $(PROGRAM).hex
|
||||||
# to keep this working and can take a shortcut:
|
# to keep this working and can take a shortcut:
|
||||||
SOURCES = $(wildcard *.c)
|
SOURCES = $(wildcard *.c)
|
||||||
|
|
||||||
|
# Link time optimization is on by default
|
||||||
|
ifeq ($(USE_FLTO),)
|
||||||
|
USE_FLTO=yes
|
||||||
|
endif
|
||||||
CFLAGS = $(EXTRA_CFLAGS)
|
CFLAGS = $(EXTRA_CFLAGS)
|
||||||
CFLAGS += -DF_CPU=$(F_CPU)
|
CFLAGS += -DF_CPU=$(F_CPU)
|
||||||
CFLAGS += -DMCU_STR=\"$(MCU)\"
|
CFLAGS += -DMCU_STR=\"$(MCU)\"
|
||||||
|
|
@ -132,7 +136,9 @@ CFLAGS += -Os
|
||||||
CFLAGS += -ffunction-sections
|
CFLAGS += -ffunction-sections
|
||||||
CFLAGS += -finline-functions-called-once
|
CFLAGS += -finline-functions-called-once
|
||||||
CFLAGS += -mcall-prologues
|
CFLAGS += -mcall-prologues
|
||||||
CFLAGS += -flto
|
ifeq ($(USE_FLTO),yes)
|
||||||
|
CFLAGS += -flto
|
||||||
|
endif
|
||||||
CFLAGS += -Wa,-adhlns=$(@:.o=.al)
|
CFLAGS += -Wa,-adhlns=$(@:.o=.al)
|
||||||
#CFLAGS += -dM -E # To list all predefined macros into the .o file.
|
#CFLAGS += -dM -E # To list all predefined macros into the .o file.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue