From 16e6f52a4a9bba6ea98c1c06abfb28582bab9184 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 17 Jul 2016 18:27:13 +0200 Subject: [PATCH] build: Combine $(CFLAGS) and $(STRICT_CFLAGS). We used to compile the parsers generated by gengetopt with less strict flags to avoid warnings in generated files. With lopsub this is no longer necessary, so one set of flags suffices. Moreover, we currently initialize $(STRICT_CFLAGS) to $(CFLAGS) (from the environment), then append our own flags. This is unfortunate because the user defined settings in $(CFLAGS) are overwritten. This patch changes the Makefile to only set STRICT_CFLAGS. We now pass $(STRICT_CFLAGS) $(CFLAGS) to the compiler, allowing the user to override (parts of) $(STRICT_CFLAGS) by adding -Wno-foo to CFLAGS. We use the opportunity to regroup the various options a little. --- Makefile.real | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/Makefile.real b/Makefile.real index 3192bf1e..4ef8b2be 100644 --- a/Makefile.real +++ b/Makefile.real @@ -108,21 +108,18 @@ CPPFLAGS += -I/usr/local/include CPPFLAGS += -I$(lls_suite_dir) CPPFLAGS += $(lopsub_cppflags) -CFLAGS += -Os -CFLAGS += -Wuninitialized -CFLAGS += -Wchar-subscripts -CFLAGS += -Werror-implicit-function-declaration -CFLAGS += -Wmissing-noreturn -CFLAGS += -Wbad-function-cast -CFLAGS += -fno-strict-aliasing - -STRICT_CFLAGS = $(CFLAGS) -STRICT_CFLAGS += -g -Wundef -W +STRICT_CFLAGS += -fno-strict-aliasing +STRICT_CFLAGS += -g +STRICT_CFLAGS += -Os +STRICT_CFLAGS += -Wundef -W -Wuninitialized +STRICT_CFLAGS += -Wchar-subscripts +STRICT_CFLAGS += -Werror-implicit-function-declaration +STRICT_CFLAGS += -Wmissing-noreturn +STRICT_CFLAGS += -Wbad-function-cast STRICT_CFLAGS += -Wredundant-decls STRICT_CFLAGS += -Wno-sign-compare -Wno-unknown-pragmas -STRICT_CFLAGS += -Wformat -Wformat-security -STRICT_CFLAGS += -Wmissing-format-attribute STRICT_CFLAGS += -Wdeclaration-after-statement +STRICT_CFLAGS += -Wformat -Wformat-security -Wmissing-format-attribute LDFLAGS += $(clock_gettime_ldflags) @@ -249,7 +246,7 @@ $(object_dir)/compress_filter.o: CFLAGS += -O3 $(object_dir)/%.o: %.c | $(object_dir) @[ -z "$(Q)" ] || echo 'CC $<' $(Q) $(CC) -c -o $@ -MMD -MF $(dep_dir)/$(*F).d -MT $@ $(CPPFLAGS) \ - $(STRICT_CFLAGS) $< + $(STRICT_CFLAGS) $(CFLAGS) $< # The compiler outputs dependencies either as foo.h or as some_directory/foo.h, # depending on whether the latter file exists. Since make needs the directory -- 2.30.2