]> git.tuebingen.mpg.de Git - dss.git/commitdiff
build: Introduce DSS_CPPFLAGS.
authorAndre Noll <maan@tuebingen.mpg.de>
Thu, 13 Jul 2017 17:43:04 +0000 (19:43 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Thu, 13 Jul 2017 20:54:03 +0000 (22:54 +0200)
As with CFLAGS, it is good practice to leave CPPFLAGS unset in the
Makefile and append it to the cc command after our own flags, to give
the user a chance to override our settings.

This patch initializes DSS_CPPFLAGS with the VERSION_STRING define
which was part of the receipe and adds -Wunused macros, which is a
preprocessor flag rather than a compiler flag.

DSS_CPPFLAGS and CPPFLAGS are added to the two relevant commands,
in addition to the existing DSS_CFLAGS and CFLAGS.

Makefile

index d27b9cd3bb686d05269d8024c19743970538aabd..a8e045c2e755673d1aa28062684c2096db4ef818 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -10,6 +10,9 @@ dss_objects := dss.o str.o file.o exec.o sig.o daemon.o df.o tv.o snap.o ipc.o d
 all: dss dss.1
 man: dss.1
 
+DSS_CPPFLAGS := -DVERSION_STRING='"$(VERSION_STRING)"'
+DSS_CPPFLAGS += -Wunused-macros
+
 DSS_CFLAGS := -Wno-sign-compare -g -Wunused -Wundef
 DSS_CFLAGS += -Wredundant-decls
 DSS_CFLAGS += -Os
@@ -19,13 +22,12 @@ DSS_CFLAGS += -Wchar-subscripts
 DSS_CFLAGS += -Wformat-security
 DSS_CFLAGS += -Werror-implicit-function-declaration
 DSS_CFLAGS += -Wmissing-format-attribute
-DSS_CFLAGS += -Wunused-macros
 DSS_CFLAGS += -Wunused-parameter
 DSS_CFLAGS += -Wbad-function-cast
 DSS_CFLAGS += -Wshadow
 
 Makefile.deps: $(wildcard *.c *.h)
-       $(CC) -MM -MG $(DSS_CFLAGS) $(CFLAGS) *.c > $@
+       $(CC) -MM -MG $(DSS_CPPFLAGS) $(CPPFLAGS) $(DSS_CFLAGS) $(CFLAGS) *.c > $@
 
 -include Makefile.deps
 
@@ -33,7 +35,7 @@ dss: $(dss_objects)
        $(CC) -o $@ $(dss_objects) $(LDFLAGS) -llopsub
 
 %.o: %.c Makefile
-       $(CC) -c -DVERSION_STRING='"$(VERSION_STRING)"' $(DSS_CFLAGS) $(CFLAGS) $<
+       $(CC) -c $(DSS_CPPFLAGS) $(CPPFLAGS) $(DSS_CFLAGS) $(CFLAGS) $<
 
 %.png: %.dia
        dia -e $@ -t png $<