public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Seth Forshee <seth.forshee@canonical.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, Seth Forshee <seth.forshee@canonical.com>
Subject: [PATCH trace-cmd 1/1] Makefile: Use CPPFLAGS from the environment
Date: Mon,  6 Jan 2014 11:56:25 -0600	[thread overview]
Message-ID: <1389030985-26657-2-git-send-email-seth.forshee@canonical.com> (raw)
In-Reply-To: <1389030985-26657-1-git-send-email-seth.forshee@canonical.com>

CPPFLAGS is commonly used for preprecessor definitions which
should be used when compiling C and C++ files. In particular,
Debian uses it to pass hardening flags and expects those flags
to be used.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
---
 Makefile | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index a2ba385..f097bbc 100644
--- a/Makefile
+++ b/Makefile
@@ -220,6 +220,7 @@ include features.mk
 
 # Set compile option CFLAGS if not set elsewhere
 CFLAGS ?= -g -Wall
+CPPFLAGS ?=
 LDFLAGS ?=
 
 # Required CFLAGS
@@ -263,7 +264,7 @@ endif
 
 do_fpic_compile =					\
 	($(print_fpic_compile)				\
-	$(CC) -c $(CFLAGS) $(EXT) -fPIC $< -o $@)
+	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(EXT) -fPIC $< -o $@)
 
 do_app_build =						\
 	($(print_app_build)				\
@@ -275,7 +276,7 @@ do_compile_shared_library =			\
 
 do_compile_plugin_obj =				\
 	($(print_plugin_obj_compile)		\
-	$(CC) -c $(CFLAGS) -fPIC -o $@ $<)
+	$(CC) -c $(CPPFLAGS) $(CFLAGS) -fPIC -o $@ $<)
 
 do_plugin_build =				\
 	($(print_plugin_build)			\
@@ -291,7 +292,7 @@ define check_gui
 		$(REBUILD_GUI);							\
 	else									\
 		$(print_compile)						\
-		$(CC) -c $(CFLAGS) $(EXT) $< -o $(obj)/$@;			\
+		$(CC) -c $(CPPFLAGS) $(CFLAGS) $(EXT) $< -o $(obj)/$@;		\
 	fi;
 endef
 
@@ -449,10 +450,10 @@ define check_gui_deps
 		if [ $(BUILDGUI) -ne 1 ]; then			\
 			$(REBUILD_GUI);				\
 		else						\
-			$(CC) -M $(CFLAGS) $< > $@;		\
+			$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@;	\
 		fi						\
 	elif [ $(BUILDGUI) -eq 0 ]; then			\
-		$(CC) -M $(CFLAGS) $< > $@;			\
+		$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@;		\
 	else							\
 		echo SKIPPING $@;				\
 	fi;
@@ -569,12 +570,12 @@ PYGTK_CFLAGS = `pkg-config --cflags pygtk-2.0`
 
 ctracecmd.so: $(TCMD_LIB_OBJS) ctracecmd.i
 	swig -Wall -python -noproxy ctracecmd.i
-	$(CC) -fpic -c $(CFLAGS) $(PYTHON_INCLUDES)  ctracecmd_wrap.c
+	$(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(PYTHON_INCLUDES)  ctracecmd_wrap.c
 	$(CC) --shared $(TCMD_LIB_OBJS) $(LDFLAGS) ctracecmd_wrap.o -o ctracecmd.so
 
 ctracecmdgui.so: $(TRACE_VIEW_OBJS) $(LIB_FILE)
 	swig -Wall -python -noproxy ctracecmdgui.i
-	$(CC) -fpic -c  $(CFLAGS) $(INCLUDES) $(PYTHON_INCLUDES) $(PYGTK_CFLAGS) ctracecmdgui_wrap.c
+	$(CC) -fpic -c  $(CPPFLAGS) $(CFLAGS) $(INCLUDES) $(PYTHON_INCLUDES) $(PYGTK_CFLAGS) ctracecmdgui_wrap.c
 	$(CC) --shared $^ $(LDFLAGS) $(LIBS) $(CONFIG_LIBS) ctracecmdgui_wrap.o -o ctracecmdgui.so
 
 PHONY += python
@@ -590,7 +591,7 @@ CFLAGS_plugin_python.o += $(PYTHON_DIR_SQ)
 
 do_compile_python_plugin_obj =			\
 	($(print_plugin_obj_compile)		\
-	$(CC) -c $(CFLAGS) $(CFLAGS_$@) $(PYTHON_INCLUDES) -fPIC -o $@ $<)
+	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$@) $(PYTHON_INCLUDES) -fPIC -o $@ $<)
 
 do_python_plugin_build =			\
 	($(print_plugin_build)			\
-- 
1.8.3.2


  reply	other threads:[~2014-01-06 17:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-06 17:56 [PATCH trace-cmd 0/1] Makefile: Use CPPFLAGS from the environment Seth Forshee
2014-01-06 17:56 ` Seth Forshee [this message]
2014-01-06 19:07 ` Steven Rostedt
2014-01-06 19:36   ` Seth Forshee
2014-01-06 19:54     ` Steven Rostedt
2014-01-06 20:00       ` Steven Rostedt
2014-01-06 20:08         ` Seth Forshee

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=1389030985-26657-2-git-send-email-seth.forshee@canonical.com \
    --to=seth.forshee@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox