2 # Copyright 2015-2016 Nest Labs Inc. All Rights Reserved.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
19 # This file defines automake variables and macros common to all
20 # other automake headers and files for invoking make in a list
21 # of subdirectories with a list of target goals.
25 # nl-make-subdirs-with-dirs-and-goals <subdirectories> <goals>
27 # This iteratively invokes make with the provided target goals in each
28 # subdirectory specified.
30 # subdirectories A space-delimited list of subdirectories in which to
31 # invoke make with the provided target goals.
33 # goals A space-delimited list of target goals to
34 # attempt to make in each specified subdirectory.
36 define nl-make-subdirs-with-dirs-and-goals
37 +$(AM_V_at)for subdir in $(1); do \
38 echo "Making $(2) in $${subdir}"; \
39 $(MAKE) -C "$${subdir}" $(AM_MAKEFLAGS) $(2) \
42 endef # nl-make-subdirs-with-dirs-and-goals
45 # nl-make-subdirs-with-dirs <subdirectories>
47 # This iteratively invokes make with the target goals defined in
48 # MAKECMDGOALS in each subdirectory specified.
50 # subdirectories A space-delimited list of subdirectories in which to
51 # invoke make with the provided target goals.
53 define nl-make-subdirs-with-dirs
54 $(call nl-make-subdirs-with-dirs-and-goals,$(1),$(MAKECMDGOALS))
55 endef # nl-make-subdirs-with-dirs
58 # nl-make-subdirs-with-goals <goals>
60 # This iteratively invokes make with the provided target goals in the
61 # subdirectories defined in SUBDIRS.
63 # goals A space-delimited list of target goals to
64 # attempt to make in SUBDIRS.
66 define nl-make-subdirs-with-goals
67 $(call nl-make-subdirs-with-dirs-and-goals,$(SUBDIRS),$(1))
68 endef # nl-make-subdirs-with-goals
73 # This iteratively invokes make with the target goals defined in
74 # MAKECMDGOALS in the subdirectories defined in SUBDIRS.
76 define nl-make-subdirs
77 $(call nl-make-subdirs-with-dirs-and-goals,$(SUBDIRS),$(MAKECMDGOALS))
78 endef # nl-make-subdirs