LinuxTV Patchwork RFC: Adding CPPFLAGS to Makefile

login
register
mail settings
Submitter Tobias Grimm
Date Feb. 23, 2013, 12:43 p.m.
Message ID <5128B969.2000902@e-tobi.net>
Download mbox | patch
Permalink /patch/16937/
State New
Headers show

Comments

Tobias Grimm - Feb. 23, 2013, 12:43 p.m.
Hello!

Klaus asked me to put this up for discussion:

At least Debian and Debian derivatives provide standard values for
CFLAGS/CXXFLAGS/LDFLAGS/CPPFLAGS/FFLAGS.

VDR's Makefile does not use CPPFLAGS (C-Pre-Processor flags) right now.
Not a big deal and easy to work-around, but for the sake of providing a
"standards-conform" Makefile I suggest adding CPPFLAGS as well.

Please see the attached patch.

It's only a suggestions and Klaus already indicated that such a change
might not make it into 2.0.0, so please don't panic, that all
plugin-Makefiles must be changed once again :-)

bye,

Tobias
Ville Skyttä - Feb. 23, 2013, 2:40 p.m.
On 2013-02-23 14:43, Tobi wrote:

> VDR's Makefile does not use CPPFLAGS (C-Pre-Processor flags) right now.
> Not a big deal and easy to work-around, but for the sake of providing a
> "standards-conform" Makefile I suggest adding CPPFLAGS as well.

+1 to the general idea.

To take it a bit further, I suppose at least DEFINES, CDEFINES,
INCLUDES, CINCLUDES could be directly put to CPPFLAGS instead of being
defined separately.
Christopher Reimer - Feb. 23, 2013, 3:28 p.m.
Am 23.02.2013 15:40, schrieb Ville Skyttä:
> On 2013-02-23 14:43, Tobi wrote:
> 
>> VDR's Makefile does not use CPPFLAGS (C-Pre-Processor flags) right 
>> now.
>> Not a big deal and easy to work-around, but for the sake of providing 
>> a
>> "standards-conform" Makefile I suggest adding CPPFLAGS as well.
> +1 to the general idea.
> To take it a bit further, I suppose at least DEFINES, CDEFINES,
> INCLUDES, CINCLUDES could be directly put to CPPFLAGS instead of being
> defined separately.
> 

+1 for Tobi's suggestion and +1 for yours.

I didn't know that there's something else than CXXFLAGS, CFLAGS and 
LDFLAGS. The Archlinux build system only provides these three.

Tobi's patch is minimally invasive (Ready for 2.0), but I'm afraid that 
your suggestion breaks something (better wait for 2.0+)
Christian Ruppert - Feb. 24, 2013, 6:54 p.m.
On 02/23/13 at 04:28PM +0100, Christopher Reimer wrote:
> Am 23.02.2013 15:40, schrieb Ville Skyttä:
> > On 2013-02-23 14:43, Tobi wrote:
> > 
> >> VDR's Makefile does not use CPPFLAGS (C-Pre-Processor flags) right 
> >> now.
> >> Not a big deal and easy to work-around, but for the sake of providing 
> >> a
> >> "standards-conform" Makefile I suggest adding CPPFLAGS as well.
> > +1 to the general idea.
> > To take it a bit further, I suppose at least DEFINES, CDEFINES,
> > INCLUDES, CINCLUDES could be directly put to CPPFLAGS instead of being
> > defined separately.
> > 
> 
> +1 for Tobi's suggestion and +1 for yours.
> 
> I didn't know that there's something else than CXXFLAGS, CFLAGS and 
> LDFLAGS. The Archlinux build system only provides these three.
> 
> Tobi's patch is minimally invasive (Ready for 2.0), but I'm afraid that 
> your suggestion breaks something (better wait for 2.0+)
> 

+1.

It should be fine as long as VDR does append to the CPPFLAGS and as long as the
"user" does not override those by using e.g. "make CPPFLAGS="..."" instead of
"CPPFLAGS="..." make ...".

Patch

Description: Add CPPFLAGS to Makefiles
Author: Tobias Grimm <tg@e-tobi.net>

Index: vdr/Makefile
===================================================================
--- vdr.orig/Makefile	2013-02-23 08:23:41.000000000 +0100
+++ vdr/Makefile	2013-02-23 08:27:58.000000000 +0100
@@ -114,14 +114,14 @@ 
 # Implicit rules:
 
 %.o: %.c
