Debian Codegraph @

include/makeinclude/rules.nested.GNU

raw
1 # -*- Makefile -*-
2
3 #----------------------------------------------------------------------------
4 #
5 #
6 # Nested directory targets makefile definitions
7 #----------------------------------------------------------------------------
8
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.
12
13 TOP_MAKEFILE := $(word 1,$(MAKEFILE_LIST))
14 MAKEFILE ?= $(TOP_MAKEFILE)
15 SUBDIR_MAKEFILE ?= $(MAKEFILE)
16
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.
20 DIRS_PARALLEL ?=
21
22 ifeq ($(DIRS_PARALLEL),)
23 .NOTPARALLEL:
24 endif
25
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.
29
30 # Triggered by the $(TARGETS_NESTED) target, below.
31
32 %.subdir: %
33 ifneq ($(timed),)
34 @date=`date`; echo "START: $< $$date"
35 endif
36 cd $< && $(MAKE) -f $(SUBDIR_MAKEFILE) $(SUBDIR_TARGET)
37 ifneq ($(timed),)
38 @date=`date`;echo "FINISH: $< $$date"
39 endif
40
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.
44
45 $(TARGETS_NESTED):
46 ifdef DIRS
47 ifneq ($(DIRS),)
48 $(MAKE) -f $(MAKEFILE) SUBDIR_TARGET=$(@:.nested=) $(addsuffix .subdir, $(DIRS))
49 endif # DIRS
50 endif # DIRS