Handle installcheck.
authorTom Tromey <tromey@redhat.com>
Sun, 3 Dec 1995 06:12:34 +0000 (06:12 +0000)
committerTom Tromey <tromey@redhat.com>
Sun, 3 Dec 1995 06:12:34 +0000 (06:12 +0000)
Handle ## comments.
Fixlets

22 files changed:
ChangeLog
Makefile.in
README
TODO
automake.in
clean.am
depend.am
dist-subd-top.am
dist-subd.am
dist.am
distname.am [deleted file]
header-vars.am
lib/am/clean.am
lib/am/depend.am
lib/am/header-vars.am
lib/am/subdirs.am
lib/am/tags.am
lib/am/texinfos.am
subdirs.am
tags.am
texi-version.am
texinfos.am

index b8b60d6..c311c8a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+Sat Dec  2 21:39:56 1995  Tom Tromey  <tromey@cambric.colorado.edu>
+
+       * automake.in: Updated FSF address.  From Jim Meyering.
+       * header-vars.am: Updated FSF address.
+
+       * distname.am: Removed.
+
+       * automake.in (file_contents): Strip "##" comments.
+       * Various files: Added "##" comments for strange things.
+
+       * automake.in (handle_tags): Generate TAGS rule for every
+       directory.
+       
+       * subdirs.am (RECURSIVE): Include installcheck-recursive.
+       * automake.in (installcheck): New variable.
+       (generate_makefile): Initialize it.
+       (handle_subdirs): Push 'installcheck-recursive'.
+       (handle_merge_targets): Handle installcheck target.
+
 Thu Nov 30 20:13:16 1995  Tom Tromey  <tromey@cambric>
 
        * automake.in ($PACKAGE): Removed.
index c7e8eca..c0d24cf 100644 (file)
@@ -13,7 +13,8 @@
 
 # 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.
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
 
 SHELL = /bin/sh
 
@@ -71,7 +72,7 @@ INFO_DEPS = automake.info
 DVIS = automake.dvi
 
 ACLOCAL = aclocal.m4
-DIST_COMMON = Makefile.in Makefile.am version.texi stamp-vti mdate-sh texinfo.tex aclocal.m4 install-sh mkinstalldirs THANKS TODO README NEWS INSTALL ABOUT-NLS configure configure.in
+DIST_COMMON = Makefile.in Makefile.am version.texi stamp-vti mdate-sh texinfo.tex aclocal.m4 install-sh mkinstalldirs THANKS TODO README NEWS INSTALL ChangeLog configure configure.in
 
 PACKAGE = @PACKAGE@
 VERSION = @VERSION@
@@ -103,8 +104,6 @@ maintainer-clean-scripts:
 
 version.texi: stamp-vti
 
-# Depend on configure.in so that version number updates cause a
-# rebuild.
 stamp-vti: automake.texi $(top_srcdir)/configure.in
        echo "@set UPDATED `cd $(srcdir) && $(SHELL) mdate-sh automake.texi`" \
          > version.tmp
@@ -135,9 +134,6 @@ automake.info: automake.texi version.texi
 .texi.dvi:
        TEXINPUTS=$(srcdir):$$TEXINPUTS $(TEXI2DVI) $<
 
-# Look in both . and srcdir because the info pages might have been
-# rebuilt in the build directory.  Can't cd to srcdir; that might
-# break a possible install-sh reference.
 install-info: $(INFO_DEPS)
        $(top_srcdir)/mkinstalldirs $(infodir)
        for file in $(INFO_DEPS); do            \
@@ -196,6 +192,9 @@ config.status: configure
 ${srcdir}/configure: configure.in ${ACLOCAL}
        cd $(srcdir); autoconf
 
+tags: TAGS
+TAGS:
+
 distdir = $(PACKAGE)-$(VERSION)
 dist: $(DIST_FILES)
        rm -rf $(distdir)
@@ -227,6 +226,8 @@ dvi: $(DVIS)
 
 check: 
 
