| 1 |
## $Id: recurse.am 61576 2022-01-11 22:54:49Z karl $ |
| 2 |
## am/recurse.am: Makefile fragment to configure and build subdirs. |
| 3 |
## |
| 4 |
## Copyright 2017-2022 Karl Berry <[email protected]> |
| 5 |
## Copyright 2013 Peter Breitenlohner <[email protected]> |
| 6 |
## You may freely use, modify and/or distribute this file. |
| 7 |
## |
| 8 |
## Requires $(recurse_this) and $(recurse_top). |
| 9 |
## Uses CONF_SUBDIRS and MAKE_SUBDIRS (set by kpse-setup.m4). |
| 10 |
## |
| 11 |
## For subdirs not required for the current set of configure options |
| 12 |
## we append '--disable-build' so they can skip tests that would |
| 13 |
## fail because, e.g., some required libraries were not built. |
| 14 |
## (By manually testing $enable_build in configure, e.g., dvisvgm/configure.) |
| 15 |
## |
| 16 |
## Code inspired by automake's way to handle recursive targets. |
| 17 |
|
| 18 |
cf_silent = $(cf_silent_@AM_V@) |
| 19 |
cf_silent_ = $(cf_silent_@AM_DEFAULT_V@) |
| 20 |
cf_silent_0 = --silent |
| 21 |
cf_silent_1 = |
| 22 |
|
| 23 |
CONFIG_AUX = $(recurse_top)subsubdir-conf.cmd |
| 24 |
|
| 25 |
all-local: recurse |
| 26 |
|
| 27 |
.PHONY: recurse |
| 28 |
recurse: $(CONFIG_AUX) |
| 29 |
@fail= failcom='exit 1'; \ |
| 30 |
for f in x $$MAKEFLAGS; do \ |
| 31 |
case $$f in \ |
| 32 |
*=* | --[!k]*);; \ |
| 33 |
*k*) failcom='fail=yes';; \ |
| 34 |
esac; \ |
| 35 |
done; \ |
| 36 |
list='$(CONF_SUBDIRS)'; for one_dir in $$list; do \ |
| 37 |
if test ! -f $$one_dir/Makefile; then \ |
| 38 |
test -d $$one_dir || $(MKDIR_P) $$one_dir; \ |
| 39 |
cmd=`cat $(CONFIG_AUX) | sed "s,auxdir/auxsub,$(recurse_this)$$one_dir,g"`; \ |
| 40 |
case " $(MAKE_SUBDIRS) " in \ |
| 41 |
*" $$one_dir "*) skip=;; \ |
| 42 |
*) skip=' --disable-build';; \ |
| 43 |
esac; \ |
| 44 |
(cd $$one_dir && echo "=== configuring in $$one_dir (`pwd`)" && \ |
| 45 |
if $(AM_V_P); then echo "make: running $(SHELL) $$cmd$$skip"; fi && \ |
| 46 |
CONFIG_SHELL=$(SHELL) && export CONFIG_SHELL && \ |
| 47 |
eval $(SHELL) $$cmd$$skip $(cf_silent) || \ |
| 48 |
{ echo "=== configuring in $$one_dir failed"; exit 1; }) && \ |
| 49 |
if test "x$$skip" = x; then \ |
| 50 |
echo "Making all in $$one_dir" && \ |
| 51 |
(cd $$one_dir && $(MAKE) $(AM_MAKEFLAGS) all); \ |
| 52 |
fi || eval $$failcom; \ |
| 53 |
fi; \ |
| 54 |
done; test -z "$$fail" |
| 55 |
|
| 56 |
$(CONFIG_AUX): |
| 57 |
@echo "configure in $(recurse_top)auxdir/auxsub failed to create the file $@" |
| 58 |
exit 1 |
| 59 |
|
| 60 |
# (end of recurse.am) |