From b0a89cc6e5ffff050ddecd09e9af8eb6723f9ba6 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Fri, 27 Aug 2010 09:48:18 +0100 Subject: Use nifty gcc -MD feature to automatically track .h dependencies of all C files, this finally gives proper dependencies, which means the end of getting broken binaries around headerfile changes, etc. Sure, this may not work on obscurux with superawesomeincompatiblecc while autoconf does, but at least BitlBee's configure script still runs in <1s. :-) --- .bzrignore | 1 + Makefile | 7 ++++++- configure | 8 ++++++++ lib/Makefile | 3 +++ protocols/Makefile | 3 +++ protocols/jabber/Makefile | 3 +++ protocols/msn/Makefile | 3 ++- protocols/oscar/Makefile | 3 +++ protocols/purple/Makefile | 3 +++ protocols/twitter/Makefile | 3 ++- protocols/yahoo/Makefile | 3 +++ 11 files changed, 37 insertions(+), 3 deletions(-) diff --git a/.bzrignore b/.bzrignore index 0312b204..234dca8f 100644 --- a/.bzrignore +++ b/.bzrignore @@ -19,3 +19,4 @@ tests/check coverage bitlbee.info bitlbee.exe +.depend diff --git a/Makefile b/Makefile index efbffe0a..0511ad83 100644 --- a/Makefile +++ b/Makefile @@ -51,8 +51,11 @@ clean: $(subdirs) $(MAKE) -C tests clean distclean: clean $(subdirs) + rm -rf .depend rm -f Makefile.settings config.h bitlbee.pc find . -name 'DEADJOE' -o -name '*.orig' -o -name '*.rej' -o -name '*~' -exec rm -f {} \; + @# May still be present in dirs of disabled protocols. + find . -name .depend | xargs -r rmdir $(MAKE) -C tests distclean check: all @@ -104,7 +107,7 @@ tar: fakeroot debian/rules clean || make distclean x=$$(basename $$(pwd)); \ cd ..; \ - tar czf $$x.tar.gz --exclude=debian --exclude=.bzr* $$x + tar czf $$x.tar.gz --exclude=debian --exclude=.bzr* --exclude=.depend $$x $(subdirs): @$(MAKE) -C $@ $(MAKECMDGOALS) @@ -130,3 +133,5 @@ ctags: # make is available. helloworld: @echo Hello World + +-include .depend/*.d diff --git a/configure b/configure index 9b77604c..c0d79bdd 100755 --- a/configure +++ b/configure @@ -570,6 +570,14 @@ EOF fi fi +case "$CC" in +*gcc* ) + echo CFLAGS+=-MD -MF .depend/\$@.d >> Makefile.settings + for i in . lib protocols protocols/*/; do + mkdir -p $i/.depend + done +esac + if [ "$msn" = 0 ]; then echo '#undef WITH_MSN' >> config.h else diff --git a/lib/Makefile b/lib/Makefile index bebe3ba6..0e528014 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -29,6 +29,7 @@ clean: $(subdirs) rm -f *.o $(OUTFILE) core distclean: clean $(subdirs) + rm -rf .depend ### MAIN PROGRAM @@ -41,3 +42,5 @@ $(objects): ../Makefile.settings Makefile $(objects): %.o: $(SRCDIR)%.c @echo '*' Compiling $< @$(CC) -c $(CFLAGS) $< -o $@ + +-include .depend/*.d diff --git a/protocols/Makefile b/protocols/Makefile index 1c7816bc..9e8d3fb9 100644 --- a/protocols/Makefile +++ b/protocols/Makefile @@ -39,6 +39,7 @@ clean: $(subdirs) rm -f *.o $(OUTFILE) core distclean: clean $(subdirs) + rm -rf .depend $(subdirs): @$(MAKE) -C $@ $(MAKECMDGOALS) @@ -54,3 +55,5 @@ $(objects): ../Makefile.settings Makefile $(objects): %.o: $(SRCDIR)%.c @echo '*' Compiling $< @$(CC) -c $(CFLAGS) $< -o $@ + +-include .depend/*.d diff --git a/protocols/jabber/Makefile b/protocols/jabber/Makefile index efbd81fb..32946b18 100644 --- a/protocols/jabber/Makefile +++ b/protocols/jabber/Makefile @@ -29,6 +29,7 @@ clean: rm -f *.o core distclean: clean + rm -rf .depend ### MAIN PROGRAM @@ -41,3 +42,5 @@ $(objects): %.o: $(SRCDIR)%.c jabber_mod.o: $(objects) @echo '*' Linking jabber_mod.o @$(LD) $(LFLAGS) $(objects) -o jabber_mod.o + +-include .depend/*.d diff --git a/protocols/msn/Makefile b/protocols/msn/Makefile index 781482f5..068d7e98 100644 --- a/protocols/msn/Makefile +++ b/protocols/msn/Makefile @@ -29,6 +29,7 @@ clean: rm -f *.o core distclean: clean + rm -rf .depend ### MAIN PROGRAM @@ -41,5 +42,5 @@ $(objects): %.o: $(SRCDIR)%.c msn_mod.o: $(objects) @echo '*' Linking msn_mod.o @$(LD) $(LFLAGS) $(objects) -o msn_mod.o - +-include .depend/*.d diff --git a/protocols/oscar/Makefile b/protocols/oscar/Makefile index c1a966ad..a83830df 100644 --- a/protocols/oscar/Makefile +++ b/protocols/oscar/Makefile @@ -30,6 +30,7 @@ clean: rm -f *.o core distclean: clean + rm -rf .depend ### MAIN PROGRAM @@ -42,3 +43,5 @@ $(objects): %.o: $(SRCDIR)%.c oscar_mod.o: $(objects) @echo '*' Linking oscar_mod.o @$(LD) $(LFLAGS) $(objects) -o oscar_mod.o + +-include .depend/*.d diff --git a/protocols/purple/Makefile b/protocols/purple/Makefile index 97a5bb6a..62115abf 100644 --- a/protocols/purple/Makefile +++ b/protocols/purple/Makefile @@ -30,6 +30,7 @@ clean: rm -f *.o core distclean: clean + rm -rf .depend ### MAIN PROGRAM @@ -42,3 +43,5 @@ $(objects): %.o: $(SRCDIR)%.c purple_mod.o: $(objects) @echo '*' Linking purple_mod.o $(LD) $(LFLAGS) $(objects) -o purple_mod.o + +-include .depend/*.d diff --git a/protocols/twitter/Makefile b/protocols/twitter/Makefile index 3fa9b61e..74f0ea11 100644 --- a/protocols/twitter/Makefile +++ b/protocols/twitter/Makefile @@ -29,6 +29,7 @@ clean: rm -f *.o core distclean: clean + rm -rf .depend ### MAIN PROGRAM @@ -42,4 +43,4 @@ twitter_mod.o: $(objects) @echo '*' Linking twitter_mod.o @$(LD) $(LFLAGS) $(objects) -o twitter_mod.o - +-include .depend/*.d diff --git a/protocols/yahoo/Makefile b/protocols/yahoo/Makefile index a8021ffb..7908b773 100644 --- a/protocols/yahoo/Makefile +++ b/protocols/yahoo/Makefile @@ -30,6 +30,7 @@ clean: rm -f *.o core distclean: clean + rm -rf .depend ### MAIN PROGRAM @@ -42,3 +43,5 @@ $(objects): %.o: $(SRCDIR)%.c yahoo_mod.o: $(objects) @echo '*' Linking yahoo_mod.o @$(LD) $(LFLAGS) $(objects) -o yahoo_mod.o + +-include .depend/*.d -- cgit v1.2.3