1 ## am/recurse.am: Makefile fragment to configure and build subdirs.
3 ## Copyright (C) 2013 Peter Breitenlohner <tex-live@tug.org>
4 ## You may freely use, modify and/or distribute this file.
6 ## requires $(recurse_this) and $(recurse_top).
8 # We must configure all subdirs since 'make dist' needs the Makefile.
9 # For those not required for the current set of configure options
10 # we append '--disable-build' so they can skip tests that would
11 # fail because, e.g., some required libraries were not built.
12 # Code inspired by automake's way to handle recursive targets.
14 cf_silent = $(cf_silent_@AM_V@)
15 cf_silent_ = $(cf_silent_@AM_DEFAULT_V@)
16 cf_silent_0 = --silent
19 CONFIG_AUX = $(recurse_top)subsubdir-conf.cmd
24 recurse: $(CONFIG_AUX)
25 @fail= failcom='exit 1'; \
26 for f in x $$MAKEFLAGS; do \
29 *k*) failcom='fail=yes';; \
32 list='$(CONF_SUBDIRS)'; for one_dir in $$list; do \
33 if test ! -f $$one_dir/Makefile; then \
34 test -d $$one_dir || $(MKDIR_P) $$one_dir; \
35 cmd=`cat $(CONFIG_AUX) | sed "s,auxdir/auxsub,$(recurse_this)$$one_dir,g"`; \
36 case " $(MAKE_SUBDIRS) " in \
37 *" $$one_dir "*) skip=;; \
38 *) skip=' --disable-build';; \
40 (cd $$one_dir && echo "=== configuring in $$one_dir (`pwd`)" && \
41 if $(AM_V_P); then echo "make: running $(SHELL) $$cmd$$skip"; fi && \
42 CONFIG_SHELL=$(SHELL) && export CONFIG_SHELL && \
43 eval $(SHELL) $$cmd$$skip $(cf_silent) || \
44 { echo "=== configuring in $$one_dir failed"; exit 1; }) && \
45 if test "x$$skip" = x; then \
46 echo "Making all in $$one_dir" && \
47 (cd $$one_dir && $(MAKE) $(AM_MAKEFLAGS) all); \
48 fi || eval $$failcom; \
50 done; test -z "$$fail"
53 @echo "configure in $(recurse_top)auxdir/auxsub failed to create the file $@"