From 6e840f8033aab2b73c8b99b00cb91a20ed578e2b Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Sun, 9 Sep 2012 10:02:11 +0200 Subject: [PATCH 1/1] Enable link time optimization only when optimizing Because it is quite slow, skip it when 'optimize' flag is 'no' No functional change. --- src/Makefile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Makefile b/src/Makefile index 3fd601ff..2ad22de4 100644 --- a/src/Makefile +++ b/src/Makefile @@ -321,11 +321,13 @@ endif ### This is a mix of compile and link time options because the lto link phase ### needs access to the optimization flags. ifeq ($(comp),gcc) - GCC_MAJOR := `$(CXX) -dumpversion | cut -f1 -d.` - GCC_MINOR := `$(CXX) -dumpversion | cut -f2 -d.` - ifeq (1,$(shell expr \( $(GCC_MAJOR) \> 4 \) \| \( $(GCC_MAJOR) \= 4 \& $(GCC_MINOR) \>= 5 \))) - CXXFLAGS += -flto - LDFLAGS += $(CXXFLAGS) + ifeq ($(optimize),yes) + GCC_MAJOR := `$(CXX) -dumpversion | cut -f1 -d.` + GCC_MINOR := `$(CXX) -dumpversion | cut -f2 -d.` + ifeq (1,$(shell expr \( $(GCC_MAJOR) \> 4 \) \| \( $(GCC_MAJOR) \= 4 \& $(GCC_MINOR) \>= 5 \))) + CXXFLAGS += -flto + LDFLAGS += $(CXXFLAGS) + endif endif endif -- 2.39.2