All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Martin Liška" <mliska@suse.cz>
To: mwilck@suse.com,
	Christophe Varoqui <christophe.varoqui@opensvc.com>,
	Benjamin Marzinski <bmarzins@redhat.com>
Cc: dm-devel@redhat.com
Subject: Re: [dm-devel] [PATCH 1/2] multipath-tools: move CPPFLAGS before CFLAGS
Date: Tue, 10 May 2022 12:31:20 +0200	[thread overview]
Message-ID: <18ae082e-e37b-973d-2ed9-2656699faa5d@suse.cz> (raw)
In-Reply-To: <20220510093538.25199-1-mwilck@suse.com>

On 5/10/22 11:35, mwilck@suse.com wrote:
> From: Martin Wilck <mwilck@suse.com>
> 
> 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 <mwilck@suse.com>

Reviewed-by: Martin Liska <mliska@suse.cz>

> ---
>  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

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


      parent reply	other threads:[~2022-05-11  8:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10  9:35 [dm-devel] [PATCH 1/2] multipath-tools: move CPPFLAGS before CFLAGS mwilck
2022-05-10  9:35 ` [dm-devel] [PATCH 2/2] multipath-tools: cleanly separate CPPFLAGS and CFLAGS mwilck
2022-05-10 10:31   ` Martin Liška
2022-05-10 10:31 ` Martin Liška [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18ae082e-e37b-973d-2ed9-2656699faa5d@suse.cz \
    --to=mliska@suse.cz \
    --cc=bmarzins@redhat.com \
    --cc=christophe.varoqui@opensvc.com \
    --cc=dm-devel@redhat.com \
    --cc=mwilck@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.