From 48feadc148bd5b7e08fda31e7a3e69c19121b4f9 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 19 Apr 2014 23:38:04 +0000 Subject: [PATCH] build: Separate CPPFLAGS and CFLAGS. The CPPFLAGS variable should consist of preprocessor options only and should not contain any compiler options. Clearly this is not the case at the moment. This commit cleans up the mess and separates the per target CFLAGS settings from the CPPFLAGS settings. --- Makefile.real | 57 +++++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/Makefile.real b/Makefile.real index 608e8990..2b245dae 100644 --- a/Makefile.real +++ b/Makefile.real @@ -80,36 +80,39 @@ $(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,\ $(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,\ $(subst z,Z,$1)))))))))))))))))))))))))) -STRICT_CFLAGS += -g -Wunused -Wundef -W -STRICT_CFLAGS += -Wredundant-decls -STRICT_CFLAGS += -Wall -Wno-sign-compare -Wno-unknown-pragmas -STRICT_CFLAGS += -Wformat-security -STRICT_CFLAGS += -Wmissing-format-attribute - -ifeq ($(uname_s),Linux) - CPPFLAGS += -fdata-sections -ffunction-sections - LDFLAGS += -Wl,--gc-sections - CPPFLAGS += -Wstrict-prototypes - CPPFLAGS += -Wshadow - # causes warnings on *BSD for the feature test macros - CPPFLAGS += -Wunused-macros -endif -CPPFLAGS += -Os -CPPFLAGS += -Wuninitialized -CPPFLAGS += -Wchar-subscripts CPPFLAGS += -DBINDIR='"$(BINDIR)"' CPPFLAGS += -DBUILD_DATE='"$(build_date)"' CPPFLAGS += -DUNAME_RS='"$(uname_rs)"' CPPFLAGS += -DCC_VERSION='"$(cc_version)"' -CPPFLAGS += -Werror-implicit-function-declaration -CPPFLAGS += -Wmissing-noreturn -CPPFLAGS += -Wbad-function-cast -CPPFLAGS += -fno-strict-aliasing CPPFLAGS += -DMAIN_INPUT_FILE_IS_$(*F) CPPFLAGS += $(arch_cppflags) CPPFLAGS += -I/usr/local/include CPPFLAGS += -I$(cmdline_dir) +CFLAGS += -Os +CFLAGS += -Wuninitialized +CFLAGS += -Wchar-subscripts +CFLAGS += -Werror-implicit-function-declaration +CFLAGS += -Wmissing-noreturn +CFLAGS += -Wbad-function-cast +CFLAGS += -fno-strict-aliasing + +ifeq ($(uname_s),Linux) + CFLAGS += -fdata-sections -ffunction-sections + CFLAGS += -Wstrict-prototypes + CFLAGS += -Wshadow + # causes warnings on *BSD for the feature test macros + CFLAGS += -Wunused-macros + LDFLAGS += -Wl,--gc-sections +endif + +STRICT_CFLAGS = $(CFLAGS) +STRICT_CFLAGS += -g -Wunused -Wundef -W +STRICT_CFLAGS += -Wredundant-decls +STRICT_CFLAGS += -Wall -Wno-sign-compare -Wno-unknown-pragmas +STRICT_CFLAGS += -Wformat-security +STRICT_CFLAGS += -Wmissing-format-attribute + LDFLAGS += $(clock_gettime_ldflags) # To put more focus on warnings, be less verbose as default @@ -169,21 +172,18 @@ error2.h: $(hostbin_dir)/error2 Makefile @echo "$(object_executable_matrix)" | $< > $@ $(object_dir)/%.o: %.c | $(object_dir) + $(object_dir)/opus%.o $(dep_dir)/opus%.d: CPPFLAGS += $(opus_cppflags) $(object_dir)/gui%.o $(dep_dir)/gui%.d: CPPFLAGS += $(curses_cppflags) $(object_dir)/spx%.o $(dep_dir)/spx%.d: CPPFLAGS += $(speex_cppflags) -$(object_dir)/%.cmdline.o: CPPFLAGS += -Wno-unused-function - $(object_dir)/mp3_afh.o $(dep_dir)/mp3_afh.d: CPPFLAGS += $(id3tag_cppflags) $(object_dir)/crypt.o $(dep_dir)/crypt.d: CPPFLAGS += $(openssl_cppflags) $(object_dir)/gcrypt.o $(dep_dir)/gcrypt.d: CPPFLAGS += $(gcrypt_cppflags) +$(object_dir)/ao_write.o $(dep_dir)/ao_write.d: CPPFLAGS += $(ao_cppflags) $(object_dir)/mp3dec_filter.o $(dep_dir)/mp3dec_filter.d \ : CPPFLAGS += $(mad_cppflags) -$(object_dir)/compress_filter.o: CPPFLAGS += -O3 -$(object_dir)/ao_write.o $(dep_dir)/ao_write.d: CPPFLAGS += $(ao_cppflags) - $(object_dir)/aacdec_filter.o $(dep_dir)/aacdec_filter.d \ $(object_dir)/aac_common.o $(dep_dir)/aac_common.d \ $(object_dir)/aac_afh.o $(dep_dir)/aac_afh.d \ @@ -219,13 +219,16 @@ $(object_dir)/send_common.o $(dep_dir)/send_common.d \ $(object_dir)/mm.o $(dep_dir)/mm.d \ : CPPFLAGS += $(osl_cppflags) +$(object_dir)/%.cmdline.o: CFLAGS += -Wno-unused-function +$(object_dir)/compress_filter.o: CFLAGS += -O3 + $(object_dir)/%.o: %.c | $(object_dir) @[ -z "$(Q)" ] || echo 'CC $<' $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(STRICT_CFLAGS) $< $(object_dir)/%.cmdline.o: $(cmdline_dir)/%.cmdline.c $(cmdline_dir)/%.cmdline.h | $(object_dir) @[ -z "$(Q)" ] || echo 'CC $<' - $(Q) $(CC) -c -o $@ $(CPPFLAGS) $< + $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $< $(dep_dir)/%.cmdline.d: $(cmdline_dir)/%.cmdline.c error2.h | $(dep_dir) @[ -z "$(Q)" ] || echo 'DEP $<' -- 2.39.2