I'm not claiming that make -j2 is perfect yet, but here's one more step towards it. During 'make -j2 check', after touching lib/autoconf/*.m4 files, the mktests.sh rule was spawned twice to rebuild multiple files at once, and died when one instance deleted a file in use by the other. Automake gives some nice instructions on how to make this parallel-make safe[1]; I went with the next-to- last idea that assumes the user is not deleting targets without also deleting the stamp file, because it was simpler.
[1] http://sourceware.org/automake/automake.html#Multiple-Outputs Committing this: 2007-09-13 Eric Blake <[EMAIL PROTECTED]> Avoid parallel 'make check' issue. * tests/Makefile.am (mktests.stamp): New witness. (TESTSUITE_GENERATED_AT): Use it. (CLEANFILES): Clean the witness. * tests/.cvsignore (mktests.stamp): Ignore the witness. * tests/Makefile.in: Regenerate. Index: tests/Makefile.am =================================================================== RCS file: /sources/autoconf/autoconf/tests/Makefile.am,v retrieving revision 1.105 diff -u -p -r1.105 Makefile.am --- tests/Makefile.am 20 Jul 2007 23:11:54 -0000 1.105 +++ tests/Makefile.am 13 Sep 2007 19:49:57 -0000 @@ -1,6 +1,6 @@ ## Make Autoconf tests. -# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 +# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 # Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify @@ -158,10 +158,21 @@ AUTOCONF_FILES = $(autoconfdir)/general. $(autoconfdir)/types.m4 \ $(autoconfdir)/programs.m4 -$(TESTSUITE_GENERATED_AT): mktests.sh $(AUTOCONF_FILES) +$(TESTSUITE_GENERATED_AT): mktests.stamp +## Recover from the removal of $@ + @if test -f $@; then :; else \ + rm -f mktests.stamp; \ + $(MAKE) $(AM_MAKEFLAGS) mktests.stamp; \ + fi + +mktests.stamp : mktests.sh $(AUTOCONF_FILES) + @rm -f mktests.tmp + @touch mktests.tmp cd $(srcdir) && ./mktests.sh \ `echo " "$(AUTOCONF_FILES) | sed 's, [^ ]*/, ../lib/autoconf/,g'` + @mv -f mktests.tmp $@ +CLEANFILES += mktests.stamp mktests.tmp ## maintainer-check ##
