2009-05-17 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+ Cope with parallel BSD make -jN semantics.
+ When BSD `make -jN' is used without `-B' which enables backwards
+ compatible semantics, it may reuse the same shell for several
+ commands within a rule; so ensure we do not leave it in a
+ different directory, nor `exit 0' early in a multi-command rule.
+ * lib/am/distdir.am (distcheck): After running `distcleancheck',
+ change back to original working directory.
+ * lib/am/remake-hdr.am (%CONFIG_HIN%): Run autoheader in a
+ subshell.
+ * lib/am/mans.am (uninstall-man%SECTION%): Do not `exit 0' early
+ in a rule that consists of several shell invocations. Parallel
+ NetBSD `make -jN' without `-B' will use only one shell for all
+ commands, but won't respawn one after `exit 0'. Fixes
+ notrans.test failure.
+ * tests/makej2.test: New test.
+ * tests/Makefile.am: Update.
+
Fix typo in comment.
* lib/am/install.am: Fix typo.
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
- && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
+ && cd "$$am__cwd" \
+ || exit 1
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
files=`{ for i in $$list; do echo "$$i"; done; \
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
- test -n "$$files" || exit 0; \
- echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(man1dir)" && rm -f $$files
+ test -z "$$files" || { \
+ echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(man1dir)" && rm -f $$files; }
install-dist_docDATA: $(dist_doc_DATA)
@$(NORMAL_INSTALL)
test -z "$(docdir)" || $(MKDIR_P) "$(DESTDIR)$(docdir)"
## create very long directory names.
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
?DISTCHECK-HOOK? && $(MAKE) $(AM_MAKEFLAGS) distcheck-hook \
+## Parallel BSD make may not start a new shell for each command in a recipe,
+## so be sure to `cd' back to the original directory after this.
+ && am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
?GETTEXT? --with-included-gettext \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
## Make sure to remove the dists we created in the test build directory.
&& rm -rf $(DIST_ARCHIVES) \
- && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
+## Cater to parallel BSD make (see above).
+ && cd "$$am__cwd" \
+ || exit 1
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
?HAVE_NOTRANS? sed -n '/\.%SECTION%[a-z]*$$/p'; \
## Extract basename of manpage, change the extension if needed.
} | sed 's,.*/,,;s,\.[^%SECTION%][0-9a-z]*$$,.%SECTION%,'`; \
- test -n "$$files" || exit 0; \
- echo " ( cd '$(DESTDIR)$(man%SECTION%dir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(man%SECTION%dir)" && rm -f $$files
+ test -z "$$files" || { \
+ echo " ( cd '$(DESTDIR)$(man%SECTION%dir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(man%SECTION%dir)" && rm -f $$files; }
endif %?NOTRANS_MANS%
if %?TRANS_MANS%
## Handle MANS without notrans_ prefix
## transform, and change the extension if needed.
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^%SECTION%][0-9a-z]*$$,%SECTION%,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
- test -n "$$files" || exit 0; \
- echo " ( cd '$(DESTDIR)$(man%SECTION%dir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(man%SECTION%dir)" && rm -f $$files
+ test -z "$$files" || { \
+ echo " ( cd '$(DESTDIR)$(man%SECTION%dir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(man%SECTION%dir)" && rm -f $$files; }
endif %?TRANS_MANS%
## automake - create Makefile.in from Makefile.am
## Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2003, 2004, 2005,
-## 2008 Free Software Foundation, Inc.
+## 2008, 2009 Free Software Foundation, Inc.
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## by autoheader.
if %?FIRST%
%CONFIG_HIN%: %MAINTAINER-MODE% $(am__configure_deps) %FILES%
- $(am__cd) $(top_srcdir) && $(AUTOHEADER)
+## Cater to parallel BSD make.
+ ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
## Whenever $(AUTOHEADER) has run, we must make sure that
## ./config.status will rebuild config.h. The dependency from %STAMP%
## on %CONFIG_H_DEPS% (which contains config.hin) is not enough to
maintclean.test \
make.test \
makej.test \
+makej2.test \
maken.test \
maken2.test \
maken3.test \
maintclean.test \
make.test \
makej.test \
+makej2.test \
maken.test \
maken2.test \
maken3.test \
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2009 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test to make sure known BSD `make -jN' issues are fixed:
+# without -B, it may reuse the same shell for separate commands in a
+# rule, which can lead to interesting results.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >>configure.in <<'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+test-distdir-removed:
+ test ! -d $(distdir)
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+mkdir build
+cd build
+../configure "--prefix=`pwd`/inst"
+
+$MAKE -j2 || Exit 77
+$MAKE -j2 distcheck
+$MAKE test-distdir-removed
+
+Exit 0