Skip to contentSkip to conversation

Makefile: Use CPPFLAGS from the environment

PATCH In review Seth Forshee 2 participants 7 messages Jan 6, 2014 Kbuild

lore
Share & tools
lore
#0 lore raw

cover Makefile: Use CPPFLAGS from the environment

Hi Steve,

Here's another patch for trace-cmd that I'm using in Debian. Please consider it for your tree.

It also looks like you haven't applied the patches I sent a few months back [1][2]. I'm guessing you just forgot about them, but please let me know if there's something I need to fix. I also pushed out all of these patches if you'd prefer to do a pull:

git://kernel.ubuntu.com/sforshee/trace-cmd.git for-upstream

Thanks,
Seth

[1] http://www.spinics.net/lists/kernel/msg1625190.html
[2] http://www.spinics.net/lists/kernel/msg1629025.html

#1 lore raw

PATCH 1/1 Makefile: Use CPPFLAGS from the environment

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.

---
 Makefile | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
Makefile +9 -8
index a2ba385..f097bbc 100644
@@ -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)			\
Signature · 1 line
1.8.3.2
#2 lore raw
In reply to Seth Forshee
Quoted 9 lines · On Mon, 6 Jan 2014 11:56:24 -0600 Seth Forshee <[email protected]>…

Hi Steve,

Here's another patch for trace-cmd that I'm using in Debian. Please consider it for your tree.

It also looks like you haven't applied the patches I sent a few months back [1][2]. I'm guessing you just forgot about them, but please let me know if there's something I need to fix. I also pushed out all of these patches if you'd prefer to do a pull:

I actually applied everything, and a lot more updates that I never pushed.

Anyway, thanks! I applied this too and pushed it up.

-- Steve

#3 lore raw
Quoted 13 lines · Steven Rostedt
Quoted 9 lines · On Mon, 6 Jan 2014 11:56:24 -0600 Seth Forshee <[email protected]>…

Hi Steve,

Here's another patch for trace-cmd that I'm using in Debian. Please consider it for your tree.

It also looks like you haven't applied the patches I sent a few months back [1][2]. I'm guessing you just forgot about them, but please let me know if there's something I need to fix. I also pushed out all of these patches if you'd prefer to do a pull:

Quoted 4 lines

I actually applied everything, and a lot more updates that I never pushed.

Anyway, thanks! I applied this too and pushed it up.

Thanks!

There is something odd about the updates you pushed though. You've now got a version 2.2.1 on your trace-cmd-stable-v2.2 branch, which used to be tagged trace-cmd-v2.2.1, and another 2.2.1 on master which now has that tag. I'm guessing that's not what you intended to do?

Seth

#4 lore raw
Quoted 4 lines · On Mon, 6 Jan 2014 13:36:52 -0600 Seth Forshee <[email protected]>…

There is something odd about the updates you pushed though. You've now got a version 2.2.1 on your trace-cmd-stable-v2.2 branch, which used to be tagged trace-cmd-v2.2.1, and another 2.2.1 on master which now has that tag. I'm guessing that's not what you intended to do?

Yeah, I screwed up.

This should have been 2.3 and I screwed up the tags here :-/

I'll try to fix things up.

-- Steve

#5 lore raw
Quoted 7 lines · On Mon, 6 Jan 2014 14:54:50 -0500 Steven Rostedt <[email protected]> wrote:

Yeah, I screwed up.

This should have been 2.3 and I screwed up the tags here :-/

I'll try to fix things up.

I blame too much eggnog over the holiday break. I think I fixed things up.

Thanks!

-- Steve

#6 lore raw
Quoted 5 lines · Steven Rostedt
Quoted 3 lines · On Mon, 6 Jan 2014 14:54:50 -0500 Steven Rostedt <[email protected]> wrote:

Yeah, I screwed up.

Quoted 7 lines
Quoted 4 lines

This should have been 2.3 and I screwed up the tags here :-/

I'll try to fix things up.

I blame too much eggnog over the holiday break. I think I fixed things up.

Looks right to me now. Thanks!