From 0df6dd4d8aea6edc733de81fb7eec115ea59a36e Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Sun, 7 Jul 2013 14:29:53 +0000 Subject: build system: additional Makefile fragments better handling of dependencies for highly parallel make git-svn-id: svn://tug.org/texlive/trunk@31127 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/am/rebuild.am | 19 +++++++++-------- Build/source/am/reconfig.am | 25 +++++++++++++++++++++++ Build/source/am/recurse.am | 50 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 9 deletions(-) create mode 100644 Build/source/am/reconfig.am create mode 100644 Build/source/am/recurse.am (limited to 'Build/source/am') diff --git a/Build/source/am/rebuild.am b/Build/source/am/rebuild.am index 9b53015b192..2713eb287fc 100644 --- a/Build/source/am/rebuild.am +++ b/Build/source/am/rebuild.am @@ -19,15 +19,16 @@ rebuild: $(rebuild_prereq) *n*) dry=:;; \ esac; \ done; \ - $$dry rm -f rebuild.stamp; \ - $$dry trap 'rm -rf rebuild.lock' 1 2 13 15; \ - if $$dry mkdir rebuild.lock 2>/dev/null; then \ - $(MAKE) $(AM_MAKEFLAGS) $(rebuild_target) rebuild.stamp; \ - $$dry rmdir rebuild.lock; \ - else \ - while test -d rebuild.lock && test -z "$$dry"; do sleep 1; done; \ - fi; \ - $$dry test -f rebuild.stamp + if test -f rebuild.stamp; then :; else \ + $$dry trap 'rm -rf rebuild.lock' 1 2 13 15; \ + if $$dry mkdir rebuild.lock 2>/dev/null; then \ + $(MAKE) $(AM_MAKEFLAGS) $(rebuild_target) rebuild.stamp; \ + $$dry rmdir rebuild.lock; \ + else \ + while test -d rebuild.lock && test -z "$$dry"; do sleep 1; done; \ + $$dry test -f rebuild.stamp; exit $$?; \ + fi; \ + fi CLEANFILES += rebuild.stamp diff --git a/Build/source/am/reconfig.am b/Build/source/am/reconfig.am new file mode 100644 index 00000000000..55e77fcbf27 --- /dev/null +++ b/Build/source/am/reconfig.am @@ -0,0 +1,25 @@ +## am/reconfig.am: Makefile fragment to reconfigure a directory. +## +## Copyright (C) 2013 Peter Breitenlohner +## You may freely use, modify and/or distribute this file. +## +## requires $(reconfig_prereq) and DISTCLEANFILES. +## +## Serialize concurrent reconfig attempts +## Compare Automake manual (info Automake) 27.9: Multiple Outputs +## +config.force: $(reconfig_prereq) + @if test -f $@; then :; else \ + trap 'rm -rf reconfig.lock' 1 2 13 15; \ + if mkdir reconfig.lock 2>/dev/null; then \ + echo timestamp >$@; \ + $(SHELL) ./config.status --recheck; \ + rmdir reconfig.lock; \ + else \ + while test -d rebuild.lock && test -z "$$dry"; do sleep 1; done; \ + test -f $@; \ + fi; \ + fi + +DISTCLEANFILES += config.force + diff --git a/Build/source/am/recurse.am b/Build/source/am/recurse.am new file mode 100644 index 00000000000..060a23b534b --- /dev/null +++ b/Build/source/am/recurse.am @@ -0,0 +1,50 @@ +## am/recurse.am: Makefile fragment to configure and build subdirs. +## +## Copyright (C) 2013 Peter Breitenlohner +## You may freely use, modify and/or distribute this file. +## +## requires $(recurse_this) and $(recurse_top). +## +# We must configure all subdirs since 'make dist' needs the Makefile. +# For those not required for the current set of configure options +# we append '--disable-build' so they can skip tests that would +# fail because, e.g., some required libraries were not built. +# Code inspired by automake's way to handle recursive targets. +## +CONFIG_AUX = $(recurse_top)subsubdir-conf.cmd + +all-local: recurse + +.PHONY: recurse +recurse: $(CONFIG_AUX) + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + list='$(CONF_SUBDIRS)'; for one_dir in $$list; do \ + if test ! -f $$one_dir/Makefile; then \ + test -d $$one_dir || $(MKDIR_P) $$one_dir; \ + cmd=`cat $(CONFIG_AUX) | sed "s,auxdir/auxsub,$(recurse_this)$$one_dir,g"`; \ + case " $(MAKE_SUBDIRS) " in \ + *" $$one_dir "*) skip=;; \ + *) skip=' --disable-build';; \ + esac; \ + (cd $$one_dir && echo "=== configuring in $$one_dir (`pwd`)" && \ + if $(AM_V_P); then echo "make: running $(SHELL) $$cmd$$skip"; fi && \ + CONFIG_SHELL=$(SHELL) && export CONFIG_SHELL && \ + eval $(SHELL) $$cmd$$skip $(cf_silent) || \ + { echo "=== configuring in $$one_dir failed"; exit 1; }) && \ + if test "x$$skip" = x; then \ + echo "Making all in $$one_dir" && \ + (cd $$one_dir && $(MAKE) $(AM_MAKEFLAGS) all); \ + fi || eval $$failcom; \ + fi; \ + done; test -z "$$fail" + +$(CONFIG_AUX): + @echo "configure in $(recurse_top)auxdir/auxsub failed to create the file $@" + exit 1 + -- cgit v1.2.3