From 86ff7a6334cc86ed8ed457b964dd58b25b75b89b Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Wed, 30 Sep 2009 21:27:43 +0200 Subject: [PATCH] Use separate directory for objects. --- Makefile.in | 96 +++++++++++++++++++++++++++++----------------------- configure.ac | 2 +- ggo/makefile | 14 ++++---- 3 files changed, 61 insertions(+), 51 deletions(-) diff --git a/Makefile.in b/Makefile.in index ddf3be44..9556cff2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -67,6 +67,7 @@ man_pages := $(patsubst %, man/man1/%.1, $(man_binaries)) man_pages_in := $(patsubst %, web/%.man.in.html, $(man_binaries)) ggo_dir := ggo +object_dir := objects m4_ggos := afh audioc audiod client filter gui recv server write all_ggos := $(m4_ggos) dccp_recv oggdec_filter alsa_write oss_write fade http_recv \ @@ -83,13 +84,11 @@ tarball_delete := $(addprefix $(tarball_pfx)/,\ $(ggo_dir) skencil) tarball := @PACKAGE_TARNAME@-$(PACKAGE_VERSION).tar.bz2 -.PHONY: clean distclean maintainer-clean install man tarball +.PHONY: all clean distclean maintainer-clean install man tarball all: $(BINARIES) $(man_pages) man: $(man_pages) tarball: $(tarball) -*.o: para.h config.h gcc-compat.h - Makefile.deps: $(wildcard *.c *.h) $(cmdline_generated) gcc -MM -MG -I$(cmdline_dir) @faad_cppflags@ @mad_cppflags@ @oggvorbis_cppflags@ *.c > $@ -include Makefile.deps @@ -125,68 +124,81 @@ man/html/%.html: man/man1/%.1 web/%.man.in.html: man/man1/%.1 man2html $< | sed -e '/^<\/BODY>/,$$d' -e '1,/<\/HEAD>/d' > $@ +$(object_dir): + mkdir -p $@ + +$(object_dir)/oggdec_filter.o: oggdec_filter.c | $(object_dir) + $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $< -oggdec_filter.o: oggdec_filter.c - $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $< -ogg_afh.o: ogg_afh.c - $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $< +$(object_dir)/ogg_afh.o: ogg_afh.c | $(object_dir) + $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $< -mp3dec_filter.o: mp3dec_filter.c - $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @mad_cppflags@ $< +$(object_dir)/mp3dec_filter.o: mp3dec_filter.c | $(object_dir) + $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @mad_cppflags@ $< -aacdec_filter.o: aacdec_filter.c - $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $< +$(object_dir)/aacdec_filter.o: aacdec_filter.c | $(object_dir) + $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $< -aac_common.o: aac_common.c - $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $< +$(object_dir)/aac_common.o: aac_common.c | $(object_dir) + $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $< -aac_afh.o: aac_afh.c - $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $< +$(object_dir)/aac_afh.o: aac_afh.c | $(object_dir) + $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $< -$(cmdline_dir)/%.cmdline.o: $(cmdline_dir)/%.cmdline.c - @mkdir -p $(cmdline_dir) +$(object_dir)/%.cmdline.o: $(cmdline_dir)/%.cmdline.c | $(object_dir) $(CC) -c $(CPPFLAGS) -o $@ $< -%.o: %.c - $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) $< +$(object_dir)/%.o: %.c | $(object_dir) + $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) $< + +recv_objs := $(addprefix $(object_dir)/, @recv_objs@) +filter_objs := $(addprefix $(object_dir)/, @filter_objs@) +client_objs := $(addprefix $(object_dir)/, @client_objs@) +gui_objs := $(addprefix $(object_dir)/, @gui_objs@) +audiod_objs := $(addprefix $(object_dir)/, @audiod_objs@) +audioc_objs := $(addprefix $(object_dir)/, @audioc_objs@) +fade_objs := $(addprefix $(object_dir)/, @fade_objs@) +server_objs := $(addprefix $(object_dir)/, @server_objs@) +write_objs := $(addprefix $(object_dir)/, @write_objs@) +afh_objs := $(addprefix $(object_dir)/, @afh_objs@) -para_recv: @recv_objs@ - $(CC) $(LDFLAGS) @recv_objs@ -o $@ @recv_ldflags@ +para_recv: $(recv_objs) + $(CC) $(LDFLAGS) $(recv_objs) -o $@ @recv_ldflags@ -para_filter: @filter_objs@ - $(CC) $(LDFLAGS) @filter_objs@ -o $@ @filter_ldflags@ +para_filter: $(filter_objs) + $(CC) $(LDFLAGS) $(filter_objs) -o $@ @filter_ldflags@ -para_client: @client_objs@ - $(CC) $(LDFLAGS) -o $@ @client_objs@ @client_ldflags@ +para_client: $(client_objs) + $(CC) $(LDFLAGS) -o $@ $(client_objs) @client_ldflags@ -para_gui: @gui_objs@ - $(CC) $(LDFLAGS) -o $@ @gui_objs@ -lncurses +para_gui: $(gui_objs) + $(CC) $(LDFLAGS) -o $@ $(gui_objs) -lncurses -para_audiod: @audiod_objs@ audiod_command_list.c audiod_command_list.h - $(CC) $(LDFLAGS) -o $@ @audiod_objs@ @audiod_ldflags@ +para_audiod: audiod_command_list.c audiod_command_list.h $(audiod_objs) + $(CC) $(LDFLAGS) -o $@ $(audiod_objs) @audiod_ldflags@ -para_audioc: @audioc_objs@ - $(CC) $(LDFLAGS) -o $@ @audioc_objs@ @audioc_ldflags@ +para_audioc: $(audioc_objs) + $(CC) $(LDFLAGS) -o $@ $(audioc_objs) @audioc_ldflags@ -para_fade: @fade_objs@ - $(CC) $(LDFLAGS) -o $@ @fade_objs@ @fade_ldflags@ +para_fade: $(fade_objs) + $(CC) $(LDFLAGS) -o $@ $(fade_objs) @fade_ldflags@ -para_server: @server_objs@ $(server_command_lists_ch) - $(CC) $(LDFLAGS) -o $@ @server_objs@ @server_ldflags@ +para_server: $(server_command_lists_ch) $(server_objs) + $(CC) $(LDFLAGS) -o $@ $(server_objs) @server_ldflags@ -para_write: @write_objs@ - $(CC) $(LDFLAGS) -o $@ @write_objs@ @write_ldflags@ +para_write: $(write_objs) + $(CC) $(LDFLAGS) -o $@ $(write_objs) @write_ldflags@ -para_afh: @afh_objs@ - $(CC) $(LDFLAGS) -o $@ @afh_objs@ @afh_ldflags@ +para_afh: $(afh_objs) + $(CC) $(LDFLAGS) -o $@ $(afh_objs) @afh_ldflags@ clean: - rm -f *.o $(BINARIES) + rm -f $(BINARIES) rm -f *_command_list.* - rm -rf man + rm -rf man $(object_dir) distclean: clean rm -f Makefile autoscan.log config.status config.log && \ - rm -rf web/sync/* autom4te.cache aclocal.m4 + rm -rf cmdline autom4te.cache aclocal.m4 rm -f GPATH GRTAGS GSYMS GTAGS maintainer-clean: distclean diff --git a/configure.ac b/configure.ac index 4cb283d2..1707f823 100644 --- a/configure.ac +++ b/configure.ac @@ -80,7 +80,7 @@ AC_CHECK_FUNCS([atexit dup2 memchr memmove memset \ cmdline_dir="cmdline" AC_SUBST(cmdline_dir) -AC_DEFUN([add_cmdline],[$(for i in $@; do printf "${cmdline_dir}/${i}.cmdline "; done)]) +AC_DEFUN([add_cmdline],[$(for i in $@; do printf "${i}.cmdline "; done)]) all_errlist_objs="server mp3_afh afh_common vss command net string signal time diff --git a/ggo/makefile b/ggo/makefile index c3cae89f..4d40edda 100644 --- a/ggo/makefile +++ b/ggo/makefile @@ -1,7 +1,8 @@ module_ggo_opts := --set-version="($(PACKAGE_STRING), $(codename))" +$(cmdline_dir): + mkdir -p $(cmdline_dir) -$(cmdline_dir)/%_recv.cmdline.h $(cmdline_dir)/%_recv.cmdline.c: $(ggo_dir)/%_recv.ggo - @mkdir -p $(cmdline_dir) +$(cmdline_dir)/%_recv.cmdline.h $(cmdline_dir)/%_recv.cmdline.c: $(ggo_dir)/%_recv.ggo | $(cmdline_dir) gengetopt $(module_ggo_opts) \ --output-dir=$(cmdline_dir) \ --set-package=$(subst .ggo,,$(