+installcheck: 
+
 install-exec: install-scripts
 
 install-data: install-info install-pdata
@@ -238,6 +239,8 @@ uninstall: uninstall-scripts uninstall-info uninstall-pdata
 installdirs:
        $(top_srcdir)/mkinstalldirs $(bindir) $(infodir) $(datadir)/$(PACKAGE)
 
+
+
 mostlyclean-generic:
        if test -n "$(MOSTLYCLEANFILES)"; then  \
          rm -f $(MOSTLYCLEANFILES);            \
diff --git a/README b/README
index b99935a..83d0fdc 100644 (file)
--- a/README
+++ b/README
@@ -1,28 +1,16 @@
-This is AutoMake, an experimental Makefile generator.  It was inspired
+This is Automake, an experimental Makefile generator.  It was inspired
 by the 4.4BSD make and include files, but aims to be portable and to
 conform to the GNU standards for Makefile variables and targets.
 
-automake is a shell script.  The input files are called Makefile.am.
+Automake is a Perl script.  The input files are called Makefile.am.
 The output files are called Makefile.in; they are intended for use
-with Autoconf.
+with Autoconf.  Automake requires certain things to be done in your
+configure.in.
 
 Variable assignment lines in Makefile.am pull in defaults from various
 little *.am files.
 
-To use AutoMake, replace your Makefile.in files with Makefile.am
-files.  Since there's no documentation, look at the automake script
-and the examples provided for GNU m4 1.3 and fileutils 3.9 (along with
-patches you need to apply to those packages) and time 1.6 and find and
-indent (unreleased versions).
-
-AutoMake is just a prototype at this point -- expect omissions and bugs.
-It uses only the programs that the GNU coding standards allow in
-configure scripts, because I wrote it keeping in mind the possibility
-of it becoming an Autoconf macro, so it would run at configure-time.
-That would slow configuration down a bit, but allow users to modify
-the Makefile.am without needing to fetch the AutoMake package.  And,
-the Makefile.in files wouldn't need to be distributed.  But all of
-AutoMake would.  So I might reimplement AutoMake in Perl, m4, or some
-other more appropriate language.
-
-- David MacKenzie <djm@gnu.ai.mit.edu>
+To use Automake, replace your Makefile.in files with Makefile.am
+files.  Read the documentation to see what to do.  The only currently
+valid example is in samples/cpio; the stuff in samples/old is
+obsolete.
diff --git a/TODO b/TODO
index cd42bdc..912a9db 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,6 +1,5 @@
 Top priorities:
