4 # automake - create Makefile.in from Makefile.am
5 # Copyright (C) 1994 Free Software Foundation, Inc.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 # Sample usage: automake Makefile lib/Makefile src/Makefile man/Makefile
22 # Written by David Mackenzie <djm@gnu.ai.mit.edu>.
24 # Caveat: must use all lowercase variables in this file. User
25 # Makefile.am can cause any uppercase variable to be set.
29 # We need prefix because datadir might depend on it.
31 am_dir
=@datadir@
/automake
33 usage
="Usage: automake [--help] [--version] [Makefile]..."
35 # These are commonly found files that we look for and automatically
36 # include in DIST_FILES. NOTE if you add something here, make sure
37 # you add it in the right place -- that is, so that the "--help" still
39 common
='THANKS TODO README NEWS COPYING COPYING.LIB INSTALL NLS ChangeLog configure configure.in config.guess config.sub mkinstalldirs install-sh texinfo.tex'
42 # Only set `LANG' and `LC_ALL' to "C" if already set.
43 # These must not be set unconditionally because not all systems understand
44 # e.g. LANG=C (notably SCO).
45 if test "${LC_ALL+set}" = set; then LC_ALL
=C
; export LC_ALL
; fi
46 if test "${LANG+set}" = set; then LANG
=C
; export LANG
; fi
49 while test $# -gt 0; do
54 echo "Files which are automatically distributed, if found:"
56 while test $# -gt 0; do
65 echo "Automake version $version"
69 -- ) # Stop option processing.
75 # FIXME consider "-" meaning stdin as input?
76 echo "automake: unrecognized option -- \`$1'" 1>&2
88 test -n "$mfiles" ||
{
90 mfiles
=`echo */Makefile.am`
91 if test "$mfiles" = '*/Makefile.am'; then
94 mfiles
=`echo "$mfiles" | sed 's/\.am//g'`
97 if test -f Makefile.am
; then
98 mfiles
="Makefile $mfiles"
101 if test -n "$mfiles"; then
102 echo "automake: using $mfiles" 1>&2
112 # Some handy sed scripts.
113 am_rmnl
=$am_dir/nl-remove.
sed
114 am_ass
=$am_dir/hack-make.
sed
116 for am_makefile
in $mfiles; do
118 if test ! -f ${am_makefile}.am
; then
119 echo "automake: ${am_makefile}.am: No such honkin' file" 1>&2
124 echo creating
${am_makefile}.
in
126 exec 4> ${am_makefile}.vars
127 exec 5> ${am_makefile}.rules
129 echo "# Makefile.in generated automatically by automake $version from Makefile.am." >&4
130 cat $am_dir/header-vars.am
>&4
131 cat $am_dir/header.am
>&5
133 DEFS
= INCLUDES
= CPPFLAGS
= CFLAGS
=
134 SOURCES
= CONFIG_HEADER
= SUBDIRS
= PROGRAMS
= LIBPROGRAMS
= SCRIPTS
= LIBSCRIPTS
=
135 LIBRARIES
= TEXINFOS
= MANS
= AM_PROGRAMS
=
138 eval `sed -n -f $am_rmnl ${am_makefile}.am | sed -n -f $am_ass`
141 # If a variable is set at configure time, we still need to know the
142 # values it can assume (statically). This is done using the AM_
143 # forms in the Makefile.am. Handle it now.
145 test -n "$AM_PROGRAMS" && {
146 PROGRAMS
=$AM_PROGRAMS
148 test -n "$AM_LIBPROGRAMS" && {
149 LIBPROGRAMS
=$AM_LIBPROGRAMS
151 test -n "$AM_SCRIPTS" && {
154 test -n "$AM_LIBSCRIPTS" && {
155 LIBSCRIPTS
=$AM_LIBSCRIPTS
157 test -n "$AM_LIBRARIES" && {
158 LIBRARIES
=$AM_LIBRARIES
161 if grep @kr@
${am_makefile}.am
>/dev
/null
; then
167 if test -n "$PROGRAMS$LIBPROGRAMS$LIBRARIES"; then
168 cat $am_dir/compile-vars.am
>&4
169 cat $am_dir/compile.am
>&5
171 # Check for automatic de-ANSIfication.
172 if grep @kr@
${am_makefile}.am
>/dev
/null
; then
173 cat $am_dir/compile-kr.am
>&5
174 am_suffixes
=".krc .krh .kro $am_suffixes"
177 for am_file
in $PROGRAMS $LIBPROGRAMS $LIBRARIES; do
178 if eval "test \"\$var_${am_file}_SOURCES\" = explicit"; then
179 if eval "test \"\$var_${am_file}_OBJECTS\" = explicit"; then
182 sed -n -f $am_rmnl ${am_makefile}.am |
183 sed -n "/^[ ]*${am_file}_SOURCES[ ]*=/{
189 s/\\.\${kr}c/.${kr}o/g
190 s/\\.\$(kr)c/.${kr}o/g
191 s/\\.[cCmylfs]/.${kr}o/g
195 SOURCES
="$SOURCES \${${am_file}_SOURCES}"
197 echo "${am_file}_SOURCES = ${am_file}.c" >&4
198 echo "${am_file}_OBJECTS = ${am_file}.${kr}o" >&4
199 SOURCES
="$SOURCES ${am_file}.c"
201 if test -n "$CONFIG_HEADER"; then
202 echo "\$(${am_file}_OBJECTS): $CONFIG_HEADER" >&5
208 # Boilerplate for scripts or programs.
210 if test -n "$PROGRAMS"; then
211 cat $am_dir/programs.am
>&5
213 if test -n "$SCRIPTS"; then
214 cat $am_dir/scripts.am
>&5
216 if test -n "$LIBPROGRAMS$LIBSCRIPTS"; then
217 cat $am_dir/libprograms.am
>&5
219 if test -n "$LIBSCRIPTS"; then
220 cat $am_dir/libscripts.am
>&5
223 if test -n "$PROGRAMS$LIBPROGRAMS$SCRIPTS$LIBSCRIPTS"; then
224 if test -n "$PROGRAMS$LIBPROGRAMS"; then
225 for am_prog
in $PROGRAMS $LIBPROGRAMS; do
226 # If `prog_LDADD' is explicitly defined, use it. Otherwise,
228 eval "test \"\$var_${am_prog}_LDADD\" = explicit" ||
{
229 # Not set, so set it.
230 echo "${am_prog}_LDADD = \${LDADD}" >&5
233 # Insert rule for this target, unless it is explicitly given
235 eval "test \"\$target_$am_prog\" != explicit" &&
236 sed "s/@PROGRAM@/$am_prog/g" $am_dir/program.am
>&5
241 if test -n "$LIBRARIES"; then
242 echo "LIBFILES = " `echo "$LIBRARIES"|sed 's/\([a-zA-Z0-9_][a-zA-Z0-9_]*\)/lib\1.a/g'` >&4
243 cat $am_dir/libraries-vars.am
>&4
244 cat $am_dir/libraries.am
>&5
245 for am_lib
in $LIBRARIES; do
246 sed "s/@LIBRARY@/$am_lib/g" $am_dir/library.am
>&5
250 if test -n "$TEXINFOS"; then
251 cat $am_dir/texinfos-vars.am
>&4
252 cat $am_dir/texinfos.am
>&5
253 am_suffixes
=".texi .info .dvi $am_suffixes"
254 echo "$TEXINFOS" |
sed 's/^/INFOS = /; s/\.texi/.info*/g' >&4
255 echo "$TEXINFOS" |
sed 's/^/INFO_DEPS = /; s/\.texi/.info/g' >&4
256 echo "$TEXINFOS" |
sed 's/^/DVIS = /; s/\.texi/.dvi/g' >&4
259 if test -n "$MANS"; then
260 cat $am_dir/mans-vars.am
>&4
261 cat $am_dir/mans.am
>&5
265 "") if grep @kr@
${am_makefile}.am
>/dev
/null
; then
266 cat $am_dir/clean-kr.am
>&5
267 else cat $am_dir/clean.am
>&5
269 cat $am_dir/footer.am
>&5 ;;
270 *) cat $am_dir/subdirs.am
>&5 ;;
273 case "$am_makefile" in
275 cat $am_dir/remake-subd.am
>&5
278 test -f aclocal.
m4 && echo "ACLOCAL = aclocal.m4" >&4
279 cat $am_dir/remake.am
>&5
283 case "$CONFIG_HEADER" in
285 */*) ;; # It's in some other directory, so don't remake it in this one.
287 test -f acconfig.h
&& echo "ACCONFIG = acconfig.h" >&4
288 test -f config.h.top
&& echo "CONFIG_TOP = config.h.top" >&4
289 test -f config.h.bot
&& echo "CONFIG_BOT = config.h.bot" >&4
290 cat $am_dir/remake-hdr.am
>&5 ;;
293 echo "SOURCES = $SOURCES" >&4
299 case "$am_makefile" in
301 if test -n "${SOURCES}${HEADERS}${ETAGS_ARGS}"; then
302 cat $am_dir/tags-subd.am
>&5
306 if test -n "${SUBDIRS}"; then
307 cat $am_dir/tags.am
>&5
309 if test -n "${SOURCES}${HEADERS}${ETAGS_ARGS}"; then
310 cat $am_dir/tags-subd.am
>&5
317 # Handle "dist" targets.
319 am_reldir
=`echo "$am_makefile" | sed 's,//*[^/][^/]*$,,g'`
320 if test "$am_reldir" = "$am_makefile"; then
324 # Look for certain common files and make sure they are included.
326 for cfile
in $common; do
327 if test -f $am_reldir/$cfile; then
328 dlist
="$dlist $cfile"
331 echo "DIST_COMMON = $dlist" >&4
332 # Include "dist" boilerplate.
333 case "$am_makefile" in
335 cat $am_dir/dist-subd-vars.am
>&4
336 echo "subdir = $am_reldir" >&5
337 cat $am_dir/dist-subd.am
>&5
340 cat $am_dir/dist-vars.am
>&4
341 if test -n "$SUBDIRS"; then
342 cat $am_dir/dist-subd-top.am
>&5
344 cat $am_dir/dist.am
>&5
350 # Put .SUFFIXES way down at the bottom.
352 if test -n "$am_suffixes"; then
353 echo ".SUFFIXES:" >&5
354 echo ".SUFFIXES: $am_suffixes" >&5
360 test -z "$TEXINFOS" ||
test -f $am_reldir/texinfo.tex ||
{
361 echo "automake: ${am_makefile}.am defines TEXINFOS, but" 1>&2
362 echo "automake: ${am_reldir}/texinfo.tex does not exist" 1>&2
366 sed '/^[^#=]*:/,$d' ${am_makefile}.am
>&4
367 sed -n '/^[^#=]*:/,$p' ${am_makefile}.am
>&5
368 cat ${am_makefile}.vars ${am_makefile}.rules > ${am_makefile}.
in
369 rm -f ${am_makefile}.vars
${am_makefile}.rules