subdirs: don't return false positives for the '-k' option's presence
[platform/upstream/automake.git] / lib / am / subdirs.am
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 1994-2013 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
21 am__recursive_targets = \
22   $(RECURSIVE_TARGETS) \
23   $(RECURSIVE_CLEAN_TARGETS) \
24   $(am__extra_recursive_targets)
25
26 ## All documented targets which invoke 'make' recursively, or depend
27 ## on targets that do so.  GNUmakefile from gnulib depends on this.
28 AM_RECURSIVE_TARGETS += $(am__recursive_targets:-recursive=)
29
30 .PHONY .MAKE: $(am__recursive_targets)
31
32 # This directory's subdirectories are mostly independent; you can cd
33 # into them and run 'make' without going through this Makefile.
34 # To change the values of 'make' variables: instead of editing Makefiles,
35 # (1) if the variable is set in 'config.status', edit 'config.status'
36 #     (which will cause the Makefiles to be regenerated when you run 'make');
37 # (2) otherwise, pass the desired values on the 'make' command line.
38
39 $(am__recursive_targets):
40 ## Using $failcom allows "-k" to keep its natural meaning when running a
41 ## recursive rule.
42         @fail=; \
43         if $(am__make_keepgoing); then \
44           failcom='fail=yes'; \
45         else \
46           failcom='exit 1'; \
47         fi; \
48         dot_seen=no; \
49         target=`echo $@ | sed s/-recursive//`; \
50 ## For distclean and maintainer-clean we make sure to use the full
51 ## list of subdirectories.  We do this so that 'configure; make
52 ## distclean' really is a no-op, even if SUBDIRS is conditional.
53         case "$@" in \
54           distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
55           *) list='$(SUBDIRS)' ;; \
56         esac; \
57         for subdir in $$list; do \
58           echo "Making $$target in $$subdir"; \
59           if test "$$subdir" = "."; then \
60             dot_seen=yes; \
61             local_target="$$target-am"; \
62           else \
63             local_target="$$target"; \
64           fi; \
65           ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
66           || eval $$failcom; \
67         done; \
68         if test "$$dot_seen" = "no"; then \
69           $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
70         fi; test -z "$$fail"
71
72 mostlyclean: mostlyclean-recursive
73 clean: clean-recursive
74 distclean: distclean-recursive
75 maintainer-clean: maintainer-clean-recursive
76