-* Implement new where_HOW scheme.
-* Handle installcheck target
+* Implement new `where_HOW' scheme.
 * Handle installable libraries and headers
 
 Some known problems:
index 353f58c..4ffdb14 100755 (executable)
@@ -20,7 +20,8 @@ eval "exec /usr/local/bin/perl -S $0 $*"
 
 # 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.
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
 
 # Originally written by David Mackenzie <djm@gnu.ai.mit.edu>.
 # Perl reimplementation by Tom Tromey <tromey@drip.colorado.edu>.
@@ -74,6 +75,7 @@ $output_directory = '.';
 @dvi = ();
 @all = ();
 @check = ();
+@installcheck = ();
 @clean = ();
 
 # TRUE if current directory holds any C source files.
@@ -233,6 +235,7 @@ sub generate_makefile
     @dvi = ();
     @all = ();
     @check = ();
+    @installcheck = ();
     @clean = ();
 
     # Generate header before reading .am file.  The header must come
@@ -665,6 +668,13 @@ sub handle_tags
        $output_rules .= &file_contents ('tags-clean');
        push (@clean, 'tags');
     }
+    else
+    {
+       # Every Makefile must define some sort of TAGS rule.
+       # Otherwise, it would be possible for a top-level "make TAGS"
+       # to fail because some subdirectory failed.
+       $output_rules .= "tags: TAGS\nTAGS:\n\n";
+    }
 }
 
 # Handle 'dist' target.
@@ -745,6 +755,7 @@ sub handle_subdirs
 
     push (@all, "all-recursive");
     push (@check, "check-recursive");
+    push (@installcheck, "installcheck-recursive");
     push (@info, "info-recursive");
     push (@dvi, "dvi-recursive");
 
@@ -855,6 +866,7 @@ sub handle_merge_targets
     &do_one_merge_target ('info', @info);
     &do_one_merge_target ('dvi', @dvi);
     &do_one_merge_target ('check', @check);
+    &do_one_merge_target ('installcheck', @installcheck);
 
     # Handle the various install targets specially.  We do this so
     # that (eg) "make install-exec" will run "install-exec-recursive"
@@ -1179,12 +1191,15 @@ sub file_contents
        exit 1;
     }
 
-    # Yes, we really want to slurp it.
-    local ($results) = join ('', <FC_FILE>);
-
+    # Lines starting with "##" are comments for developer use only.
+    # Maybe this is a bad idea?
+    local ($result) = '';
+    while (<FC_FILE>)
+    {
+       $result .= $_ unless ( m/^##/);
+    }
     close (FC_FILE);
-
-    return $results;
+    return $result;
 }
 
 # Return contents of some Makefile.am variable.  Allow for AM_ style
index 2b5adbe..74e7765 100644 (file)
--- a/clean.am
+++ b/clean.am
@@ -1,3 +1,10 @@
+## We must test each macro because it might be empty, and an empty
+## "rm -rf" command looks disturbing.
+
+## Each "if" must always have an else because, in some versions of sh,
+## "if" will return false if the test fails and there is no else
+## clause.  Bogus!
+
 mostlyclean-generic:
        if test -n "$(MOSTLYCLEANFILES)"; then  \
          rm -f $(MOSTLYCLEANFILES);            \
index 96e72b4..faf5e0d 100644 (file)
--- a/depend.am
+++ b/depend.am
@@ -6,6 +6,9 @@ MKDEP = gcc -MM
 
 DEP_FILES = $(patsubst %.o,.deps/%.P,$(OBJECTS))
 
+## We use ".P" as the name of our placeholder because it can't be
+## duplicated by any C source file.  (Well, there could be ".c", but
+## no one does that in practice)
 -include .deps/.P
 .deps/.P:
        test -d .deps || mkdir .deps
index 84e37bd..b7dfbf2 100644 (file)
@@ -4,6 +4,12 @@ dist: $(DIST_FILES)
        mkdir $(distdir)
        (cd $(srcdir); automake --include-deps --output-dir=$(distdir))
        @for file in $(DIST_FILES); do          \
+## Test for file existence because sometimes a file gets included in
+## DIST_FILES twice.  For example this happens when a single source
+## file is used in building more than one program.  Also, there are
+## situations in which "ln" can fail.  For instance a file to
+## distribute could actually be a cross-filesystem symlink -- this can
+## easily happen if "gettextize" was run on the distribution.
          test -f $(distdir)/$$file || {        \
            echo linking $$file;                \
            ln $(srcdir)/$$file $(distdir)/$$file; \
@@ -13,12 +19,15 @@ dist: $(DIST_FILES)
          };                                    \
        done
        for subdir in $(SUBDIRS); do            \
+## Test for directory existence here because previous automake
+## invocation might have created some directories.
          test -d $(distdir)/$$subdir           \
          || mkdir $(distdir)/$$subdir          \
          || exit 1;                            \
          chmod 777 $(distdir)/$$subdir;        \
          (cd $$subdir; $(MAKE) $@) || exit 1;  \
        done
+## Set "sublist" here because shells fail on "for dir in ; do".
        @sublist="$(DIST_SUBDIRS)";             \
        for dir in $$sublist; do                \
          echo copying directory $$dir;         \
index 65d564a..4497676 100644 (file)
@@ -1,6 +1,7 @@
 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
 dist: $(DIST_FILES)
        @for file in $(DIST_FILES); do          \
+## See dist-subd-top.am to understand this.
          test -f $(distdir)/$$file || {        \
            echo linking $$file;                \
            ln $(srcdir)/$$file $(distdir)/$$file; \
diff --git a/dist.am b/dist.am
index f8d5f52..a397e26 100644 (file)
--- a/dist.am
+++ b/dist.am
@@ -1,3 +1,4 @@
+## See dist-subd-top.am to understand this file.
 distdir = $(PACKAGE)-$(VERSION)
 dist: $(DIST_FILES)
        rm -rf $(distdir)
diff --git a/distname.am b/distname.am
deleted file mode 100644 (file)
index bf20f30..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-distname:
-       (cd $(srcdir); pwd) | sed 's%.*/%%; s%$$%$(VERSION)%' > $@
-
index ba4c767..6823e7f 100644 (file)
@@ -12,7 +12,8 @@
 
 # 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.
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
 
 SHELL = /bin/sh
 
@@ -35,6 +36,10 @@ mandir = @mandir@
 includedir = @includedir@
 oldincludedir = /usr/include
 
+## Some derived variables that have been found to be useful.
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+
 INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
index 2b5adbe..74e7765 100644 (file)
@@ -1,3 +1,10 @@
+## We must test each macro because it might be empty, and an empty
+## "rm -rf" command looks disturbing.
+
+## Each "if" must always have an else because, in some versions of sh,
+## "if" will return false if the test fails and there is no else
+## clause.  Bogus!
+
 mostlyclean-generic:
        if test -n "$(MOSTLYCLEANFILES)"; then  \
          rm -f $(MOSTLYCLEANFILES);            \
index 96e72b4..faf5e0d 100644 (file)
@@ -6,6 +6,9 @@ MKDEP = gcc -MM
 
 DEP_FILES = $(patsubst %.o,.deps/%.P,$(OBJECTS))
 
+## We use ".P" as the name of our placeholder because it can't be
+## duplicated by any C source file.  (Well, there could be ".c", but
+## no one does that in practice)
 -include .deps/.P
 .deps/.P:
        test -d .deps || mkdir .deps
index ba4c767..6823e7f 100644 (file)
@@ -12,7 +12,8 @@
 
 # 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.
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
 
 SHELL = /bin/sh
 
@@ -35,6 +36,10 @@ mandir = @mandir@
 includedir = @includedir@
 oldincludedir = /usr/include
 
+## Some derived variables that have been found to be useful.
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+
 INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
index 98a2274..e5356ab 100644 (file)
@@ -9,14 +9,17 @@
 
 RECURSIVE = all-recursive install-data-recursive install-exec-recursive \
 installdirs-recursive install-recursive uninstall-recursive \
-check-recursive info-recursive dvi-recursive mostlyclean-recursive \
-clean-recursive distclean-recursive maintainer-clean-recursive
+check-recursive installcheck-recursive info-recursive dvi-recursive \
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive
 
 $(RECURSIVE):
        for subdir in $(SUBDIRS); do            \
          target=`echo $@ | sed s/-recursive//`; \
          echo making $$target in $$subdir;     \
          (cd $$subdir; $(MAKE) $$target)       \
