diff options
author | Christian Seiler <christian@iwakd.de> | 2015-05-28 18:33:21 +0200 |
---|---|---|
committer | Mike Christie <michaelc@cs.wisc.edu> | 2015-06-05 14:06:55 -0500 |
commit | da2473dc01bd5d6c4909e61d3b00284e5535f2ca (patch) | |
tree | a3bdccfda13f1ae645d34af325766771eadf66b7 | |
parent | 4a4498b3379599c25d5276dee84b328840ce969e (diff) | |
download | open-iscsi-da2473dc01bd5d6c4909e61d3b00284e5535f2ca.tar.gz |
buildsys: respect CFLAGS and LDFLAGS from the outside
Make the build systsem respect CFLAGS and LDFLAGS set from the outside.
Previously, OPTFLAGS could be set to alter CFLAGS (which were
overridden completely), but that is non-standard, so also check for
user-set CFLAGS. This will make life easier when packaging this for
distributions. If OPTFLAGS is set, prefer that to CFLAGS to retain the
old behavior in that case (and not break current builds).
Additionally, also use LDFLAGS for linking the binaries, which was not
respected at all previously.
-rw-r--r-- | Makefile | 13 | ||||
-rw-r--r-- | iscsiuio/configure.ac | 3 | ||||
-rw-r--r-- | usr/Makefile | 10 | ||||
-rw-r--r-- | utils/Makefile | 5 | ||||
-rw-r--r-- | utils/fwparam_ibft/Makefile | 4 | ||||
-rw-r--r-- | utils/sysdeps/Makefile | 3 |
6 files changed, 26 insertions, 12 deletions
@@ -20,6 +20,17 @@ INSTALL = install ETCFILES = etc/iscsid.conf IFACEFILES = etc/iface.example +# Compatibility: parse old OPTFLAGS argument +ifdef OPTFLAGS +CFLAGS = $(OPTFLAGS) +endif + +# Export it so configure of iscsiuio & open-isns will +# pick it up. +ifneq (,$(CFLAGS)) +export CFLAGS +endif + # Random comments: # using '$(MAKE)' instead of just 'make' allows make to run in parallel # over multiple makefile. @@ -44,7 +55,7 @@ user: utils/open-isns/Makefile iscsiuio/Makefile @echo "Read README file for detailed information." utils/open-isns/Makefile: utils/open-isns/configure utils/open-isns/Makefile.in - cd utils/open-isns; ./configure CFLAGS="$(OPTFLAGS)" --with-security=no + cd utils/open-isns; ./configure --with-security=no iscsiuio/Makefile: iscsiuio/configure iscsiuio/Makefile.in cd iscsiuio; ./configure diff --git a/iscsiuio/configure.ac b/iscsiuio/configure.ac index 7ee1e73..6c0013b 100644 --- a/iscsiuio/configure.ac +++ b/iscsiuio/configure.ac @@ -53,7 +53,8 @@ AC_LIBTOOL_DLOPEN # libtool stuff AC_PROG_LIBTOOL -CFLAGS="${CFLAGS} -O2 -Wall" +: ${CFLAGS:="-O2"} +CFLAGS="${CFLAGS} -Wall" ## check for --enable-debug first before checking CFLAGS before ## so that we don't mix -O and -g AC_ARG_ENABLE(debug, diff --git a/usr/Makefile b/usr/Makefile index 9209d5d..e23fee1 100644 --- a/usr/Makefile +++ b/usr/Makefile @@ -28,9 +28,9 @@ IPC_OBJ=ioctl.o endif endif -OPTFLAGS ?= -O2 -g +CFLAGS ?= -O2 -g WARNFLAGS ?= -Wall -Wstrict-prototypes -CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -I../include -I. -I../utils/open-isns \ +CFLAGS += $(WARNFLAGS) -I../include -I. -I../utils/open-isns \ -D$(OSNAME) $(IPC_CFLAGS) PROGRAMS = iscsid iscsiadm iscsistart @@ -55,14 +55,14 @@ all: $(PROGRAMS) iscsid: $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(DISCOVERY_SRCS) \ iscsid.o session_mgmt.o discoveryd.o - $(CC) $(CFLAGS) $^ -o $@ -L../utils/open-isns -lisns -lrt -lmount + $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -L../utils/open-isns -lisns -lrt -lmount iscsiadm: $(ISCSI_LIB_SRCS) $(DISCOVERY_SRCS) iscsiadm.o session_mgmt.o - $(CC) $(CFLAGS) $^ -o $@ -L../utils/open-isns -lisns + $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -L../utils/open-isns -lisns iscsistart: $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(FW_BOOT_SRCS) \ iscsistart.o statics.o - $(CC) $(CFLAGS) $^ -o $@ -lrt -lmount + $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -lrt -lmount clean: rm -f *.o $(PROGRAMS) .depend $(LIBSYS) diff --git a/utils/Makefile b/utils/Makefile index 2c7e891..f65f1e7 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -1,12 +1,13 @@ # This Makefile will work only with GNU make. -CFLAGS += $(OPTFLAGS) -O2 -fno-inline -Wall -Wstrict-prototypes -g +CFLAGS ?= -O2 -fno-inline -g +CFLAGS += -Wall -Wstrict-prototypes PROGRAMS = iscsi-iname all: $(PROGRAMS) iscsi-iname: md5.o iscsi-iname.o - $(CC) $(CFLAGS) $^ $(DBM_LIB) -o $@ + $(CC) $(CFLAGS) $(LDFLAGS) $^ $(DBM_LIB) -o $@ clean: rm -f *.o $(PROGRAMS) .depend diff --git a/utils/fwparam_ibft/Makefile b/utils/fwparam_ibft/Makefile index c72bb7f..773d8eb 100644 --- a/utils/fwparam_ibft/Makefile +++ b/utils/fwparam_ibft/Makefile @@ -26,9 +26,9 @@ OBJS := fw_entry.o fwparam_sysfs.o $(SYSDEPS_OBJS) ../../usr/iscsi_net_util.o OBJS += prom_lex.o prom_parse.tab.o fwparam_ppc.o CLEANFILES = $(OBJS) *.output *~ -OPTFLAGS ?= -O2 -g -fPIC +CFLAGS ?= -O2 -g WARNFLAGS ?= -Wall -Wstrict-prototypes -CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -I../../include -I../../usr -D_GNU_SOURCE +CFLAGS += -fPIC $(WARNFLAGS) -I../../include -I../../usr -D_GNU_SOURCE all: $(OBJS) diff --git a/utils/sysdeps/Makefile b/utils/sysdeps/Makefile index 53c10e5..4299164 100644 --- a/utils/sysdeps/Makefile +++ b/utils/sysdeps/Makefile @@ -1,6 +1,7 @@ # This Makefile will work only with GNU make. -CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -O2 -fno-inline -Wall -Wstrict-prototypes -g +CFLAGS ?= -O2 -fno-inline -g +CFLAGS += $(WARNFLAGS) -Wall -Wstrict-prototypes SYSDEPS_OBJS=sysdeps.o |