header-vars: recognize more make flags ('-k' in particular)
[platform/upstream/automake.git] / lib / am / header-vars.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 VPATH = @srcdir@
18
19 @SET_MAKE@
20
21 ## We used to define this.  However, we don't because vendor makes
22 ## (e.g., Solaris, Irix) won't correctly propagate variables that are
23 ## defined in Makefile.  This particular variable can't be correctly
24 ## defined by configure (at least, not the current configure), so we
25 ## simply avoid defining it to allow the user to use this feature with
26 ## a vendor make.
27 ## DESTDIR =
28
29 ## Shell code that determines whether we are running under GNU make.
30 ## This is somewhat of an hack, and might be improved, but is good
31 ## enough for now.
32 am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
33
34 ## Shell code that determines whether the current make instance is
35 ## running with a given one-letter option (e.g., -k, -n) that takes
36 ## no argument.  Actually, the only supported option at the moment
37 ## is '-n' (support for '-k' will be added soon).
38 am__make_running_with_option = \
39   { \
40     case $${am__target_option-} in \
41         ?) ;; \
42         *) echo "am__make_running_with_option: internal error: invalid" \
43                 "target option '$${am__target_option-}' specified" >&2; \
44            exit 1;; \
45     esac; \
46     am__has_opt=no; \
47     if $(am__is_gnu_make); then \
48 ## GNU make: $(MAKEFLAGS) is quite tricky there, while the older variable
49 ## $(MFLAGS) behaves much better.  So use the latter.
50       for am__flg in $$MFLAGS; do \
51         case $$am__flg in \
52           *=*|--*) ;; \
53           -*$$am__target_option*) am__has_opt=yes; break;; \
54         esac; \
55       done; \
56     else \
57 ## Non-GNU make: we must rely on $(MAKEFLAGS).  This is tricker and more
58 ## brittle, but is the best we can do.
59       case $$MAKEFLAGS in \
60 ## If we run "make TESTS='snooze nap'", FreeBSD make will export MAKEFLAGS
61 ## to " TESTS=foo\ nap", so that the simpler loop below (on word-splitted
62 ## $$MAKEFLAGS) would see a "make flag" equal to "nap", and would wrongly
63 ## misinterpret that as and indication that make is running in dry mode.
64 ## This has already happened in practice.  So we need this hack.
65          *\\[\ \        ]*) \
66 ## Extra indirection with ${am__bs} required by FreeBSD 8.x make.
67 ## Not sure why (so sorry for the cargo-cult programming here).
68            am__bs=\\; \
69            am__flags=`printf '%s\n' "$$MAKEFLAGS" \
70             | sed "s/$$am__bs$$am__bs[$$am__bs $$am__bs ]*//g"`;; \
71          *) \
72            am__flags=$$MAKEFLAGS;; \
73       esac; \
74       am__skip_next=no; \
75       for am__flg in $$am__flags; do \
76         if test $$am__skip_next = yes; then \
77           am__skip_next=no; \
78           continue; \
79         fi; \
80         case $$am__flg in \
81           *=*|--*) ;; \
82 ## Quite ugly special-casing.  We might need other similar ones actually,
83 ## but let's wait until the need arises.
84           -I) am__skip_next=yes;; \
85           *$$am__target_option*) am__has_opt=yes; break;; \
86         esac; \
87       done;\
88     fi; \
89     unset am__skip_next am__flg am__flags am__target_option; \
90     test $$am__has_opt = yes; \
91   }
92
93 ## Shell code that determines whether make is running in "dry mode"
94 ## ("make -n") or not.  Useful in rules that invoke make recursively,
95 ## and are thus executed also with "make -n" -- either because they
96 ## are declared as dependencies to '.MAKE' (NetBSD make), or because
97 ## their recipes contain the "$(MAKE)" string (GNU and Solaris make).
98 am__make_dryrun = { am__target_option=n; $(am__make_running_with_option); }
99
100 ## Shell code that determines whether make is running in "keep-going mode"
101 ## ("make -k") or not.  Useful in rules that must recursively descend into
102 ## subdirectories, and decide whther to stop at the first error or not.
103 am__make_keepgoing = { am__target_option=k; $(am__make_running_with_option); }
104
105 ## Some derived variables that have been found to be useful.
106 pkgdatadir = $(datadir)/@PACKAGE@
107 pkgincludedir = $(includedir)/@PACKAGE@
108 pkglibdir = $(libdir)/@PACKAGE@
109 pkglibexecdir = $(libexecdir)/@PACKAGE@
110
111 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
112 install_sh_DATA = $(install_sh) -c -m 644
113 install_sh_PROGRAM = $(install_sh) -c
114 install_sh_SCRIPT = $(install_sh) -c
115 INSTALL_HEADER = $(INSTALL_DATA)
116 transform = $(program_transform_name)
117
118 ## These are defined because otherwise make on NetBSD V1.1 will print
119 ## (eg): $(NORMAL_INSTALL) expands to empty string.
120 NORMAL_INSTALL = :
121 PRE_INSTALL = :
122 POST_INSTALL = :
123 NORMAL_UNINSTALL = :
124 PRE_UNINSTALL = :
125 POST_UNINSTALL = :
126
127 ## dejagnu.am uses these variables.  Some users might rely on them too.
128 ?BUILD?build_triplet = @build@
129 ?HOST?host_triplet = @host@
130 ?TARGET?target_triplet = @target@