summaryrefslogtreecommitdiff
path: root/Build/source/am/recurse.am
blob: 3c6221a93dba5bb3ef4da26e78c0879936a8a22e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# $Id$
## am/recurse.am: Makefile fragment to configure and build subdirs.
##
## Copyright 2017      Karl Berry <tex-live@tug.org>
## Copyright 2013 Peter Breitenlohner <tex-live@tug.org>
## You may freely use, modify and/or distribute this file.
#
# Requires $(recurse_this) and $(recurse_top).
# Uses CONF_SUBDIRS and MAKE_SUBDIRS (set by kpse-setup.m4).
#
# For subdirs 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.
# (By manually testing $enable_build in configure, e.g., dvisvgm/configure.)
#
# Code inspired by automake's way to handle recursive targets.
#
cf_silent = $(cf_silent_@AM_V@)
cf_silent_ = $(cf_silent_@AM_DEFAULT_V@)
cf_silent_0 = --silent
cf_silent_1 =

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