-	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
+	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
 
 # Dependencies:
 
 MAKEDEP = $(CXX) -MM -MG
 DEPFILE = .dependencies
 $(DEPFILE): Makefile
-	@$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
+	@$(MAKEDEP) $(CPPFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
 
 -include $(DEPFILE)
 
@@ -133,7 +133,7 @@ 
 # The libsi library:
 
 $(SILIB):
-	$(MAKE) --no-print-directory -C $(LSIDIR) CXXFLAGS="$(CXXFLAGS)" DEFINES="$(CDEFINES)" all
+	$(MAKE) --no-print-directory -C $(LSIDIR) CPPFLAGS="$(CPPFLAGS)" CXXFLAGS="$(CXXFLAGS)" DEFINES="$(CDEFINES)" all
 
 # pkg-config file:
 
@@ -213,7 +213,7 @@ 
 	    if ! grep -q "PKGCFG" "$(PLUGINDIR)/src/$$i/Makefile" ; then\
 	       echo "WARNING: plugin $$i is using an old Makefile!";\
 	       oldmakefile="$$oldmakefile $$i";\
-	       $(MAKE) --no-print-directory -C "$(PLUGINDIR)/src/$$i" CFLAGS="$(CFLAGS) $(CDEFINES) $(CINCLUDES)" CXXFLAGS="$(CXXFLAGS) $(CDEFINES) $(CINCLUDES)" LIBDIR="$(PLUGINDIR)/lib" VDRDIR="$(CWD)" all || failed="$$failed $$i";\
+	       $(MAKE) --no-print-directory -C "$(PLUGINDIR)/src/$$i" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS) $(CDEFINES) $(CINCLUDES)" CXXFLAGS="$(CXXFLAGS) $(CDEFINES) $(CINCLUDES)" LIBDIR="$(PLUGINDIR)/lib" VDRDIR="$(CWD)" all || failed="$$failed $$i";\
 	       continue;\
 	       fi;\
 	    # New Makefile\
Index: vdr/PLUGINS/src/dvbhddevice/Makefile
===================================================================
--- vdr.orig/PLUGINS/src/dvbhddevice/Makefile	2013-02-23 08:23:41.000000000 +0100
+++ vdr/PLUGINS/src/dvbhddevice/Makefile	2013-02-23 08:27:58.000000000 +0100
@@ -62,14 +62,14 @@ 
 ### Implicit rules:
 
 %.o: %.c
-	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
+	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
 
 ### Dependencies:
 
 MAKEDEP = $(CXX) -MM -MG
 DEPFILE = .dependencies
 $(DEPFILE): Makefile
-	@$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
+	@$(MAKEDEP) $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
 
 -include $(DEPFILE)
 
Index: vdr/PLUGINS/src/dvbhddevice/libhdffcmd/Makefile
===================================================================
--- vdr.orig/PLUGINS/src/dvbhddevice/libhdffcmd/Makefile	2013-02-23 08:23:41.000000000 +0100
+++ vdr/PLUGINS/src/dvbhddevice/libhdffcmd/Makefile	2013-02-23 08:27:58.000000000 +0100
@@ -27,14 +27,14 @@ 
 ### Implicit rules:
 
 %.o: %.c
-	$(CC) $(CFLAGS) -c $(DEFINES) $(INCLUDES) $<
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c $(DEFINES) $(INCLUDES) $<
 
 ### Dependencies:
 
 MAKEDEP = $(CC) -MM -MG
 DEPFILE = .dependencies
 $(DEPFILE): Makefile
-	@$(MAKEDEP) $(DEFINES) $(INCLUDES) $(LIB_OBJS:%.o=%.c) > $@
+	@$(MAKEDEP) $(CPPFLAGS) $(DEFINES) $(INCLUDES) $(LIB_OBJS:%.o=%.c) > $@
 
 -include $(DEPFILE)
 
Index: vdr/PLUGINS/src/dvbsddevice/Makefile
===================================================================
--- vdr.orig/PLUGINS/src/dvbsddevice/Makefile	2013-02-23 08:23:41.000000000 +0100
+++ vdr/PLUGINS/src/dvbsddevice/Makefile	2013-02-23 08:27:58.000000000 +0100
@@ -61,14 +61,14 @@ 
 ### Implicit rules:
 
 %.o: %.c
