|
1 # -*- makefile -*- |
|
2 # vim:set ts=8 sw=8 sts=8 noet: |
|
3 # |
|
4 # This Source Code Form is subject to the terms of the Mozilla Public |
|
5 # License, v. 2.0. If a copy of the MPL was not distributed with this |
|
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
|
7 |
|
8 # The purpose of this file is to pull in non-recursive targets when performing |
|
9 # a partial tree (not top-level) build. This will allow people to continue to |
|
10 # build individual directories while some of the targets may not be normally |
|
11 # defined in that make file. |
|
12 # |
|
13 # Non-recursive targets are attached to existing make targets. The |
|
14 # NONRECURSIVE_TARGETS variable lists the make targets that modified. For |
|
15 # each target in this list, the NONRECURSIVE_TARGET_<target> variable will |
|
16 # contain a list of partial variable names. We will then look in variables |
|
17 # named NONRECURSIVE_TARGETS_<target>_<fragment>_* for information describing |
|
18 # how to evaluate non-recursive make targets. |
|
19 # |
|
20 # Targets are defined by the following variables: |
|
21 # |
|
22 # FILE - The make file to evaluate. This is equivalent to |
|
23 # |make -f <FILE>| |
|
24 # DIRECTORY - The directory whose Makefile to evaluate. This is |
|
25 # equivalent to |make -C <DIRECTORY>|. |
|
26 # TARGETS - Targets to evaluate in that make file. |
|
27 # |
|
28 # Only 1 of FILE or DIRECTORY may be defined. |
|
29 # |
|
30 # For example: |
|
31 # |
|
32 # NONRECURSIVE_TARGETS = export libs |
|
33 # NONRECURSIVE_TARGETS_export = headers |
|
34 # NONRECURSIVE_TARGETS_export_headers_FILE = /path/to/exports.mk |
|
35 # NONRECURSIVE_TARGETS_export_headers_TARGETS = $(DIST)/include/foo.h $(DIST)/include/bar.h |
|
36 # NONRECURSIVE_TARGETS_libs = cppsrcs |
|
37 # NONRECURSIVE_TARGETS_libs_cppsrcs_DIRECTORY = $(DEPTH)/foo |
|
38 # NONRECURSIVE_TARGETS_libs_cppsrcs_TARGETS = /path/to/foo.o /path/to/bar.o |
|
39 # |
|
40 # Will get turned into the following: |
|
41 # |
|
42 # exports:: |
|
43 # $(MAKE) -C $(DEPTH) -f /path/to/exports.mk $(DIST)/include/foo.h $(DIST)/include/bar.h |
|
44 # |
|
45 # libs:: |
|
46 # $(MAKE) -C $(DEPTH)/foo /path/to/foo.o /path/to/bar.o |
|
47 |
|
48 ifndef INCLUDED_NONRECURSIVE_MK |
|
49 |
|
50 define define_nonrecursive_target |
|
51 $(1):: |
|
52 $$(MAKE) -C $(or $(4),$$(DEPTH)) $(addprefix -f ,$(3)) $(2) |
|
53 endef |
|
54 |
|
55 $(foreach target,$(NONRECURSIVE_TARGETS), \ |
|
56 $(foreach entry,$(NONRECURSIVE_TARGETS_$(target)), \ |
|
57 $(eval $(call define_nonrecursive_target, \ |
|
58 $(target), \ |
|
59 $(NONRECURSIVE_TARGETS_$(target)_$(entry)_TARGETS), \ |
|
60 $(NONRECURSIVE_TARGETS_$(target)_$(entry)_FILE), \ |
|
61 $(NONRECURSIVE_TARGETS_$(target)_$(entry)_DIRECTORY), \ |
|
62 )) \ |
|
63 ) \ |
|
64 ) |
|
65 |
|
66 INCLUDED_NONRECURSIVE_MK := 1 |
|
67 endif |
|
68 |