am: do not quote `like this', as per GCS recommendation
[platform/upstream/automake.git] / lib / am / subdirs.am
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 1994-2012 Free Software Foundation, Inc.
3
4 ## This program is free software; you can redistribute it and/or modify
5 ## it under the terms of the GNU General Public License as published by
6 ## the Free Software Foundation; either version 2, or (at your option)
7 ## any later version.
8
9 ## This program is distributed in the hope that it will be useful,
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 ## GNU General Public License for more details.
13
14 ## You should have received a copy of the GNU General Public License
15 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 RECURSIVE_TARGETS += all-recursive check-recursive installcheck-recursive
18 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
19   distclean-recursive maintainer-clean-recursive
20 ## All documented targets which invoke 'make' recursively, or depend
21 ## on targets that do so.
22 AM_RECURSIVE_TARGETS += $(RECURSIVE_TARGETS:-recursive=) \
23   $(RECURSIVE_CLEAN_TARGETS:-recursive=)
24
25 .PHONY: $(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS)
26 .MAKE: $(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS)
27
28 # This directory's subdirectories are mostly independent; you can cd
29 # into them and run 'make' without going through this Makefile.
30 # To change the values of 'make' variables: instead of editing Makefiles,
31 # (1) if the variable is set in 'config.status', edit 'config.status'
32 #     (which will cause the Makefiles to be regenerated when you run 'make');
33 # (2) otherwise, pass the desired values on the 'make' command line.
34
35 $(RECURSIVE_TARGETS):
36 ## Using $failcom allows "-k" to keep its natural meaning when running a
37 ## recursive rule.
38         @fail= failcom='exit 1'; \
39         for f in x $$MAKEFLAGS; do \
40           case $$f in \
41             *=* | --[!k]*);; \
42             *k*) failcom='fail=yes';; \
43           esac; \
44         done; \
45         dot_seen=no; \
46         target=`echo $@ | sed s/-recursive//`; \
47         list='$(SUBDIRS)'; for subdir in $$list; do \
48           echo "Making $$target in $$subdir"; \
49           if test "$$subdir" = "."; then \
50             dot_seen=yes; \
51             local_target="$$target-am"; \
52           else \
53             local_target="$$target"; \
54           fi; \
55           ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
56           || eval $$failcom; \
57         done; \
58         if test "$$dot_seen" = "no"; then \
59           $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
60         fi; test -z "$$fail"
61
62
63 mostlyclean: mostlyclean-recursive
64 clean: clean-recursive
65 distclean: distclean-recursive
66 maintainer-clean: maintainer-clean-recursive
67
68 ## We run all 'clean' targets in reverse order.  Why?  It's an attempt
69 ## to alleviate a problem that can happen when dependencies are
70 ## enabled.  In this case, the .P file in one directory can depend on
71 ## some automatically generated header in an earlier directory.  Since
72 ## the dependencies are required before any target is examined, make
73 ## bombs.
74 $(RECURSIVE_CLEAN_TARGETS):
75 ## Using $failcom allows "-k" to keep its natural meaning when running a
76 ## recursive rule.
77         @fail= failcom='exit 1'; \
78         for f in x $$MAKEFLAGS; do \
79           case $$f in \
80             *=* | --[!k]*);; \
81             *k*) failcom='fail=yes';; \
82           esac; \
83         done; \
84         dot_seen=no; \
85 ## For distclean and maintainer-clean we make sure to use the full
86 ## list of subdirectories.  We do this so that 'configure; make
87 ## distclean' really is a no-op, even if SUBDIRS is conditional.  For
88 ## other clean targets this doesn't matter.
89         case "$@" in \
90           distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
91           *) list='$(SUBDIRS)' ;; \
92         esac; \
93         rev=''; for subdir in $$list; do \
94           if test "$$subdir" = "."; then :; else \
95             rev="$$subdir $$rev"; \
96           fi; \
97         done; \
98 ## Always do '.' last.
99         rev="$$rev ."; \
100         target=`echo $@ | sed s/-recursive//`; \
101         for subdir in $$rev; do \
102           echo "Making $$target in $$subdir"; \
103           if test "$$subdir" = "."; then \
104             local_target="$$target-am"; \
105           else \
106             local_target="$$target"; \
107           fi; \
108           ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
109           || eval $$failcom; \
110         done && test -z "$$fail"