-	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
+	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
 
 ### Dependencies:
 
 MAKEDEP = $(CXX) -MM -MG
 DEPFILE = .dependencies
 $(DEPFILE): Makefile
-	@$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
+	@$(MAKEDEP) $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
 
 -include $(DEPFILE)
 
Index: vdr/PLUGINS/src/epgtableid0/Makefile
===================================================================
--- vdr.orig/PLUGINS/src/epgtableid0/Makefile	2013-02-23 08:23:41.000000000 +0100
+++ vdr/PLUGINS/src/epgtableid0/Makefile	2013-02-23 08:27:58.000000000 +0100
@@ -61,14 +61,14 @@ 
 ### Implicit rules:
 
 %.o: %.c
-	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
+	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
 
 ### Dependencies:
 
 MAKEDEP = $(CXX) -MM -MG
 DEPFILE = .dependencies
 $(DEPFILE): Makefile
-	@$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
+	@$(MAKEDEP) $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
 
 -include $(DEPFILE)
 
Index: vdr/PLUGINS/src/hello/Makefile
===================================================================
--- vdr.orig/PLUGINS/src/hello/Makefile	2013-02-23 08:23:41.000000000 +0100
+++ vdr/PLUGINS/src/hello/Makefile	2013-02-23 08:27:58.000000000 +0100
@@ -62,14 +62,14 @@ 
 ### Implicit rules:
 
 %.o: %.c
-	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
+	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
 
 ### Dependencies:
 
 MAKEDEP = $(CXX) -MM -MG
 DEPFILE = .dependencies
 $(DEPFILE): Makefile
-	@$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
+	@$(MAKEDEP) $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
 
 -include $(DEPFILE)
 
Index: vdr/PLUGINS/src/osddemo/Makefile
===================================================================
--- vdr.orig/PLUGINS/src/osddemo/Makefile	2013-02-23 08:23:41.000000000 +0100
+++ vdr/PLUGINS/src/osddemo/Makefile	2013-02-23 08:27:58.000000000 +0100
@@ -61,14 +61,14 @@ 
 ### Implicit rules:
 
 %.o: %.c
-	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
+	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
 
 ### Dependencies:
 
 MAKEDEP = $(CXX) -MM -MG
 DEPFILE = .dependencies
 $(DEPFILE): Makefile
-	@$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
+	@$(MAKEDEP) $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
 
 -include $(DEPFILE)
 
Index: vdr/PLUGINS/src/pictures/Makefile
===================================================================
--- vdr.orig/PLUGINS/src/pictures/Makefile	2013-02-23 08:23:41.000000000 +0100
+++ vdr/PLUGINS/src/pictures/Makefile	2013-02-23 08:27:58.000000000 +0100
@@ -62,14 +62,14 @@ 
 ### Implicit rules:
 
 %.o: %.c
-	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
+	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
 
 ### Dependencies:
 
 MAKEDEP = $(CXX) -MM -MG
 DEPFILE = .dependencies
 $(DEPFILE): Makefile
-	@$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
+	@$(MAKEDEP) $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
 
 -include $(DEPFILE)
 
Index: vdr/PLUGINS/src/rcu/Makefile
===================================================================
--- vdr.orig/PLUGINS/src/rcu/Makefile	2013-02-23 08:23:41.000000000 +0100
+++ vdr/PLUGINS/src/rcu/Makefile	2013-02-23 08:27:58.000000000 +0100
@@ -61,14 +61,14 @@ 
 ### Implicit rules:
 
 %.o: %.c
-	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
+	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
 
 ### Dependencies:
 
 MAKEDEP = $(CXX) -MM -MG
 DEPFILE = .dependencies
 $(DEPFILE): Makefile
-	@$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
+	@$(MAKEDEP) $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
 
 -include $(DEPFILE)
 
Index: vdr/PLUGINS/src/servicedemo/Makefile
===================================================================
--- vdr.orig/PLUGINS/src/servicedemo/Makefile	2013-02-23 08:23:41.000000000 +0100
+++ vdr/PLUGINS/src/servicedemo/Makefile	2013-02-23 08:27:58.000000000 +0100
@@ -58,14 +58,14 @@ 
 ### Implicit rules:
 
 %.o: %.c