+## This trick allows "-k" to keep its natural meaning when running a
+## recursive rule.
           || case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \
        done && test -z "$$fail"
 
index 6709f35..e294d53 100644 (file)
@@ -4,6 +4,7 @@ TAGS:
        tags=;                                  \
        here=`pwd`;                             \
        for subdir in $(SUBDIRS); do            \
+## Never fail here if a subdir fails.
          (cd $$subdir && $(MAKE) TAGS);        \
          if test -f $$subdir/TAGS; then        \
            tags="$$tags -i $$here/$$subdir/TAGS"; \
@@ -11,6 +12,8 @@ TAGS:
            true;                               \
          fi;                                   \
        done;                                   \
+## Make sure we have something to run etags on.  See clean.am to
+## understand "if...else" braindamage.
        if test -n "$(ETAGS_ARGS)$(CONFIG_HEADER)$(SOURCES)$(HEADERS)$$tags"; \
        then                                    \
          etags $(ETAGS_ARGS) $$tags $(CONFIG_HEADER) $(SOURCES) $(HEADERS); \
index 538e403..1874d54 100644 (file)
@@ -4,9 +4,9 @@
 .texi.dvi:
        TEXINPUTS=$(srcdir):$$TEXINPUTS $(TEXI2DVI) $<
 
