From 2f113b5e114ef62f2fd8d9f4445193e19cbfa690 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 15 Sep 2013 01:19:50 +0000 Subject: [PATCH] build: Combine rules for object files. Currently we have many similar recipes for compiling object files from .c files that need non-standard CPPFLAGS. All rules are identical except that different additional options to the $(CC) command are required to build the object file. These additional options are provided through various $(foo_cppflags) variables. This commit avoids this duplication by adding the necessary flags to CPPFLAGS instead. This way we can use the same rule for all object files. --- Makefile.in | 77 +++++++++++++++++------------------------------------ 1 file changed, 24 insertions(+), 53 deletions(-) diff --git a/Makefile.in b/Makefile.in index 3e62d05f..50394e9c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -182,64 +182,35 @@ $(hostbin_dir)/error2: error2.c | $(hostbin_dir) error2.h: $(hostbin_dir)/error2 @[ -z "$(Q)" ] || echo 'ER2 $<' @echo "$(object_executable_matrix)" | $< > $@ -$(object_dir)/crypt.o: crypt.c | $(object_dir) - @[ -z "$(Q)" ] || echo 'CC $<' - $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) $(openssl_cppflags) $< -$(object_dir)/spx_common.o: spx_common.c | $(object_dir) - @[ -z "$(Q)" ] || echo 'CC $<' - $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) $(speex_cppflags) $(ogg_cppflags) $< - -$(object_dir)/spxdec_filter.o: spxdec_filter.c | $(object_dir) - @[ -z "$(Q)" ] || echo 'CC $<' - $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) $(speex_cppflags) $(ogg_cppflags) $< - -$(object_dir)/spx_afh.o: spx_afh.c | $(object_dir) - @[ -z "$(Q)" ] || echo 'CC $<' - $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) $(speex_cppflags) $(ogg_cppflags) $< - -$(object_dir)/oggdec_filter.o: oggdec_filter.c | $(object_dir) - @[ -z "$(Q)" ] || echo 'CC $<' - $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) $(ogg_cppflags) $< - -$(object_dir)/ogg_afh.o: ogg_afh.c | $(object_dir) - @[ -z "$(Q)" ] || echo 'CC $<' - $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) $(ogg_cppflags) $< - -$(object_dir)/ogg_afh_common.o: ogg_afh_common.c | $(object_dir) - @[ -z "$(Q)" ] || echo 'CC $<' - $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) $(ogg_cppflags) $< - -$(object_dir)/mp3dec_filter.o: mp3dec_filter.c | $(object_dir) - @[ -z "$(Q)" ] || echo 'CC $<' - $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) $(mad_cppflags) $< - -$(object_dir)/compress_filter.o: compress_filter.c | $(object_dir) - @[ -z "$(Q)" ] || echo 'CC $<' - $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) -O3 $< - -$(object_dir)/aacdec_filter.o: aacdec_filter.c | $(object_dir) - @[ -z "$(Q)" ] || echo 'CC $<' - $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) $(faad_cppflags) $< - -$(object_dir)/aac_common.o: aac_common.c | $(object_dir) - @[ -z "$(Q)" ] || echo 'CC $<' - $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) $(faad_cppflags) $< - -$(object_dir)/aac_afh.o: aac_afh.c | $(object_dir) - @[ -z "$(Q)" ] || echo 'CC $<' - $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) $(faad_cppflags) $< +$(object_dir)/%.o: %.c | $(object_dir) $(object_dir)/opus%.o: CPPFLAGS += $(opus_cppflags) -$(object_dir)/mp3_afh.o: CPPFLAGS += $(id3tag_cppflags) +$(object_dir)/gui%.o: CPPFLAGS += $(curses_cppflags) +$(object_dir)/spx%.o: CPPFLAGS += $(speex_cppflags) +$(object_dir)/%.cmdline.o: CPPFLAGS += -Wno-unused-function -$(object_dir)/mp3_afh.o: mp3_afh.c | $(object_dir) +$(object_dir)/mp3_afh.o: CPPFLAGS += $(id3tag_cppflags) +$(object_dir)/crypt.o: CPPFLAGS += $(openssl_cppflags) +$(object_dir)/mp3dec_filter.o: CPPFLAGS += $(mad_cppflags) +$(object_dir)/compress_filter.o: CPPFLAGS += -O3 +$(object_dir)/ao_write.o: CPPFLAGS += $(ao_cppflags) + +$(object_dir)/aacdec_filter.o \ +$(object_dir)/aac_common.o \ +$(object_dir)/aac_afh.o \ +: CPPFLAGS += $(faad_cppflags) + +$(object_dir)/spx_common.o \ +$(object_dir)/spxdec_filter.o \ +$(object_dir)/spx_afh.o \ +$(object_dir)/oggdec_filter.o \ +$(object_dir)/ogg_afh.o \ +$(object_dir)/ogg_afh_common.o \ +: CPPFLAGS += $(ogg_cppflags) -$(object_dir)/gui%.o: gui%.c | $(object_dir) - @[ -z "$(Q)" ] || echo 'CC $<' - $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) $(curses_cppflags) $< -$(object_dir)/ao_write.o: ao_write.c | $(object_dir) +$(object_dir)/%.o: %.c | $(object_dir) @[ -z "$(Q)" ] || echo 'CC $<' - $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) $(ao_cppflags) $< + $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) $< $(object_dir)/%.cmdline.o: $(cmdline_dir)/%.cmdline.c $(cmdline_dir)/%.cmdline.h | $(object_dir) @[ -z "$(Q)" ] || echo 'CC $<' -- 2.39.5