-	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
+	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
 
 ### Dependencies:
 
 MAKEDEP = $(CXX) -MM -MG
 DEPFILE = .dependencies
 $(DEPFILE): Makefile
-	@$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
+	@$(MAKEDEP) $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
 
 -include $(DEPFILE)
 
Index: vdr/PLUGINS/src/skincurses/Makefile
===================================================================
--- vdr.orig/PLUGINS/src/skincurses/Makefile	2013-02-23 08:23:41.000000000 +0100
+++ vdr/PLUGINS/src/skincurses/Makefile	2013-02-23 08:27:58.000000000 +0100
@@ -62,14 +62,14 @@ 
 ### Implicit rules:
 
 %.o: %.c
-	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
+	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
 
 ### Dependencies:
 
 MAKEDEP = $(CXX) -MM -MG
 DEPFILE = .dependencies
 $(DEPFILE): Makefile
-	@$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
+	@$(MAKEDEP) $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
 
 -include $(DEPFILE)
 
Index: vdr/PLUGINS/src/status/Makefile
===================================================================
--- vdr.orig/PLUGINS/src/status/Makefile	2013-02-23 08:23:41.000000000 +0100
+++ vdr/PLUGINS/src/status/Makefile	2013-02-23 08:27:58.000000000 +0100
@@ -61,14 +61,14 @@ 
 ### Implicit rules:
 
 %.o: %.c
-	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
+	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
 
 ### Dependencies:
 
 MAKEDEP = $(CXX) -MM -MG
 DEPFILE = .dependencies
 $(DEPFILE): Makefile
-	@$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
+	@$(MAKEDEP) $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
 
 -include $(DEPFILE)
 
Index: vdr/PLUGINS/src/svdrpdemo/Makefile
===================================================================
--- vdr.orig/PLUGINS/src/svdrpdemo/Makefile	2013-02-23 08:23:41.000000000 +0100
+++ vdr/PLUGINS/src/svdrpdemo/Makefile	2013-02-23 08:27:58.000000000 +0100
@@ -61,14 +61,14 @@ 
 ### Implicit rules:
 
 %.o: %.c
-	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
+	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
 
 ### Dependencies:
 
 MAKEDEP = $(CXX) -MM -MG
 DEPFILE = .dependencies
 $(DEPFILE): Makefile
-	@$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
+	@$(MAKEDEP) $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
 
 -include $(DEPFILE)
 
Index: vdr/libsi/Makefile
===================================================================
--- vdr.orig/libsi/Makefile	2013-02-23 08:23:41.000000000 +0100
+++ vdr/libsi/Makefile	2013-02-23 08:27:58.000000000 +0100
@@ -18,14 +18,14 @@ 
 ### Implicit rules:
 
 %.o: %.c
-	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<
+	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<
 
 ### Dependencies:
 
 MAKEDEP = $(CXX) -MM -MG
 DEPFILE = .dependencies
 $(DEPFILE): Makefile
-	@$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
+	@$(MAKEDEP) $(CPPFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
 
 -include $(DEPFILE)
 
Index: vdr/newplugin
===================================================================
--- vdr.orig/newplugin	2013-02-23 08:27:55.000000000 +0100
+++ vdr/newplugin	2013-02-23 08:31:21.000000000 +0100
@@ -121,14 +121,14 @@ 
 ### Implicit rules:
 
 %.o: %.c
-	\$(CXX) \$(CXXFLAGS) -c \$(DEFINES) \$(INCLUDES) -o \$\@ \$<
+	\$(CXX) \$(CPPFLAGS) \$(CXXFLAGS) -c \$(DEFINES) \$(INCLUDES) -o \$\@ \$<
 
 ### Dependencies:
 
 MAKEDEP = \$(CXX) -MM -MG
 DEPFILE = .dependencies
 \$(DEPFILE): Makefile
-	\@\$(MAKEDEP) \$(CXXFLAGS) \$(DEFINES) \$(INCLUDES) \$(OBJS:%.o=%.c) > \$\@
+	\@\$(MAKEDEP) \$(CPPFLAGS) \$(CXXFLAGS) \$(DEFINES) \$(INCLUDES) \$(OBJS:%.o=%.c) > \$\@
 
 -include \$(DEPFILE)
 

Privacy Policy