X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=TP_13%2Fexo1%2FMakefile;h=5d1b9ab13ddcbaee4388fb9778161cfedb6305ac;hb=709c39546ac5df7fd3154073fd40227ea4939826;hp=6dcb22ae3bfa6103f0cfb37e90cccbbda7ddd67a;hpb=2fa527aa5e1f57c39f85e80373559ed7b5af160a;p=TD_C.git diff --git a/TP_13/exo1/Makefile b/TP_13/exo1/Makefile index 6dcb22a..5d1b9ab 100644 --- a/TP_13/exo1/Makefile +++ b/TP_13/exo1/Makefile @@ -3,7 +3,7 @@ # This Makefile expect all source files (.c) to be at the same level, in the # $(SRC_PATH) directory. # -# This Makefile expect all embedded library files (.c) to be at the same level, in the +# This Makefile expect all embedded library source files (.c) to be at the same level, in the # $(LIBRARY_PATH) directory. # # It will automatically generate dependencies, compile all files, and produce a @@ -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$(SRC_PATH) -I$(LIBRARY_PATH) -CFLAGS := $(CFLAGS) $(WARN_FLAGS) $(STD_FLAG) $(OPTI_FLAG) $(DEBUG_FLAG) $(INCLUDES) +INCLUDES := $(INCLUDES) -I$(LIBRARY_PATH) +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)