From 32d58d6a681c6800feb89500f1d3776320c58359 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Thu, 13 Jul 2017 19:43:04 +0200 Subject: [PATCH] build: Introduce DSS_CPPFLAGS. 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 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index d27b9cd..a8e045c 100644 --- 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 $< -- 2.39.5