diff mbox

[1/3] Makefile.inc: Allow additional CFLAGS to be specified on the command line

Message ID 20171212004503.12823-2-bart.vanassche@wdc.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show

Commit Message

Bart Van Assche Dec. 12, 2017, 12:45 a.m. UTC
Compiling the multipath-tools source code with e.g. sparse requires
to specify additional compiler flags on the command line. Modify the
Makefile such that this becomes possible.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
---
 Makefile.inc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Martin Wilck Jan. 11, 2018, 10:26 p.m. UTC | #1
Hi Bart,

On Mon, 2017-12-11 at 16:45 -0800, Bart Van Assche wrote:
> Compiling the multipath-tools source code with e.g. sparse requires
> to specify additional compiler flags on the command line. Modify the
> Makefile such that this becomes possible.
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
> ---
>  Makefile.inc | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile.inc b/Makefile.inc
> index 29c290a22e8f..d953f5ef34e6 100644
> --- a/Makefile.inc
> +++ b/Makefile.inc
> @@ -90,7 +90,8 @@ OPTFLAGS	= -O2 -g -pipe -Wall -Wextra
> -Wformat=2 -Werror=implicit-int \
>  		  -Wp,-D_FORTIFY_SOURCE=2 $(STACKPROT) \
>  		  --param=ssp-buffer-size=4
>  
> -CFLAGS		= $(OPTFLAGS) -DLIB_STRING=\"${LIB}\"
> -DRUN_DIR=\"${RUN}\"
> +CFLAGS		:= $(OPTFLAGS) -DLIB_STRING=\"${LIB}\"
> -DRUN_DIR=\"${RUN}\" \
> +		   $(CFLAGS)

I'd prefer the variable passed from user space not to be called CFLAGS
but e.g. EXTRA_CFLAGS. Otherwise, ack.

Martin

>  BIN_CFLAGS	= -fPIE -DPIE
>  LIB_CFLAGS	= -fPIC
>  SHARED_FLAGS	= -shared
diff mbox

Patch

diff --git a/Makefile.inc b/Makefile.inc
index 29c290a22e8f..d953f5ef34e6 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -90,7 +90,8 @@  OPTFLAGS	= -O2 -g -pipe -Wall -Wextra -Wformat=2 -Werror=implicit-int \
 		  -Wp,-D_FORTIFY_SOURCE=2 $(STACKPROT) \
 		  --param=ssp-buffer-size=4
 
-CFLAGS		= $(OPTFLAGS) -DLIB_STRING=\"${LIB}\" -DRUN_DIR=\"${RUN}\"
+CFLAGS		:= $(OPTFLAGS) -DLIB_STRING=\"${LIB}\" -DRUN_DIR=\"${RUN}\" \
+		   $(CFLAGS)
 BIN_CFLAGS	= -fPIE -DPIE
 LIB_CFLAGS	= -fPIC
 SHARED_FLAGS	= -shared