From 9b70e639350eeea9e5447ab73f55aebd75c7ed91 Mon Sep 17 00:00:00 2001 From: Krzysztof Czurylo Date: Thu, 6 Nov 2014 15:05:39 +0100 Subject: [PATCH] commmon: allow appending extra CFLAGS/LDFLAGS via command line With this change, user may provide the extra flags CFLAGS/LDFLAGS using the following syntax: Example #1: > make EXTRA_CFLAGS=-finstrument-functions Example #2: > CFLAGS=-finstrument-functions make --- src/Makefile.inc | 4 ++-- src/debug/Makefile | 2 +- src/jemalloc.cfg | 2 +- src/nondebug/Makefile | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Makefile.inc b/src/Makefile.inc index e8f551375f2..c97e54b278b 100644 --- a/src/Makefile.inc +++ b/src/Makefile.inc @@ -67,8 +67,8 @@ vpath %.c .. vpath %.h .. ../include INCS = -I.. -I../include -CFLAGS += -std=gnu99 -Wall -Werror -LDFLAGS = -Wl,-z,relro +CFLAGS += -std=gnu99 -Wall -Werror $(EXTRA_CFLAGS) +LDFLAGS += -Wl,-z,relro $(EXTRA_LDFLAGS) LN = ln PMEMSOVERSION = 1 diff --git a/src/debug/Makefile b/src/debug/Makefile index d0b25598f16..85fb3db879e 100644 --- a/src/debug/Makefile +++ b/src/debug/Makefile @@ -34,7 +34,7 @@ # src/debug/Makefile -- build the debug versions of the NVM Library # -CFLAGS = -ggdb -DDEBUG +CFLAGS += -ggdb -DDEBUG JEMALLOC_OBJROOT = debug VARIANT_DESTDIR = nvml_debug diff --git a/src/jemalloc.cfg b/src/jemalloc.cfg index 90385c6834c..a89af9014c1 100644 --- a/src/jemalloc.cfg +++ b/src/jemalloc.cfg @@ -3,5 +3,5 @@ --with-private-namespace=je_vmem_ --disable-xmalloc --disable-munmap -EXTRA_CFLAGS="-DJEMALLOC_LIBVMEM -Werror" +EXTRA_CFLAGS="-DJEMALLOC_LIBVMEM" diff --git a/src/nondebug/Makefile b/src/nondebug/Makefile index 405dab1222b..405a76ce929 100644 --- a/src/nondebug/Makefile +++ b/src/nondebug/Makefile @@ -34,7 +34,7 @@ # src/nondebug/Makefile -- build the nondebug versions of the NVM Library # -CFLAGS = -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 +CFLAGS += -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 JEMALLOC_OBJROOT = nondebug include ../Makefile.inc