From ddc8142e820ddf31c4f78fcebd359d1424f31390 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Thu, 13 Jul 2017 19:21:11 +0200 Subject: [PATCH] build: Combine CFLAGS and DEBUG_CFLAGS. We needed two sets of flags for gengetopt because the C code generated by gengetopt would not compile cleanly with our rather strict set of flags. With lopsub this is no longer necessary. Moreover, it is considered good practice to not set CFLAGS at all but to append the contents of this variable to the compile command. This way the user may set the variable to override some of the options. This commit gets rid of CFLAGS in favor of DSS_CFLAGS, which is just the union of the CFLAGS and the DEBUG_CFLAGS variables we had before. --- Makefile | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index c6780ef..7d3bd42 100644 --- a/Makefile +++ b/Makefile @@ -10,21 +10,19 @@ 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 -DEBUG_CFLAGS ?= -DEBUG_CFLAGS += -Wno-sign-compare -g -Wunused -Wundef -DEBUG_CFLAGS += -Wredundant-decls -CFLAGS ?= -CFLAGS += -Os -CFLAGS += -Wall -CFLAGS += -Wuninitialized -CFLAGS += -Wchar-subscripts -CFLAGS += -Wformat-security -CFLAGS += -Werror-implicit-function-declaration -CFLAGS += -Wmissing-format-attribute -CFLAGS += -Wunused-macros -CFLAGS += -Wunused-parameter -CFLAGS += -Wbad-function-cast -CFLAGS += -Wshadow +DSS_CFLAGS := -Wno-sign-compare -g -Wunused -Wundef +DSS_CFLAGS += -Wredundant-decls +DSS_CFLAGS += -Os +DSS_CFLAGS += -Wall +DSS_CFLAGS += -Wuninitialized +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) gcc -MM -MG *.c > $@ @@ -35,7 +33,7 @@ dss: $(dss_objects) $(CC) -o $@ $(dss_objects) $(LDFLAGS) -llopsub %.o: %.c Makefile - $(CC) -c -DVERSION_STRING='"$(VERSION_STRING)"' $(CFLAGS) $(DEBUG_CFLAGS) $< + $(CC) -c -DVERSION_STRING='"$(VERSION_STRING)"' $(DSS_CFLAGS) $(CFLAGS) $< %.png: %.dia dia -e $@ -t png $< -- 2.39.5