3 #----------------------------------------------------------------------------
6 # Nested directory targets makefile definitions
7 #----------------------------------------------------------------------------
9 # If the client makefile is not called "Makefile", the MAKEFILE
10 # variable must be set to its actual name before including this
11 # file to allow the recursive MAKE to work properly.
13 TOP_MAKEFILE := $(word 1,$(MAKEFILE_LIST))
14 MAKEFILE ?= $(TOP_MAKEFILE)
15 SUBDIR_MAKEFILE ?= $(MAKEFILE)
17 # Make sure that we build directories with DIRS= in sequence instead of in
18 # parallel, unless DIRS_PARALLEL is set, in which case they may be built
19 # in parallel if enabled by the proper flags and not disabled elsewhere.
22 ifeq ($(DIRS_PARALLEL),)
26 # A rule to build DIR.subdir from DIR by calling MAKE again, with
27 # DIR as the new directory, SUBDIR_TARGET as the target to build, and
28 # "GNUmakefile" as the makefile to use in the new directory.
30 # Triggered by the $(TARGETS_NESTED) target, below.
34 @date=`date`; echo "START: $< $$date"
36 cd $< && $(MAKE) -f $(SUBDIR_MAKEFILE) $(SUBDIR_TARGET)
38 @date=`date`;echo "FINISH: $< $$date"
41 # Build FOO.nested by calling MAKE again, this time with DIRS (with
42 # ".subdir" appended to each) as the targets, and passing FOO as the
43 # real target to build in the SUBDIR_TARGET variable.
48 $(MAKE) -f $(MAKEFILE) SUBDIR_TARGET=$(@:.nested=) $(addsuffix .subdir, $(DIRS))