From: hno <> Date: Sat, 19 Aug 2000 20:23:18 +0000 (+0000) Subject: Cleanup of make dependencies to fix the parallell build races. X-Git-Tag: SQUID_3_0_PRE1~1867 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=f71946fc9eade74e585d14b7ee5623a2d6af99f2;p=thirdparty%2Fsquid.git Cleanup of make dependencies to fix the parallell build races. Actually the problem was quite basic, and also manifested itself on the call to cf_gen. The problematic rules look like: target1 target2: some.dependency command wich makes both of target1 and target2 this is incompatible with make -j, as make assumes the command only builds one of the targets (the one available in $@). There are two ways to work around this. One is to make the command only build one of the targets (as done in fs/ and repl/), the other to chain dependencies between the two targets with some "magic" to have the first target in the chain rebuilt in case it alone gets removed.. target1: target2 @sh -c "test -f target1 || command to regenerate the targets" target2: dependency command to regenerate the targets Tested on RedHat Linux 6.2 (GNU Make) and FreeBSD 4.0. --- diff --git a/configure.in b/configure.in index 6d721db5ef..e7240d2aed 100644 --- a/configure.in +++ b/configure.in @@ -3,13 +3,13 @@ dnl Configuration input file for Squid dnl dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9) dnl -dnl $Id: configure.in,v 1.201 2000/08/10 06:26:42 wessels Exp $ +dnl $Id: configure.in,v 1.202 2000/08/19 14:23:18 hno Exp $ dnl dnl dnl AC_INIT(src/main.c) AC_CONFIG_HEADER(include/autoconf.h) -AC_REVISION($Revision: 1.201 $)dnl +AC_REVISION($Revision: 1.202 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AC_CONFIG_AUX_DIR(cfgaux) @@ -322,6 +322,8 @@ echo "Store modules built: $STORE_MODULES" AC_SUBST(STORE_MODULES) STORE_OBJS="fs/`echo $STORE_MODULES|sed -e's% %.a fs/%g'`.a" AC_SUBST(STORE_OBJS) +STORE_LIBS="`echo $STORE_OBJS|sed -e's%fs/%%g'`" +AC_SUBST(STORE_LIBS) dnl --enable-heap-replacement compability option AC_ARG_ENABLE(heap-replacement, @@ -365,6 +367,8 @@ echo "Removal policies built: $REPL_POLICIES" AC_SUBST(REPL_POLICIES) REPL_OBJS="repl/`echo $REPL_POLICIES|sed -e's% %.a repl/%g'`.a" AC_SUBST(REPL_OBJS) +REPL_LIBS="`echo $REPL_OBJS|sed -e's%repl/%%g'`" +AC_SUBST(REPL_LIBS) OPT_PINGER_EXE='' AC_ARG_ENABLE(icmp, diff --git a/src/Makefile.in b/src/Makefile.in index 41403273a5..780f5cfa09 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,7 +1,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.191 2000/07/13 06:13:42 wessels Exp $ +# $Id: Makefile.in,v 1.192 2000/08/19 14:23:19 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -197,7 +197,11 @@ LEAKFINDER_OBJS = \ DEFAULTS = \ -DDEFAULT_CONFIG_FILE=\"$(DEFAULT_CONFIG_FILE)\" -all: squid.conf store_modules repl_modules $(PROGS) $(UTILS) $(SUID_UTILS) $(CGIPROGS) +all: squid.conf $(PROGS) $(UTILS) $(SUID_UTILS) $(CGIPROGS) + @for dir in $(SUBDIRS); do \ + echo "Making $@ in $$dir..."; \ + (cd $$dir ; $(MAKE) $(MFLAGS) prefix="$(prefix)" $@) || exit 1; \ + done $(OBJS): $(top_srcdir)/include/version.h ../include/autoconf.h @@ -241,7 +245,10 @@ test_cache_digest: test_cache_digest.o CacheDigest.o debug.o globals.o store_key cache_cf.o: cf_parser.c -squid.conf cf_parser.c: cf.data cf_gen +squid.conf: cf_parser.c + @sh -c "test -f squid.conf || ./cg_gen cf.data" + +cf_parser.c: cf.data cf_gen ./cf_gen cf.data cf_gen: cf_gen.o @@ -275,10 +282,8 @@ store_modules.c: store_modules.sh Makefile store_modules.o: store_modules.c $(CC) -c store_modules.c $(CFLAGS) -I$(srcdir) -$(STORE_OBJS): fs/stamp - -store_modules fs/stamp: - @sh -c "cd fs && $(MAKE) all" +$(STORE_OBJS): + @sh -c "cd `dirname $@` && $(MAKE) $(MFLAGS) `basename $@`" repl_modules.c: repl_modules.sh Makefile sh $(srcdir)/repl_modules.sh $(REPL_POLICIES) >repl_modules.c @@ -286,7 +291,8 @@ repl_modules.c: repl_modules.sh Makefile repl_modules.o: repl_modules.c $(CC) -c repl_modules.c $(CFLAGS) -I$(srcdir) -$(REPL_OBJS): repl/stamp +$(REPL_OBJS): + @sh -c "cd `dirname $@` && $(MAKE) $(MFLAGS) `basename $@`" repl_modules repl/stamp: @sh -c "cd repl && $(MAKE) all" diff --git a/src/fs/Makefile.in b/src/fs/Makefile.in index 31e7f86ad7..eda6009c62 100644 --- a/src/fs/Makefile.in +++ b/src/fs/Makefile.in @@ -1,23 +1,24 @@ # Makefile for storage modules in the Squid Object Cache server # -# $Id: Makefile.in,v 1.1 2000/05/03 17:15:46 adrian Exp $ +# $Id: Makefile.in,v 1.2 2000/08/19 14:23:19 hno Exp $ # SUBDIRS = @STORE_MODULES@ +OUTLIBS = @STORE_LIBS@ all: @test -z "$(SUBDIRS)" || for dir in $(SUBDIRS); do \ - sh -c "cd $$dir && $(MAKE) all" || exit 1; \ + sh -c "cd $$dir && $(MAKE) $(MFLAGS) all" || exit 1; \ done; \ - if [ ! -f stamp ]; then \ - touch stamp; \ - fi + +$(OUTLIBS): + @sh -c "cd `basename $@ .a` && $(MAKE) $(MFLAGS) ../$@" clean: -rm -f *.a stamp @for dir in *; do \ if [ -f $$dir/Makefile ]; then \ - sh -c "cd $$dir && $(MAKE) $@" || exit 1;\ + sh -c "cd $$dir && $(MAKE) $(MFLAGS) $@" || exit 1;\ fi; \ done @@ -25,11 +26,11 @@ distclean: -rm -f *.a Makefile @for dir in *; do \ if [ -f $$dir/Makefile ]; then \ - sh -c "cd $$dir && $(MAKE) distclean"; \ + sh -c "cd $$dir && $(MAKE) $(MFLAGS) distclean"; \ fi; \ done .DEFAULT: @test -z "$(SUBDIRS)" || for dir in $(SUBDIRS); do \ - sh -c "cd $$dir && $(MAKE) $@" || exit 1; \ + sh -c "cd $$dir && $(MAKE) $(MFLAGS) $@" || exit 1; \ done diff --git a/src/repl/Makefile.in b/src/repl/Makefile.in index c4589edc85..0d66490381 100644 --- a/src/repl/Makefile.in +++ b/src/repl/Makefile.in @@ -1,23 +1,27 @@ # Makefile for storage modules in the Squid Object Cache server # -# $Id: Makefile.in,v 1.1 2000/06/08 18:05:39 hno Exp $ +# $Id: Makefile.in,v 1.2 2000/08/19 14:23:19 hno Exp $ # SUBDIRS = @REPL_POLICIES@ +OUTLIBS = @REPL_LIBS@ all: @test -z "$(SUBDIRS)" || for dir in $(SUBDIRS); do \ - sh -c "cd $$dir && $(MAKE) all" || exit 1; \ + sh -c "cd $$dir && $(MAKE) $(MFLAGS) all" || exit 1; \ done; \ if [ ! -f stamp ]; then \ touch stamp; \ fi +$(OUTLIBS): + @sh -c "cd `basename $@ .a` && $(MAKE) $(MFLAGS) ../$@" + clean: -rm -f *.a stamp -for dir in *; do \ if [ -f $$dir/Makefile ]; then \ - sh -c "cd $$dir && $(MAKE) $@" || exit 1;\ + sh -c "cd $$dir && $(MAKE) $(MFLAGS) $@" || exit 1;\ fi; \ done @@ -25,11 +29,11 @@ distclean: -rm -f *.a Makefile -for dir in *; do \ if [ -f $$dir/Makefile ]; then \ - sh -c "cd $$dir && $(MAKE) distclean"; \ + sh -c "cd $$dir && $(MAKE) $(MFLAGS) distclean"; \ fi; \ done .DEFAULT: @test -z "$(SUBDIRS)" || for dir in $(SUBDIRS); do \ - sh -c "cd $$dir && $(MAKE) $@" || exit 1; \ + sh -c "cd $$dir && $(MAKE) $(MFLAGS) $@" || exit 1; \ done