Made LTO optional in the Makefile, disabled by default

This commit is contained in:
Dimitris Panokostas 2019-09-15 11:35:00 +02:00
parent d0ec432870
commit 6e95d62ae9

View file

@ -33,6 +33,7 @@ CPPFLAGS=-MD -MT $@ -MF $(@:%.o=%.d)
#GCC_PROFILE=1
#GEN_PROFILE=1
#USE_PROFILE=1
#USE_LTO=1
#SANITIZE=1
#
@ -231,7 +232,7 @@ endif
DEFS = $(XML_CFLAGS) -DAMIBERRY
CPPFLAGS += -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Isrc/archivers $(DEFS)
XML_CFLAGS := $(shell xml2-config --cflags )
LDFLAGS += -flto -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed
LDFLAGS += -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed
ifndef DEBUG
CFLAGS += -Ofast -frename-registers
@ -239,6 +240,11 @@ else
CFLAGS += -g -rdynamic -funwind-tables -DDEBUG -Wl,--export-dynamic
endif
ifdef USE_LTO
export CFLAGS=-flto=4 -march=native -floop=strip-mine -floop-block
export LDFLAGS=-flto=4 -fuse-linker-plugin -fuse-ld=gold -march=native
endif
ifdef GCC_PROFILE
CFLAGS += -pg
LDFLAGS += -pg