1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 1994-2024 Free Software Foundation, Inc.
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)
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.
14 ## You should have received a copy of the GNU General Public License
15 ## along with this program. If not, see <https://www.gnu.org/licenses/>.
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
29 ## Shell code that determines whether we are running under GNU make.
31 ## Why the this needs to be so convoluted?
33 ## (1) We can't unconditionally use make functions or special variables
34 ## starting with a dot, as those cause non-GNU implementations to
37 ## (2) We can't use $(MAKE_VERSION) here, as it is also defined in some
38 ## non-GNU make implementations (e.g., FreeBSD make). But at least
39 ## BSD make does *not* define the $(CURDIR) variable -- it uses
40 ## $(.CURDIR) instead.
42 ## (3) We can't use $(MAKEFILE_LIST) here, as in some situations it
43 ## might cause the shell to die with "Arg list too long" (see
44 ## automake bug#18744).
46 ## (4) We can't use $(MAKE_HOST) unconditionally, as it is only
47 ## defined in GNU make 4.0 or later.
50 if test -z '$(MAKELEVEL)'; then \
52 elif test -n '$(MAKE_HOST)'; then \
54 elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
61 ## Shell code that determines whether the current make instance is
62 ## running with a given one-letter option (e.g., -k, -n) that takes
64 am__make_running_with_option = \
65 case $${target_option-} in \
67 *) echo "am__make_running_with_option: internal error: invalid" \
68 "target option '$${target_option-}' specified" >&2; \
72 sane_makeflags=$$MAKEFLAGS; \
73 if $(am__is_gnu_make); then \
74 ## The format of $(MAKEFLAGS) is quite tricky with GNU make; the
75 ## variable $(MFLAGS) behaves much better in that regard. So use it.
76 sane_makeflags=$$MFLAGS; \
78 ## Non-GNU make: we must rely on $(MAKEFLAGS). This is trickier and more
79 ## brittle, but is the best we can do.
81 ## If we run "make TESTS='snooze nap'", FreeBSD make will export MAKEFLAGS
82 ## to " TESTS=foo\ nap", so that the simpler loop below (on word-split
83 ## $$MAKEFLAGS) would see a "make flag" equal to "nap", and would wrongly
84 ## misinterpret that as and indication that make is running in dry mode.
85 ## This has already happened in practice. So we need this hack.
87 ## Extra indirection with ${bs} required by FreeBSD 8.x make.
88 ## Not sure why (so sorry for the cargo-cult programming here).
90 sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
91 | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
97 flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
99 for flg in $$sane_makeflags; do \
100 test $$skip_next = yes && { skip_next=no; continue; }; \
102 *=*|--*) continue;; \
104 ## GNU make 4.0 has changed the format of $MFLAGS, and removed the space
105 ## between an option and its argument (e.g., from "-I dir" to "-Idir").
106 ## So we need to handle both formats, at least for options valid in GNU
107 ## make. OTOH, BSD make formats $(MAKEFLAGS) by separating all options,
108 ## and separating any option from its argument, so things are easier
111 ## For GNU make and BSD make.
112 -*I) strip_trailopt 'I'; skip_next=yes;; \
113 -*I?*) strip_trailopt 'I';; \
114 ## For GNU make >= 4.0.
115 -*O) strip_trailopt 'O'; skip_next=yes;; \
116 -*O?*) strip_trailopt 'O';; \
117 ## For GNU make (possibly overkill, this one).
118 -*l) strip_trailopt 'l'; skip_next=yes;; \
119 -*l?*) strip_trailopt 'l';; \
121 -[dEDm]) skip_next=yes;; \
123 -[JT]) skip_next=yes;; \
126 *$$target_option*) has_opt=yes; break;; \
131 ## Shell code that determines whether make is running in "dry mode"
132 ## ("make -n") or not. Useful in rules that invoke make recursively,
133 ## and are thus executed also with "make -n" -- either because they
134 ## are declared as dependencies to '.MAKE' (NetBSD make), or because
135 ## their recipes contain the "$(MAKE)" string (GNU and Solaris make).
136 am__make_dryrun = (target_option=n; $(am__make_running_with_option))
138 ## Shell code that determines whether make is running in "keep-going mode"
139 ## ("make -k") or not. Useful in rules that must recursively descend into
140 ## subdirectories, and decide whether to stop at the first error or not.
141 am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
143 ## Helper to handle `rm -f` failing with no arguments.
144 am__rm_f = rm -f $(am__rm_f_notfound)
145 am__rm_rf = rm -rf $(am__rm_f_notfound)
147 ## Some derived variables that have been found to be useful.
148 pkgdatadir = $(datadir)/@PACKAGE@
149 pkgincludedir = $(includedir)/@PACKAGE@
150 pkglibdir = $(libdir)/@PACKAGE@
151 pkglibexecdir = $(libexecdir)/@PACKAGE@
153 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
154 install_sh_DATA = $(install_sh) -c -m 644
155 install_sh_PROGRAM = $(install_sh) -c
156 install_sh_SCRIPT = $(install_sh) -c
157 INSTALL_HEADER = $(INSTALL_DATA)
158 transform = $(program_transform_name)
160 ## These are defined because otherwise make on NetBSD V1.1 will print
161 ## (eg): $(NORMAL_INSTALL) expands to empty string.
169 ## dejagnu.am uses these variables. Some users might rely on them too.
170 ?BUILD?build_triplet = @build@
171 ?HOST?host_triplet = @host@
172 ?TARGET?target_triplet = @target@