]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanup of make dependencies to fix the parallell build races.
authorhno <>
Sat, 19 Aug 2000 20:23:18 +0000 (20:23 +0000)
committerhno <>
Sat, 19 Aug 2000 20:23:18 +0000 (20:23 +0000)
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.

configure.in
src/Makefile.in
src/fs/Makefile.in
src/repl/Makefile.in

index 6d721db5efbcecd49174e5e819194d6020ea889a..e7240d2aedf07a212793c0d3e96ced11d82ef516 100644 (file)
@@ -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,
index 41403273a55d53462fb602cdc9e0597cd5510440..780f5cfa097df9bc89240779103eef92b373d3bc 100644 (file)
@@ -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"
index 31e7f86ad793fa873ac23a42c9c908fb0250b3f8..eda6009c62abeb18ce0fc365201a03d99d8b32ab 100644 (file)
@@ -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
index c4589edc8510e8dc47b71b055ea7fc0711982788..0d6649038165eb24e95e3fcf0b498ff5be5d80f1 100644 (file)
@@ -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