From aae22ca298198e5791490702bfceefd78a0140b2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 15 Mar 2017 23:12:24 +0100 Subject: [PATCH] TP 11 exo2: sync with the latest Makefile version with LTO and GOLD support. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- TP_11/exo2/Makefile | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/TP_11/exo2/Makefile b/TP_11/exo2/Makefile index d1ca467..5555dc6 100644 --- a/TP_11/exo2/Makefile +++ b/TP_11/exo2/Makefile @@ -42,18 +42,31 @@ BUILDDIR := .build/debug DEBUG_FLAG = -g STRIP_FLAG = OPTI_FLAG = -O0 +LTO_SUPPORT = yes +GOLD_SUPPORT = yes else BUILDDIR := .build/release DEBUG_FLAG = STRIP_FLAG = -s OPTI_FLAG = -O3 +LTO_SUPPORT = yes +GOLD_SUPPORT = yes +endif + +ifeq ($(LTO_SUPPORT),yes) +CFLAGS_LTO = -flto -ffat-lto-objects +LDFLAGS_LTO = -fuse-linker-plugin -flto +endif + +ifeq ($(GOLD_SUPPORT),yes) +LDFLAGS_GOLD = -fuse-ld=gold endif # Putting header files in the source directory is not the purpose of this INCLUDES variable INCLUDES := $(INCLUDES) -I$(LIBRARY_PATH) -CFLAGS := $(CFLAGS) $(WARN_FLAGS) $(STD_FLAG) $(OPTI_FLAG) $(DEBUG_FLAG) $(INCLUDES) +CFLAGS := $(CFLAGS) $(CFLAGS_LTO) $(WARN_FLAGS) $(STD_FLAG) $(OPTI_FLAG) $(DEBUG_FLAG) $(INCLUDES) LIBCFLAGS := -fPIC $(CFLAGS) -LDFLAGS := $(LDFLAGS) $(STRIP_FLAG) +LDFLAGS := $(LDFLAGS) $(LDFLAGS_LTO) $(LDFLAGS_GOLD) $(STRIP_FLAG) LIBLDFLAGS := -shared $(LDFLAGS) STATICLIBLDFLAGS := -static $(LDFLAGS) LDLIBS := $(LDLIBS) -L$(LIBRARY_PATH) -l$(BINARY_NAME) -- 2.34.1