#!/bin/sh
# automake - create Makefile.in from Makefile.am
# Copyright (C) 1994 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# Sample usage: automake Makefile lib/Makefile src/Makefile man/Makefile
# Written by David Mackenzie <djm@gnu.ai.mit.edu>.
if test $# -eq 0; then
echo "Usage: automake Makefile..." >&2
exit 1
fi
am_status=0
AM_DIR=`echo $0|sed s%automake%%`
# Remove \newline.
am_rmnl=/tmp/am.sed1
cat > $am_rmnl <<\EOF
/\\$/{
s///
H
d
}
/[^\\]$/{
H
x
s/\n//g
p
s/.*//
h
}
EOF
# Turn Makefile target and variable assignments
# into shell variable assignments.
am_ass=/tmp/am.sed2
cat > $am_ass <<\EOF
s/(/{/g
s/)/}/g
/^ *\([a-zA-Z_.][a-zA-Z0-9_.]*\):.*/{
s//target_\1=explicit/
s/\./_/g
p
}
s/^ *\([A-Z][A-Z0-9_]*\)[ ]*=[ ]*\(.*\)/\1='\2'/p
EOF
for am_makefile
do
if test ! -f ${am_makefile}.am; then
echo "automake: ${am_makefile}.am: No such honkin' file"
am_status=1
continue
fi
echo creating ${am_makefile}.in
exec 4> ${am_makefile}.vars
exec 5> ${am_makefile}.rules
cat $AM_DIR/header-vars.am >&4
cat $AM_DIR/header.am >&5
target_distname=default
DEFS= INCLUDES= CPPFLAGS= CFLAGS=
SOURCES= CONFIG_HEADER= SUBDIRS= PROGRAMS= LIBRARIES= TEXINFOS= MANS=
eval `sed -n -f $am_rmnl ${am_makefile}.am | sed -n -f $am_ass`
if test -n "$PROGRAMS" || test -n "$LIBRARIES"; then
cat $AM_DIR/compile-vars.am >&4
cat $AM_DIR/compile.am >&5
for am_file in $PROGRAMS $LIBRARIES; do
if grep "^[ ]*${am_file}_SOURCES[ ]*=" ${am_makefile}.am >/dev/null; then
if grep "^[ ]*${am_file}_OBJECTS[ ]*=" ${am_makefile}.am >/dev/null; then
:
else
sed -n -f $am_rmnl ${am_makefile}.am |
sed -n "/^[ ]*${am_file}_SOURCES[ ]*=/{
s/SOURCES/OBJECTS/
s/@[^@]*@//g
s/\$([^)]*)//g
s/\${[^}]*}//g
s/\\.cc/.\${kr}o/g
s/\\.\${kr}c/.\${kr}o/g
s/\\.\$(kr)c/.\${kr}o/g
s/\\.[cCmylfs]/.\${kr}o/g
p
}" >&4
fi
SOURCES="$SOURCES \${${am_file}_SOURCES}"
else
echo "${am_file}_SOURCES = ${am_file}.c
${am_file}_OBJECTS = ${am_file}.\${kr}o" >&4
SOURCES="$SOURCES ${am_file}.c"
fi
if test -n "$CONFIG_HEADER"; then
echo "\$(${am_file}_OBJECTS): $CONFIG_HEADER" >&4
fi
done
fi
if test -n "$PROGRAMS"; then
cat $AM_DIR/programs-vars.am >&4
cat $AM_DIR/programs.am >&5
for am_prog in $PROGRAMS; do
sed "s/@PROGRAM@/$am_prog/g" $AM_DIR/program.am >&5
done
fi
if test -n "$LIBRARIES"; then
echo "LIBFILES = " `echo "$LIBRARIES"|sed 's/\([a-zA-Z0-9_][a-zA-Z0-9_]*\)/lib\1.a/g'` >&4
cat $AM_DIR/libraries-vars.am >&4
cat $AM_DIR/libraries.am >&5
for am_lib in $LIBRARIES; do
sed "s/@LIBRARY@/$am_lib/g" $AM_DIR/library.am >&5
done
fi
if test -n "$TEXINFOS"; then
cat $AM_DIR/texinfos-vars.am >&4
cat $AM_DIR/texinfos.am >&5
echo "$TEXINFOS" | sed 's/^/INFOS = /; s/\.texi/.info/g' >&4
echo "$TEXINFOS" | sed 's/^/DVIS = /; s/\.texi/.dvi/g' >&4
fi
if test -n "$MANS"; then
cat $AM_DIR/mans-vars.am >&4
cat $AM_DIR/mans.am >&5
fi
case "$SUBDIRS" in
"") cat $AM_DIR/clean.am >&5 ;;
*) cat $AM_DIR/subdirs.am >&5 ;;
esac
case "$am_makefile" in
*/*) ;;
*) test -f aclocal.m4 && echo "ACLOCAL = aclocal.m4" >&4
cat $AM_DIR/remake.am >&5 ;;
esac
case "$CONFIG_HEADER" in
"") ;;
*/*) ;; # It's in some other directory, so don't remake it in this one.
*)
test -f acconfig.h && echo "ACCONFIG = acconfig.h" >&4
test -f config.h.top && echo "CONFIG_TOP = config.h.top" >&4
test -f config.h.bot && echo "CONFIG_BOT = config.h.bot" >&4
cat $AM_DIR/remake-hdr.am >&5 ;;
esac
echo "SOURCES = $SOURCES" >&4
case "$am_makefile" in
*/*)
cat $AM_DIR/dist-subd-vars.am >&4
cat $AM_DIR/dist-subd.am >&5 ;;
*) test "$target_distname" != explicit && cat $AM_DIR/distname.am >&5
cat $AM_DIR/dist-vars.am >&4
cat $AM_DIR/dist.am >&5 ;;
esac
cat $AM_DIR/footer.am >&5
sed '/^ *\([a-zA-Z_.][a-zA-Z0-9_. ]*\):.*/,$d' ${am_makefile}.am >&4
sed -n '/^ *\([a-zA-Z_.][a-zA-Z0-9_. ]*\):.*/,$p' ${am_makefile}.am >&5
cat ${am_makefile}.vars ${am_makefile}.rules > ${am_makefile}.in
rm -f ${am_makefile}.vars ${am_makefile}.rules
done
rm -f $am_rmnl $am_ass
exit $am_status