#!/bin/sh
+# automake - create Makefile.in from Makefile.am
+# 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
status=0
+amdir=`echo $0|sed s%automake%%`
for makefile
do
exec 4> ${makefile}.in
+ cat $amdir/header.am >&4
+
+ cat ${makefile}.am >&4
+
+ CONFIG_HEADER= SUBDIRS= PROGRAMS= LIBRARIES= TEXINFOS= MANS=
+
+ eval `sed -n '
+s/^[ ]*\([A-Z][A-Z0-9_]*\)=[ ]*\(.*\)/\1=\2/p' ${makefile}.am`
+
+ case "$SUBDIRS" in
+ "") cat $amdir/clean.am >&4 ;;
+ *) cat $amdir/subdirs.am >&4 ;;
+ esac
+
+ if test -n "$PROGRAMS" || test -n "$LIBRARIES"; then
+ cat $amdir/compile.am >&4
+ for file in $PROGRAMS $LIBRARIES; do
+ sed -n "/^[ ]*${file}_SOURCES[ ]*=/{
+s/SOURCES/OBJECTS/
+s/\\.cc/.o/g
+s/\\.\${kr}c/.o/g
+s/\\.\$(kr)c/.o/g
+s/\\.[cCmylfs]/.o/g
+p
+}" ${makefile}.am >&4
+ if test -n "$CONFIG_HEADER"; then
+ echo "\$(${file}_OBJECTS): $CONFIG_HEADER" >&4
+ fi
+ done
+ fi
+
+ if test -n "$PROGRAMS"; then
+ cat $amdir/programs.am >&4
+ for prog in $PROGRAMS; do
+ sed "s/@PROGRAM@/$prog/g" $amdir/program.am >&4
+ done
+ fi
+
+ if test -n "$LIBRARIES"; then
+ cat $amdir/libraries.am >&4
+ for lib in $LIBRARIES; do
+ sed "s/@LIBRARY@/$lib/g" $amdir/library.am >&4
+ done
+ fi
+
+ if test -n "$TEXINFOS"; then
+ cat $amdir/texinfos.am >&4
+ 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 $amdir/mans.am >&4
+ fi
+
+ case "$makefile" in
+ */*) cat $amdir/remake-subdir.am >&4 ;;
+ *) test -f aclocal.m4 && echo "ACLOCAL = aclocal.m4" >&4
+ cat $amdir/remake.am >&4 ;;
+ 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 $amdir/remake-hdr.am >&4 ;;
+ esac
+
+ case "$makefile" in
+ */*) cat $amdir/dist-subdir.am >&4 ;;
+ *) cat $amdir/dist.am >&4 ;;
+ esac
+
+ cat $amdir/footer.am >&4
done
+
+exit $status
mostlyclean:
- rm -f *.o core
+ rm -f *.o *.krc *.krh core
clean: mostlyclean
- rm -f $(PROGRAMS) $(LIBRARIES) $(CLEANFILES)
+ rm -f $(PROGRAMS) $(LIBRARIES) $(TEXFILES) $(CLEANFILES)
distclean: clean
rm -f Makefile
CC = @CC@
LEX = @LEX@
YACC = @YACC@
+ANSI2KNR = ./ansi2knr
+
DEFS = @DEFS@
CFLAGS = @CFLAGS@
-.SUFFIXES:
-.SUFFIXES: .c .o
+.SUFFIXES: .c .o .krc .krh
.c.o:
$(CC) -c $(DEFS) $(CPPFLAGS) $(CFLAGS) $<
+
+.c.krc:
+ $(ANSI2KNR) $< > $@
+
+.h.krh:
+ $(ANSI2KNR) $< > $@
dist: $(DISTFILES)
- mkdir ../`cat ../.fname`/src; chmod 777 ../`cat ../.fname`/src
+ mkdir ../`cat ../distname`/src; chmod 777 ../`cat ../distname`/src
@echo "Copying distribution files"
@for file in $(DISTFILES); do \
- cp -p $(srcdir)/$$file ../`cat ../.fname`/src; \
+ cp -p $(srcdir)/$$file ../`cat ../distname`/src; \
done
+DISTFILES = $(DISTSOURCES) $(DISTMISC)
+
+distname:
+ (cd $(srcdir); pwd) | sed 's%.*/%%; s%$$%$(VERSION)%' > .distname
+
dist: $(DISTFILES)
- (cd $(srcdir); pwd) | sed 's|.*/||' > .fname
- rm -rf `cat .fname`; mkdir `cat .fname`; chmod 777 `cat .fname`
+ rm -rf `cat distname`; mkdir `cat distname`
@echo "Copying distribution files"
@for file in $(DISTFILES); do \
- cp -p $(srcdir)/$$file `cat .fname`; \
+ cp -p $(srcdir)/$$file `cat distname`; \
done
- for subdir in $(SUBDIRS); do (cd $$subdir; $(MAKE) $@); done
- chmod -R a+r `cat .fname`
- tar chozf `cat .fname`.tar.gz `cat .fname`
- rm -rf `cat .fname` .fname
+ if test -n "$(SUBDIRS)"; then \
+ for subdir in $(SUBDIRS); do (cd $$subdir; $(MAKE) $@); done;
+ fi
+ chmod -R a+r `cat distname`
+ tar -chozf `cat distname`.tar.gz `cat distname`
+ rm -rf `cat distname` distname
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+transform = @program_transform_name@
+
+ALL = ${PROGRAMS} ${LIBRARIES}
+
+all: ${ALL}
mostlyclean:
- rm -f *.o core
+ rm -f *.o *.krc *.krh core
clean: mostlyclean
- rm -f $(PROGRAMS) $(LIBRARIES) $(CLEANFILES)
+ rm -f $(PROGRAMS) $(LIBRARIES) $(TEXFILES) $(CLEANFILES)
distclean: clean
rm -f Makefile
CC = @CC@
LEX = @LEX@
YACC = @YACC@
+ANSI2KNR = ./ansi2knr
+
DEFS = @DEFS@
CFLAGS = @CFLAGS@
-.SUFFIXES:
-.SUFFIXES: .c .o
+.SUFFIXES: .c .o .krc .krh
.c.o:
$(CC) -c $(DEFS) $(CPPFLAGS) $(CFLAGS) $<
+
+.c.krc:
+ $(ANSI2KNR) $< > $@
+
+.h.krh:
+ $(ANSI2KNR) $< > $@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+transform = @program_transform_name@
+
+ALL = ${PROGRAMS} ${LIBRARIES}
+
+all: ${ALL}
rm -f lib@LIBRARY@.a
$(AR) cru lib@LIBRARY@.a $(@LIBRARY@_OBJECTS)
$(RANLIB) lib@LIBRARY@.a
+
$(INSTALL_DATA) $(srcdir)/$$man $$mdir/$$inst; \
if test -d $(catdir); then
cdir=$(mandir)/cat$$sect; \
- echo installing $$man as $$cdir/$$inst; \
+ echo formatting $$man as $$cdir/$$inst; \
$(NROFF) -man $(srcdir)/$$man > $$cdir/$$inst; \
fi; \
done
-@PROGRAM@: @PROGRAM@_OBJECTS
+@PROGRAM@: $(@PROGRAM@_OBJECTS)
+ $(CC) -o $@ $(@PROGRAM@_OBJECTS) $(LDFLAGS) $(LIBS)
+
-# For the justification of the following Makefile rules, see node
-# `Automatic Remaking' in GNU Autoconf documentation.
-Makefile: Makefile.in config.status
- CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
-config.status: configure
- ./config.status --recheck
-configure: configure.in aclocal.m4
- cd $(srcdir); autoconf
-
${CONFIG_HEADER}: stamp-h
stamp-h: ${CONFIG_HEADER}.in config.status
CONFIG_FILES= CONFIG_HEADERS=${CONFIG_HEADER} ./config.status
${CONFIG_HEADER}.in: stamp-h.in
-stamp-h.in: configure.in aclocal.m4 ac${CONFIG_HEADER}
+stamp-h.in: configure.in ${ACLOCAL} ${ACCONFIG} ${CONFIG_TOP} ${CONFIG_BOT}
cd $(srcdir); autoheader
date > $(srcdir)/stamp-h.in
done
mostlyclean-local:
- rm -f *~
clean-local: mostlyclean-local
distclean-local: clean-local
- rm -f Makefile config.cache config.h config.log config.status stamp-h
+ rm -f Makefile config.cache config.log config.status
+ rm -f ${CONFIG_H} stamp-h
realclean-local: distclean-local
TEXI2DVI = texi2dvi
infodir = $(prefix)/info
+TEXFILES = *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.log *.pg *.toc *.tp *.vr
+
.SUFFIXES: .texi .info .dvi
.texi.info:
$(MAKEINFO) $<
.texi.dvi:
$(TEXI2DVI) $<
+info: $(INFOS)
+
+dvi: $(DVIS)
+
+install:: install-info
+
install-info:
- cd $(srcdir); for file in m4.info*; do \
+ cd $(srcdir); for file in *.info*; do \
$(INSTALL_DATA) $$file $(infodir)/$$file; \
done
+uninstall:: uninstall-info
+
uninstall-info:
- rm -f $(infodir)/m4.info*
+ cd $(srcdir); for file in *.info*; do \
+ rm -f $(infodir)/$$file; \
+ done
-texclean:
- rm -f *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.log *.pg *.toc *.tp *.vr
-LIBDIR = $(exec_prefix)/lib
+libdir = $(exec_prefix)/lib
AR = ar
RANLIB = @RANLIB@
rm -f lib@LIBRARY@.a
$(AR) cru lib@LIBRARY@.a $(@LIBRARY@_OBJECTS)
$(RANLIB) lib@LIBRARY@.a
+
$(INSTALL_DATA) $(srcdir)/$$man $$mdir/$$inst; \
if test -d $(catdir); then
cdir=$(mandir)/cat$$sect; \
- echo installing $$man as $$cdir/$$inst; \
+ echo formatting $$man as $$cdir/$$inst; \
$(NROFF) -man $(srcdir)/$$man > $$cdir/$$inst; \
fi; \
done
-@PROGRAM@: @PROGRAM@_OBJECTS
+@PROGRAM@: $(@PROGRAM@_OBJECTS)
+ $(CC) -o $@ $(@PROGRAM@_OBJECTS) $(LDFLAGS) $(LIBS)
+
-CC = @CC@
-YACC = @YACC@
-DEFS = @DEFS@
-CFLAGS = @CFLAGS@
+bindir = $(exec_prefix)/bin
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
-bindir = $(exec_prefix)/bin
-transform = @program_transform_name@
+
+install:: install-programs
+
+install-programs: $(PROGRAMS)
+ for p in $(PROGRAMS); do \
+ $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed '$(transform)'`; \
+ done
+
+uninstall:: uninstall-programs
+
+uninstall-programs:
+ for p in $(PROGRAMS); do \
+ rm -f $(bindir)/`echo $$p|sed '$(transform)'`; \
+ done
-# For the justification of the following Makefile rules, see node
-# `Automatic Remaking' in GNU Autoconf documentation.
-Makefile: Makefile.in config.status
- CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
-config.status: configure
- ./config.status --recheck
-configure: configure.in aclocal.m4
- cd $(srcdir); autoconf
-
${CONFIG_HEADER}: stamp-h
stamp-h: ${CONFIG_HEADER}.in config.status
CONFIG_FILES= CONFIG_HEADERS=${CONFIG_HEADER} ./config.status
${CONFIG_HEADER}.in: stamp-h.in
-stamp-h.in: configure.in aclocal.m4 ac${CONFIG_HEADER}
+stamp-h.in: configure.in ${ACLOCAL} ${ACCONFIG} ${CONFIG_TOP} ${CONFIG_BOT}
cd $(srcdir); autoheader
date > $(srcdir)/stamp-h.in
CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
config.status: configure
./config.status --recheck
-configure: configure.in aclocal.m4
+configure: configure.in ${ACLOCAL}
cd $(srcdir); autoconf
done
mostlyclean-local:
- rm -f *~
clean-local: mostlyclean-local
distclean-local: clean-local
- rm -f Makefile config.cache config.h config.log config.status stamp-h
+ rm -f Makefile config.cache config.log config.status
+ rm -f ${CONFIG_H} stamp-h
realclean-local: distclean-local
TEXI2DVI = texi2dvi
infodir = $(prefix)/info
+TEXFILES = *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.log *.pg *.toc *.tp *.vr
+
.SUFFIXES: .texi .info .dvi
.texi.info:
$(MAKEINFO) $<
.texi.dvi:
$(TEXI2DVI) $<
+info: $(INFOS)
+
+dvi: $(DVIS)
+
+install:: install-info
+
install-info:
- cd $(srcdir); for file in m4.info*; do \
+ cd $(srcdir); for file in *.info*; do \
$(INSTALL_DATA) $$file $(infodir)/$$file; \
done
+uninstall:: uninstall-info
+
uninstall-info:
- rm -f $(infodir)/m4.info*
+ cd $(srcdir); for file in *.info*; do \
+ rm -f $(infodir)/$$file; \
+ done
-texclean:
- rm -f *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.log *.pg *.toc *.tp *.vr