-# Look in both . and srcdir because the info pages might have been
-# rebuilt in the build directory.  Can't cd to srcdir; that might
-# break a possible install-sh reference.
+## Look in both . and srcdir because the info pages might have been
+## rebuilt in the build directory.  Can't cd to srcdir; that might
+## break a possible install-sh reference.
 install-info: $(INFO_DEPS)
        $(top_srcdir)/mkinstalldirs $(infodir)
        for file in $(INFO_DEPS); do            \
index 98a2274..e5356ab 100644 (file)
@@ -9,14 +9,17 @@
 
 RECURSIVE = all-recursive install-data-recursive install-exec-recursive \
 installdirs-recursive install-recursive uninstall-recursive \
-check-recursive info-recursive dvi-recursive mostlyclean-recursive \
-clean-recursive distclean-recursive maintainer-clean-recursive
+check-recursive installcheck-recursive info-recursive dvi-recursive \
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive
 
 $(RECURSIVE):
        for subdir in $(SUBDIRS); do            \
          target=`echo $@ | sed s/-recursive//`; \
          echo making $$target in $$subdir;     \
          (cd $$subdir; $(MAKE) $$target)       \
+## This trick allows "-k" to keep its natural meaning when running a
+## recursive rule.
           || case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \
        done && test -z "$$fail"
 
diff --git a/tags.am b/tags.am
index 6709f35..e294d53 100644 (file)
--- a/tags.am
+++ b/tags.am
@@ -4,6 +4,7 @@ TAGS:
        tags=;                                  \
        here=`pwd`;                             \
        for subdir in $(SUBDIRS); do            \
+## Never fail here if a subdir fails.
          (cd $$subdir && $(MAKE) TAGS);        \
          if test -f $$subdir/TAGS; then        \
            tags="$$tags -i $$here/$$subdir/TAGS"; \
@@ -11,6 +12,8 @@ TAGS:
            true;                               \
          fi;                                   \
        done;                                   \
+## Make sure we have something to run etags on.  See clean.am to
+## understand "if...else" braindamage.
        if test -n "$(ETAGS_ARGS)$(CONFIG_HEADER)$(SOURCES)$(HEADERS)$$tags"; \
        then                                    \
          etags $(ETAGS_ARGS) $$tags $(CONFIG_HEADER) $(SOURCES) $(HEADERS); \
index bd59f0a..62b5d44 100644 (file)
@@ -1,7 +1,7 @@
 version.texi: stamp-vti
 
-# Depend on configure.in so that version number updates cause a
-# rebuild.
+## Depend on configure.in so that version number updates cause a
+## rebuild.
 stamp-vti: @TEXI@ $(top_srcdir)/configure.in
        echo "@set UPDATED `cd $(srcdir) && $(SHELL) mdate-sh @TEXI@`" \
          > version.tmp
index 538e403..1874d54 100644 (file)
@@ -4,9 +4,9 @@
 .texi.dvi:
        TEXINPUTS=$(srcdir):$$TEXINPUTS $(TEXI2DVI) $<
 
-# Look in both . and srcdir because the info pages might have been
-# rebuilt in the build directory.  Can't cd to srcdir; that might
-# break a possible install-sh reference.
+## Look in both . and srcdir because the info pages might have been
+## rebuilt in the build directory.  Can't cd to srcdir; that might
+## break a possible install-sh reference.
 install-info: $(INFO_DEPS)
        $(top_srcdir)/mkinstalldirs $(infodir)
        for file in $(INFO_DEPS); do            \