software/common: add LTO enable flag and cleanup.
This commit is contained in:
parent
b29f443fe5
commit
1d7c6943af
|
@ -7,14 +7,20 @@ endif
|
||||||
RM ?= rm -f
|
RM ?= rm -f
|
||||||
PYTHON ?= python3
|
PYTHON ?= python3
|
||||||
|
|
||||||
ifeq ($(CLANG),1)
|
ifneq ($(CPU), lm32)
|
||||||
|
LTO = 0
|
||||||
|
else
|
||||||
|
LTO = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CLANG), 1)
|
||||||
CC_normal := clang -target $(TRIPLE) -integrated-as
|
CC_normal := clang -target $(TRIPLE) -integrated-as
|
||||||
CX_normal := clang++ -target $(TRIPLE) -integrated-as
|
CX_normal := clang++ -target $(TRIPLE) -integrated-as
|
||||||
else
|
else
|
||||||
CC_normal := $(TARGET_PREFIX)gcc -std=gnu99
|
CC_normal := $(TARGET_PREFIX)gcc -std=gnu99
|
||||||
CX_normal := $(TARGET_PREFIX)g++
|
CX_normal := $(TARGET_PREFIX)g++
|
||||||
endif
|
endif
|
||||||
ifneq ($(CPU), lm32)
|
ifneq ($(LTO), 1)
|
||||||
AR_normal := $(TARGET_PREFIX)gcc-ar
|
AR_normal := $(TARGET_PREFIX)gcc-ar
|
||||||
else
|
else
|
||||||
AR_normal := $(TARGET_PREFIX)ar
|
AR_normal := $(TARGET_PREFIX)ar
|
||||||
|
@ -28,7 +34,7 @@ AR_quiet = @echo " AR " $@ && $(AR_normal)
|
||||||
LD_quiet = @echo " LD " $@ && $(LD_normal)
|
LD_quiet = @echo " LD " $@ && $(LD_normal)
|
||||||
OBJCOPY_quiet = @echo " OBJCOPY " $@ && $(OBJCOPY_normal)
|
OBJCOPY_quiet = @echo " OBJCOPY " $@ && $(OBJCOPY_normal)
|
||||||
|
|
||||||
ifeq ($(V),1)
|
ifeq ($(V), 1)
|
||||||
CC = $(CC_normal)
|
CC = $(CC_normal)
|
||||||
CX = $(CX_normal)
|
CX = $(CX_normal)
|
||||||
AR = $(AR_normal)
|
AR = $(AR_normal)
|
||||||
|
@ -49,14 +55,15 @@ DEPFLAGS += -MD -MP
|
||||||
|
|
||||||
# Toolchain options
|
# Toolchain options
|
||||||
#
|
#
|
||||||
INCLUDES = -I$(SOC_DIRECTORY)/software/include/base -I$(SOC_DIRECTORY)/software/include -I$(SOC_DIRECTORY)/common -I$(BUILDINC_DIRECTORY)
|
INCLUDES = -I$(SOC_DIRECTORY)/software/include/base -I$(SOC_DIRECTORY)/software/include -I$(SOC_DIRECTORY)/common -I$(BUILDINC_DIRECTORY)
|
||||||
COMMONFLAGS = $(DEPFLAGS) -Os $(CPUFLAGS) -g3 -fomit-frame-pointer -Wall -fno-builtin -nostdinc $(INCLUDES) -ffunction-sections -fdata-sections -nostartfiles -nostdlib -nodefaultlibs
|
COMMONFLAGS = $(DEPFLAGS) -Os $(CPUFLAGS) -g3 -fomit-frame-pointer -Wall -fno-builtin -nostdinc $(INCLUDES)
|
||||||
ifneq ($(CPU), lm32)
|
COMMONFLAGS += -ffunction-sections -fdata-sections -nostartfiles -nostdlib -nodefaultlibs
|
||||||
|
ifneq ($(LTO), 1)
|
||||||
COMMONFLAGS += -flto -fuse-linker-plugin
|
COMMONFLAGS += -flto -fuse-linker-plugin
|
||||||
endif
|
endif
|
||||||
CFLAGS = $(COMMONFLAGS) -fexceptions -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes
|
CFLAGS = $(COMMONFLAGS) -fexceptions -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes
|
||||||
CXXFLAGS = $(COMMONFLAGS) -std=c++11 -I$(SOC_DIRECTORY)/software/include/basec++ -fexceptions -fno-rtti -ffreestanding
|
CXXFLAGS = $(COMMONFLAGS) -std=c++11 -I$(SOC_DIRECTORY)/software/include/basec++ -fexceptions -fno-rtti -ffreestanding
|
||||||
LDFLAGS = -nostdlib -nodefaultlibs -Os $(CPUFLAGS) -L$(BUILDINC_DIRECTORY)
|
LDFLAGS = -nostdlib -nodefaultlibs -Os $(CPUFLAGS) -L$(BUILDINC_DIRECTORY)
|
||||||
|
|
||||||
define compilexx
|
define compilexx
|
||||||
$(CX) -c $(CXXFLAGS) $(1) $< -o $@
|
$(CX) -c $(CXXFLAGS) $(1) $< -o $@
|
||||||
|
|
Loading…
Reference in New Issue