1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

makefiles: protect CFLAGS

When CFLAGS and LDFLAGS are passed into - protect them,
and avoid even recursive subdir 'extension' of them.
This commit is contained in:
Zdenek Kabelac 2015-05-13 23:43:50 +02:00
parent a2c9ede6b3
commit 6fb2552ef4

View File

@ -46,11 +46,11 @@ LIBS = @LIBS@
STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS) STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS)
DEFS += @DEFS@ DEFS += @DEFS@
# FIXME set this only where it's needed, not globally? # FIXME set this only where it's needed, not globally?
CFLAGS += @CFLAGS@ CFLAGS ?= @COPTIMISE_FLAG@ @CFLAGS@
LDFLAGS ?= @COPTIMISE_FLAG@ @LDFLAGS@
CLDFLAGS += @CLDFLAGS@ CLDFLAGS += @CLDFLAGS@
ELDFLAGS += @ELDFLAGS@ ELDFLAGS += @ELDFLAGS@
LDDEPS += @LDDEPS@ LDDEPS += @LDDEPS@
LDFLAGS += @LDFLAGS@
LIB_SUFFIX = @LIB_SUFFIX@ LIB_SUFFIX = @LIB_SUFFIX@
LVMINTERNAL_LIBS = -llvm-internal $(DAEMON_LIBS) $(UDEV_LIBS) $(DL_LIBS) $(BLKID_LIBS) LVMINTERNAL_LIBS = -llvm-internal $(DAEMON_LIBS) $(UDEV_LIBS) $(DL_LIBS) $(BLKID_LIBS)
DL_LIBS = @DL_LIBS@ DL_LIBS = @DL_LIBS@
@ -204,8 +204,13 @@ endif
#WFLAGS += -pedantic -std=gnu99 #WFLAGS += -pedantic -std=gnu99
#DEFS += -DDEBUG_CRC32 #DEFS += -DDEBUG_CRC32
CFLAGS += -fPIC @COPTIMISE_FLAG@ #
LDFLAGS += @COPTIMISE_FLAG@ # Avoid recursive extension of CFLAGS
# by checking whether CFLAGS already has fPIC string
#
ifeq (,$(findstring fPIC,$(CFLAGS)))
CFLAGS += -fPIC
ifeq ("@DEBUG@", "yes") ifeq ("@DEBUG@", "yes")
CFLAGS += -g -fno-omit-frame-pointer CFLAGS += -g -fno-omit-frame-pointer
@ -216,6 +221,10 @@ ifeq ("@DEBUG@", "yes")
endif endif
endif endif
# end of fPIC protection
endif
ifeq ("@INTL@", "yes") ifeq ("@INTL@", "yes")
DEFS += -DINTL_PACKAGE=\"@INTL_PACKAGE@\" -DLOCALEDIR=\"@LOCALEDIR@\" DEFS += -DINTL_PACKAGE=\"@INTL_PACKAGE@\" -DLOCALEDIR=\"@LOCALEDIR@\"
endif endif