From patchwork Tue May 10 09:35:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 12844727 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 13200C433F5 for ; Tue, 10 May 2022 09:36:10 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-44-bzkmf70QMrmYu_lUc50Zfw-1; Tue, 10 May 2022 05:36:06 -0400 X-MC-Unique: bzkmf70QMrmYu_lUc50Zfw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EEC7F3C138C7; Tue, 10 May 2022 09:36:04 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 23417403D164; Tue, 10 May 2022 09:36:03 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D950C1947055; Tue, 10 May 2022 09:36:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id AD8071947052 for ; Tue, 10 May 2022 09:36:01 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8EA09C28101; Tue, 10 May 2022 09:36:01 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8B02AC28100 for ; Tue, 10 May 2022 09:36:01 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 725521010362 for ; Tue, 10 May 2022 09:36:01 +0000 (UTC) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-557-iODw5-K7N8WM0cMZk291mw-1; Tue, 10 May 2022 05:36:00 -0400 X-MC-Unique: iODw5-K7N8WM0cMZk291mw-1 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 9A35B21BB5; Tue, 10 May 2022 09:35:58 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 633B613AA5; Tue, 10 May 2022 09:35:58 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id IcxnFv4xemIANQAAMHmgww (envelope-from ); Tue, 10 May 2022 09:35:58 +0000 From: mwilck@suse.com To: Christophe Varoqui , Benjamin Marzinski , =?utf-8?q?Martin_Li=C5=A1ka?= Date: Tue, 10 May 2022 11:35:37 +0200 Message-Id: <20220510093538.25199-1-mwilck@suse.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Subject: [dm-devel] [PATCH 1/2] multipath-tools: move CPPFLAGS before CFLAGS X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dm-devel@redhat.com, Martin Wilck Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com From: Martin Wilck Distributions may want to override -D_FORTIFY_SOURCE in the generic OPTFLAGS variable. That requires that the autodected setting is evaluated before OPTFLAGS on the compiler command line. This way, distributions can use OPTFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 ..." without causing compilation errors. (Note that the "-U" is required). Move CPPFLAGS before CFLAGS in the compiler command line. Moreover, make sure CPPFLAGS is referenced in all compilation steps. Signed-off-by: Martin Wilck Reviewed-by: Martin Liska --- Makefile.inc | 2 +- libmultipath/Makefile | 6 +++--- multipathd/Makefile | 2 +- tests/Makefile | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile.inc b/Makefile.inc index b915c06..7422666 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -191,7 +191,7 @@ check_var = $(shell \ %.o: %.c @echo building $@ because of $? - $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< %.abi: %.so.0 abidw $< >$@ diff --git a/libmultipath/Makefile b/libmultipath/Makefile index a56dd1e..2fc3f3b 100644 --- a/libmultipath/Makefile +++ b/libmultipath/Makefile @@ -70,12 +70,12 @@ OBJS := $(OBJS-O) $(OBJS-U) all: $(DEVLIB) nvme-lib.o: nvme-lib.c nvme-ioctl.c nvme-ioctl.h - $(CC) $(CFLAGS) -Wno-unused-function -c -o $@ $< + $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused-function -c -o $@ $< # there are lots of "unused parameters" in dict.c # because not all handler / snprint methods need all parameters dict.o: dict.c - $(CC) $(CFLAGS) -Wno-unused-parameter -c -o $@ $< + $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused-parameter -c -o $@ $< make_static = $(shell sed '/^static/!s/^\([a-z]\{1,\} \)/static \1/' <$1 >$2) @@ -112,7 +112,7 @@ abi: $(LIBS:%.so.$(SONAME)=%-nv.abi) # This rule is invoked from tests/Makefile, overriding configdir and plugindir %-test.o: %.c @echo building $@ because of $? - $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< test-lib: ../tests/$(LIBS) diff --git a/multipathd/Makefile b/multipathd/Makefile index 9a49144..1449080 100644 --- a/multipathd/Makefile +++ b/multipathd/Makefile @@ -52,7 +52,7 @@ $(EXEC): $(OBJS) $(multipathdir)/libmultipath.so $(mpathcmddir)/libmpathcmd.so $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(EXEC) $(LIBDEPS) cli_handlers.o: cli_handlers.c - $(CC) $(CFLAGS) -Wno-unused-parameter -c -o $@ $< + $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused-parameter -c -o $@ $< install: $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir) diff --git a/tests/Makefile b/tests/Makefile index 0b39c30..a069e37 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -72,7 +72,7 @@ endif strbuf-test_OBJDEPS := ../libmultipath/strbuf.o %.o: %.c - $(CC) $(CFLAGS) $($*-test_FLAGS) -c -o $@ $< + $(CC) $(CPPFLAGS) $(CFLAGS) $($*-test_FLAGS) -c -o $@ $< lib/libchecktur.so: mkdir -p lib From patchwork Tue May 10 09:35:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 12844728 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C170DC433EF for ; Tue, 10 May 2022 09:36:14 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-639-Z36MBvJrNCa7Wtcq4FI9Ag-1; Tue, 10 May 2022 05:36:07 -0400 X-MC-Unique: Z36MBvJrNCa7Wtcq4FI9Ag-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F159286B8AD; Tue, 10 May 2022 09:36:04 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED672146870D; Tue, 10 May 2022 09:36:03 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CAF8E1947064; Tue, 10 May 2022 09:36:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BF5F01947052 for ; Tue, 10 May 2022 09:36:02 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 9F97142B943; Tue, 10 May 2022 09:36:02 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9B7EA42D3B9 for ; Tue, 10 May 2022 09:36:02 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7F780803792 for ; Tue, 10 May 2022 09:36:02 +0000 (UTC) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-587-lgoQHLWWMtK2dECBl6o_NQ-1; Tue, 10 May 2022 05:36:00 -0400 X-MC-Unique: lgoQHLWWMtK2dECBl6o_NQ-1 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id D85591F899; Tue, 10 May 2022 09:35:58 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A393713AA5; Tue, 10 May 2022 09:35:58 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id +MJQJv4xemIANQAAMHmgww (envelope-from ); Tue, 10 May 2022 09:35:58 +0000 From: mwilck@suse.com To: Christophe Varoqui , Benjamin Marzinski , =?utf-8?q?Martin_Li=C5=A1ka?= Date: Tue, 10 May 2022 11:35:38 +0200 Message-Id: <20220510093538.25199-2-mwilck@suse.com> In-Reply-To: <20220510093538.25199-1-mwilck@suse.com> References: <20220510093538.25199-1-mwilck@suse.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 Subject: [dm-devel] [PATCH 2/2] multipath-tools: cleanly separate CPPFLAGS and CFLAGS X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dm-devel@redhat.com, Martin Wilck Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com From: Martin Wilck Move all preprocessor-related options (-D, -I) into CPPFLAGS. This is cleaner, and has the side effect of creating a better-readable output from "make". Signed-off-by: Martin Wilck Reviewed-by: Martin Liska --- Makefile.inc | 4 ++-- kpartx/Makefile | 5 +++-- libdmmp/Makefile | 4 ++-- libdmmp/test/Makefile | 2 +- libmpathvalid/Makefile | 3 ++- libmultipath/Makefile | 19 ++++++++++--------- libmultipath/checkers/Makefile | 3 ++- libmultipath/foreign/Makefile | 3 ++- libmultipath/prioritizers/Makefile | 5 +++-- mpathpersist/Makefile | 3 ++- multipath/Makefile | 3 ++- multipathd/Makefile | 23 ++++++++++++----------- tests/Makefile | 4 ++-- 13 files changed, 45 insertions(+), 36 deletions(-) diff --git a/Makefile.inc b/Makefile.inc index 7422666..bcd2212 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -140,10 +140,10 @@ OPTFLAGS := -O2 -g $(STACKPROT) --param=ssp-buffer-size=4 WARNFLAGS := -Werror -Wall -Wextra -Wformat=2 $(WFORMATOVERFLOW) -Werror=implicit-int \ -Werror=implicit-function-declaration -Werror=format-security \ $(WNOCLOBBERED) -Werror=cast-qual $(ERROR_DISCARDED_QUALIFIERS) -CPPFLAGS := $(FORTIFY_OPT) -CFLAGS := --std=gnu99 $(CFLAGS) $(OPTFLAGS) $(WARNFLAGS) -pipe \ +CPPFLAGS := $(FORTIFY_OPT) \ -DBIN_DIR=\"$(bindir)\" -DMULTIPATH_DIR=\"$(plugindir)\" -DRUN_DIR=\"${RUN}\" \ -DCONFIG_DIR=\"$(configdir)\" -DEXTRAVERSION=\"$(EXTRAVERSION)\" -MMD -MP +CFLAGS := --std=gnu99 $(CFLAGS) $(OPTFLAGS) $(WARNFLAGS) -pipe BIN_CFLAGS = -fPIE -DPIE LIB_CFLAGS = -fPIC SHARED_FLAGS = -shared diff --git a/kpartx/Makefile b/kpartx/Makefile index e9900fb..742d3bc 100644 --- a/kpartx/Makefile +++ b/kpartx/Makefile @@ -3,13 +3,14 @@ # include ../Makefile.inc -CFLAGS += $(BIN_CFLAGS) -I. -I$(multipathdir) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 +CPPFLAGS += -I. -I$(multipathdir) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 +CFLAGS += $(BIN_CFLAGS) LDFLAGS += $(BIN_LDFLAGS) LIBDEPS += -ldevmapper ifneq ($(call check_func,dm_task_set_cookie,$(DEVMAPPER_INCDIR)/libdevmapper.h),0) - CFLAGS += -DLIBDM_API_COOKIE + CPPFLAGS += -DLIBDM_API_COOKIE endif OBJS = bsd.o dos.o kpartx.o solaris.o unixware.o dasd.o sun.o \ diff --git a/libdmmp/Makefile b/libdmmp/Makefile index 00fc852..2e99b3e 100644 --- a/libdmmp/Makefile +++ b/libdmmp/Makefile @@ -15,8 +15,8 @@ HEADERS = libdmmp/libdmmp.h OBJS = libdmmp.o libdmmp_mp.o libdmmp_pg.o libdmmp_path.o libdmmp_misc.o -CFLAGS += $(LIB_CFLAGS) -fvisibility=hidden -I$(libdmmpdir) -I$(mpathcmddir) \ - $(shell $(PKGCONFIG) --cflags json-c) +CPPFLAGS += -I$(libdmmpdir) -I$(mpathcmddir) $(shell $(PKGCONFIG) --cflags json-c) +CFLAGS += $(LIB_CFLAGS) -fvisibility=hidden LIBDEPS += $(shell $(PKGCONFIG) --libs json-c) -L$(mpathcmddir) -lmpathcmd -lpthread diff --git a/libdmmp/test/Makefile b/libdmmp/test/Makefile index 20b3945..76b24d6 100644 --- a/libdmmp/test/Makefile +++ b/libdmmp/test/Makefile @@ -9,7 +9,7 @@ _mpathcmddir=../$(mpathcmddir) TEST_EXEC = libdmmp_test SPD_TEST_EXEC = libdmmp_speed_test -CFLAGS += -I$(_libdmmpdir) +CPPFLAGS += -I$(_libdmmpdir) LDFLAGS += -L$(_libdmmpdir) -ldmmp all: $(TEST_EXEC) $(SPD_TEST_EXEC) diff --git a/libmpathvalid/Makefile b/libmpathvalid/Makefile index fefeb2a..0a51925 100644 --- a/libmpathvalid/Makefile +++ b/libmpathvalid/Makefile @@ -5,7 +5,8 @@ DEVLIB = libmpathvalid.so LIBS = $(DEVLIB).$(SONAME) VERSION_SCRIPT := libmpathvalid.version -CFLAGS += $(LIB_CFLAGS) -I$(multipathdir) -I$(mpathcmddir) +CPPFLAGS += -I$(multipathdir) -I$(mpathcmddir) +CFLAGS += $(LIB_CFLAGS) LIBDEPS += -lpthread -ldevmapper -ldl -L$(multipathdir) \ -lmultipath -L$(mpathcmddir) -lmpathcmd -ludev diff --git a/libmultipath/Makefile b/libmultipath/Makefile index 2fc3f3b..fb03200 100644 --- a/libmultipath/Makefile +++ b/libmultipath/Makefile @@ -8,12 +8,13 @@ DEVLIB = libmultipath.so LIBS = $(DEVLIB).$(SONAME) VERSION_SCRIPT := libmultipath.version -CFLAGS += $(LIB_CFLAGS) -I$(mpathcmddir) -I$(mpathpersistdir) -I$(nvmedir) +CPPFLAGS += -I$(mpathcmddir) -I$(mpathpersistdir) -I$(nvmedir) +CFLAGS += $(LIB_CFLAGS) LIBDEPS += -lpthread -ldl -ldevmapper -ludev -L$(mpathcmddir) -lmpathcmd -lurcu -laio ifdef SYSTEMD - CFLAGS += -DUSE_SYSTEMD=$(SYSTEMD) + CPPFLAGS += -DUSE_SYSTEMD=$(SYSTEMD) ifeq ($(shell test $(SYSTEMD) -gt 209 && echo 1), 1) LIBDEPS += -lsystemd else @@ -22,31 +23,31 @@ ifdef SYSTEMD endif ifneq ($(call check_func,dm_task_no_flush,$(DEVMAPPER_INCDIR)/libdevmapper.h),0) - CFLAGS += -DLIBDM_API_FLUSH -D_GNU_SOURCE + CPPFLAGS += -DLIBDM_API_FLUSH -D_GNU_SOURCE endif ifneq ($(call check_func,dm_task_get_errno,$(DEVMAPPER_INCDIR)/libdevmapper.h),0) - CFLAGS += -DLIBDM_API_GET_ERRNO + CPPFLAGS += -DLIBDM_API_GET_ERRNO endif ifneq ($(call check_func,dm_task_set_cookie,$(DEVMAPPER_INCDIR)/libdevmapper.h),0) - CFLAGS += -DLIBDM_API_COOKIE + CPPFLAGS += -DLIBDM_API_COOKIE endif ifneq ($(call check_func,udev_monitor_set_receive_buffer_size,$(LIBUDEV_INCDIR)/libudev.h),0) - CFLAGS += -DLIBUDEV_API_RECVBUF + CPPFLAGS += -DLIBUDEV_API_RECVBUF endif ifneq ($(call check_func,dm_task_deferred_remove,$(DEVMAPPER_INCDIR)/libdevmapper.h),0) - CFLAGS += -DLIBDM_API_DEFERRED + CPPFLAGS += -DLIBDM_API_DEFERRED endif ifneq ($(call check_func,dm_hold_control_dev,$(DEVMAPPER_INCDIR)/libdevmapper.h),0) - CFLAGS += -DLIBDM_API_HOLD_CONTROL + CPPFLAGS += -DLIBDM_API_HOLD_CONTROL endif ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(LINUX_HEADERS_INCDIR)/scsi/fc/fc_els.h),0) - CFLAGS += -DFPIN_EVENT_HANDLER + CPPFLAGS += -DFPIN_EVENT_HANDLER endif # object files referencing MULTIPATH_DIR or CONFIG_DIR diff --git a/libmultipath/checkers/Makefile b/libmultipath/checkers/Makefile index 8e0ed5e..8d8e45e 100644 --- a/libmultipath/checkers/Makefile +++ b/libmultipath/checkers/Makefile @@ -3,7 +3,8 @@ # include ../../Makefile.inc -CFLAGS += $(LIB_CFLAGS) -I.. +CPPFLAGS += -I.. +CFLAGS += $(LIB_CFLAGS) LDFLAGS += -L.. -lmultipath LIBDEPS = -lmultipath -laio -lpthread -lrt diff --git a/libmultipath/foreign/Makefile b/libmultipath/foreign/Makefile index f447a1c..42cea4d 100644 --- a/libmultipath/foreign/Makefile +++ b/libmultipath/foreign/Makefile @@ -4,7 +4,8 @@ TOPDIR=../.. include ../../Makefile.inc -CFLAGS += $(LIB_CFLAGS) -I.. -I$(nvmedir) +CPPFLAGS += -I.. -I$(nvmedir) +CFLAGS += $(LIB_CFLAGS) LDFLAGS += -L.. LIBDEPS = -lmultipath -ludev -lpthread -lrt diff --git a/libmultipath/prioritizers/Makefile b/libmultipath/prioritizers/Makefile index 16c6397..a5ab5e1 100644 --- a/libmultipath/prioritizers/Makefile +++ b/libmultipath/prioritizers/Makefile @@ -3,7 +3,8 @@ # include ../../Makefile.inc -CFLAGS += $(LIB_CFLAGS) -I.. +CPPFLAGS += -I.. +CFLAGS += $(LIB_CFLAGS) LDFLAGS += -L.. LIBDEPS = -lmultipath -lm -lpthread -lrt @@ -25,7 +26,7 @@ LIBS = \ ifneq ($(call check_file,$(LINUX_HEADERS_INCDIR)/linux/nvme_ioctl.h),0) LIBS += libprioana.so - CFLAGS += -I../nvme + CPPFLAGS += -I../nvme endif all: $(LIBS) diff --git a/mpathpersist/Makefile b/mpathpersist/Makefile index eb26970..2e4d483 100644 --- a/mpathpersist/Makefile +++ b/mpathpersist/Makefile @@ -1,6 +1,7 @@ include ../Makefile.inc -CFLAGS += $(BIN_CFLAGS) -I$(multipathdir) -I$(mpathpersistdir) +CPPFLAGS += -I$(multipathdir) -I$(mpathpersistdir) +CFLAGS += $(BIN_CFLAGS) LDFLAGS += $(BIN_LDFLAGS) LIBDEPS += -L$(mpathpersistdir) -lmpathpersist -L$(multipathdir) -lmultipath \ diff --git a/multipath/Makefile b/multipath/Makefile index c930499..bcb0453 100644 --- a/multipath/Makefile +++ b/multipath/Makefile @@ -3,7 +3,8 @@ # include ../Makefile.inc -CFLAGS += $(BIN_CFLAGS) -I$(multipathdir) -I$(mpathcmddir) +CPPFLAGS += -I$(multipathdir) -I$(mpathcmddir) +CFLAGS += $(BIN_CFLAGS) LDFLAGS += $(BIN_LDFLAGS) LIBDEPS += -L$(multipathdir) -lmultipath -L$(mpathcmddir) -lmpathcmd \ -lpthread -ldevmapper -ldl -ludev diff --git a/multipathd/Makefile b/multipathd/Makefile index 1449080..c937cd5 100644 --- a/multipathd/Makefile +++ b/multipathd/Makefile @@ -1,30 +1,31 @@ include ../Makefile.inc ifneq ($(call check_func,dm_task_get_errno,$(DEVMAPPER_INCDIR)/libdevmapper.h),0) - CFLAGS += -DLIBDM_API_GET_ERRNO + CPPFLAGS += -DLIBDM_API_GET_ERRNO endif ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(LINUX_HEADERS_INCDIR)/scsi/fc/fc_els.h),0) - CFLAGS += -DFPIN_EVENT_HANDLER + CPPFLAGS += -DFPIN_EVENT_HANDLER FPIN_SUPPORT = 1 endif # # debugging stuff # -#CFLAGS += -DLCKDBG -#CFLAGS += -D_DEBUG_ -#CFLAGS += -DLOGDBG -CFLAGS += $(BIN_CFLAGS) -I$(multipathdir) -I$(mpathpersistdir) \ - -I$(mpathcmddir) -I$(thirdpartydir) +#CPPFLAGS += -DLCKDBG +#CPPFLAGS += -D_DEBUG_ +#CPPFLAGS += -DLOGDBG + +CPPFLAGS += -I$(multipathdir) -I$(mpathpersistdir) -I$(mpathcmddir) -I$(thirdpartydir) \ + $(shell $(PKGCONFIG) --modversion liburcu 2>/dev/null | \ + awk -F. '{ printf("-DURCU_VERSION=0x%06x", 256 * ( 256 * $$1 + $$2) + $$3); }') +CFLAGS += $(BIN_CFLAGS) LDFLAGS += $(BIN_LDFLAGS) LIBDEPS += -L$(multipathdir) -lmultipath -L$(mpathpersistdir) -lmpathpersist \ -L$(mpathcmddir) -lmpathcmd -ludev -ldl -lurcu -lpthread \ -ldevmapper -lreadline -CFLAGS += $(shell $(PKGCONFIG) --modversion liburcu 2>/dev/null | \ - awk -F. '{ printf("-DURCU_VERSION=0x%06x", 256 * ( 256 * $$1 + $$2) + $$3); }') ifdef SYSTEMD - CFLAGS += -DUSE_SYSTEMD=$(SYSTEMD) + CPPFLAGS += -DUSE_SYSTEMD=$(SYSTEMD) ifeq ($(shell test $(SYSTEMD) -gt 209 && echo 1), 1) LIBDEPS += -lsystemd else @@ -32,7 +33,7 @@ ifdef SYSTEMD endif endif ifeq ($(ENABLE_DMEVENTS_POLL),0) - CFLAGS += -DNO_DMEVENTS_POLL + CPPFLAGS += -DNO_DMEVENTS_POLL endif OBJS = main.o pidfile.o uxlsnr.o uxclnt.o cli.o cli_handlers.o waiter.o \ diff --git a/tests/Makefile b/tests/Makefile index a069e37..d20ef23 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -11,8 +11,8 @@ TEST_MISSING_INITIALIZERS = $(shell \ || echo -Wno-missing-field-initializers) W_MISSING_INITIALIZERS := $(call TEST_MISSING_INITIALIZERS) -CFLAGS += $(BIN_CFLAGS) -I$(multipathdir) -I$(mpathcmddir) \ - -Wno-unused-parameter $(W_MISSING_INITIALIZERS) -DTESTCONFDIR=\"$(TESTDIR)/conf.d\" +CPPFLAGS += -I$(multipathdir) -I$(mpathcmddir) -DTESTCONFDIR=\"$(TESTDIR)/conf.d\" +CFLAGS += $(BIN_CFLAGS) -Wno-unused-parameter $(W_MISSING_INITIALIZERS) LIBDEPS += -L. -L$(mpathcmddir) -lmultipath -lmpathcmd -lcmocka TESTS := uevent parser util dmevents hwtable blacklist unaligned vpd pgpolicy \