]> sourceware.org Git - automake.git/commitdiff
"clean" cleanup
authorTom Tromey <tromey@redhat.com>
Mon, 1 Jun 1998 21:12:04 +0000 (21:12 +0000)
committerTom Tromey <tromey@redhat.com>
Mon, 1 Jun 1998 21:12:04 +0000 (21:12 +0000)
ChangeLog
Makefile.in
automake.in
clean.am
lib/am/clean.am
m4/Makefile.in
tests/Makefile.in

index cb4983d9e2f70ce6e5b9986da600c3079f962c59..89ccbb52229e869332455a5745653a0aa5bf77f3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 Mon Jun  1 14:23:29 1998  Tom Tromey  <tromey@cygnus.com>
 
+       * clean.am (mostlyclean-generic): Prefix rule with MOSTLYCLEAN.
+       (clean-generic): Prefix rule with CLEAN.
+       (distclean-generic): Prefix rule with DISTCLEAN.
+       (maintainer-clean-generic): Prefix rule with MAINTAINERCLEAN.
+       BUILT_SOURCES now handled in automake itself.
+
+       * automake.in (initialize_per_input): Initialize
+       maintainer_clean_files.
+       (handle_yacc_lex_cxx): Put lex and yacc output files onto
+       @maintainer_clean_files.
+       (handle_clean): Handle @maintainer_clean_files.  Transform
+       clean.am when installing; try to remove unnecessary tests in
+       generated code.
+
        * automake.in (do_check_merge_target): Only generate $(MAKE)
        command if there are check targets to make.
 
index 53c4ec16a2956be5d3b5b733a6940862d4f59c0d..f6ec9d2f43030cb99db337ba9078aa6d1ae05788 100644 (file)
@@ -32,7 +32,7 @@ mandir = @mandir@
 includedir = @includedir@
 oldincludedir = /usr/include
 
-DISTDIR =
+DESTDIR =
 
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -484,19 +484,14 @@ installdirs: installdirs-recursive
 
 
 mostlyclean-generic:
-       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
 
 clean-generic:
-       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
-       -rm -f Makefile $(DISTCLEANFILES)
+       -rm -f Makefile $(CONFIG_CLEAN_FILES)
        -rm -f config.cache config.log stamp-h stamp-h[0-9]*
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
-       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
 mostlyclean-am:  mostlyclean-vti mostlyclean-aminfo mostlyclean-tags \
                mostlyclean-generic
 
index 74fb984c55b5674e10789aedf08762701647f149..88fd5948f16f7c052e58191dc00d4cdc67e9b38c 100755 (executable)
@@ -889,8 +889,11 @@ sub handle_yacc_lex_cxx
 
            # If the files are built in the build directory, then we
            # want to remove them with `make clean'.  If they are in
-           # srcdir they shouldn't be touched.
-           push (@clean, $base . $hname, $base . $cname);
+           # srcdir they shouldn't be touched.  However, we can't
+           # determine this statically, and the GNU rules say that
+           # yacc/lex output files should be removed by
+           # maintainer-clean.  So that's what we do.
+           push (@maintainer_clean_files, $base . $hname, $base . $cname);
        }
        $output_rules .= "\n";
 
@@ -917,10 +920,13 @@ sub handle_yacc_lex_cxx
 
            # If the files are built in the build directory, then we
            # want to remove them with `make clean'.  If they are in
-           # srcdir they shouldn't be touched.
+           # srcdir they shouldn't be touched.  However, we can't
+           # determine this statically, and the GNU rules say that
+           # yacc/lex output files should be removed by
+           # maintainer-clean.  So that's what we do.
            $file =~ /^(.*)\.(l|ll|l\+\+|lxx)$/;
            ($cname = $2) =~ tr/y/c/;
-           push (@clean, $1 . $cname);
+           push (@maintainer_clean_files, $1 . $cname);
        }
 
        if (! defined $configure_vars{'LEX'})
@@ -3677,8 +3683,46 @@ sub do_check_merge_target
 # Handle all 'clean' targets.
 sub handle_clean
 {
+    local ($xform) = '';
+    local ($name);
+
+    # Don't include `MAINTAINER'; it is handled specially below.
+    foreach $name ('MOSTLY', '', 'DIST')
+    {
+       if (! &variable_defined ($name . 'CLEANFILES'))
+       {
+           $xform .= 's/^' . $name . 'CLEAN.*$//;';
+       }
+       else
+       {
+           $xform .= 's/^' . $name . 'CLEAN//;';
+       }
+    }
+
+    # Built sources are automatically removed by maintainer-clean.
+    push (@maintainer_clean_files, '$(BUILT_SOURCES')
+       if &variable_defined ('BUILT_SOURCES');
+    push (@maintainer_clean_files, '$(MAINTAINERCLEANFILES)')
+       if &variable_defined ('MAINTAINERCLEANFILES');
+    if (! @maintainer_clean_files)
+    {
+       $xform .= 's/^MAINTAINERCLEAN.*$//;';
+    }
+    else
+    {
+       $xform .= ('s/^MAINTAINERCLEAN//;'
+                  # Join with no space to avoid spurious `test -z'
+                  # success at runtime.
+                  . 's,\@MCFILES\@,' . join ('', @maintainer_clean_files)
+                  . ',;'
+                  # A space is required in the join here.
+                  . 's,\@MFILES\@,' . join (' ', @maintainer_clean_files)
+                  . ',;');
+    }
+
+    $output_rules .= &file_contents_with_transform ($xform, 'clean');
+
     push (@clean, 'generic');
-    $output_rules .= &file_contents ('clean');
     &push_phony_cleaners ('generic');
 
     local ($target) = $recursive_install ? 'clean-am' : 'clean';
@@ -5569,6 +5613,9 @@ sub initialize_per_input
 
     @phony = ();
 
+    # A list of files deleted by `maintainer-clean'.
+    @maintainer_clean_files = ();
+
     # These are pretty obvious, too.  They are used to define the
     # SOURCES and OBJECTS variables.
     @sources = ();
index c89d2d3a481c68fdaf8f413e9ef9a0b75ffc3c62..9d8bebfe922098188c7a901eb9acf87d587fe2d0 100644 (file)
--- a/clean.am
+++ b/clean.am
@@ -1,5 +1,5 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+## Copyright (C) 1994, 1995, 1996, 1998 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
 ## -rf" command looks disturbing.  Also, the Solaris 2.4 "rm" will
 ## return an error if there are no arguments other than "-f".
 mostlyclean-generic:
-       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+MOSTLYCLEAN    -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
 
 clean-generic:
-       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+CLEAN  -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
-       -rm -f Makefile $(DISTCLEANFILES)
+       -rm -f Makefile $(CONFIG_CLEAN_FILES)
        -rm -f config.cache config.log stamp-h stamp-h[0-9]*
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+DISTCLEAN      -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCONFIGCLEANFILES)
 
 maintainer-clean-generic:
-       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+MAINTAINERCLEAN        -test -z "@MCFILES@" || rm -f @MFILES@
index c89d2d3a481c68fdaf8f413e9ef9a0b75ffc3c62..9d8bebfe922098188c7a901eb9acf87d587fe2d0 100644 (file)
@@ -1,5 +1,5 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+## Copyright (C) 1994, 1995, 1996, 1998 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
 ## -rf" command looks disturbing.  Also, the Solaris 2.4 "rm" will
 ## return an error if there are no arguments other than "-f".
 mostlyclean-generic:
-       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+MOSTLYCLEAN    -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
 
 clean-generic:
-       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+CLEAN  -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
-       -rm -f Makefile $(DISTCLEANFILES)
+       -rm -f Makefile $(CONFIG_CLEAN_FILES)
        -rm -f config.cache config.log stamp-h stamp-h[0-9]*
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+DISTCLEAN      -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCONFIGCLEANFILES)
 
 maintainer-clean-generic:
-       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+MAINTAINERCLEAN        -test -z "@MCFILES@" || rm -f @MFILES@
index 1f6990ba4d4fee19dc2f23d928714fe61901a9c4..a883fc896f3326b6ee23ff7ad170cf10aad43846 100644 (file)
@@ -32,7 +32,7 @@ mandir = @mandir@
 includedir = @includedir@
 oldincludedir = /usr/include
 
-DISTDIR =
+DESTDIR =
 
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -135,7 +135,6 @@ distdir: $(DISTFILES)
 info:
 dvi:
 check: all
-       $(MAKE)
 installcheck:
 install-exec: 
        @$(NORMAL_INSTALL)
@@ -155,19 +154,14 @@ installdirs:
 
 
 mostlyclean-generic:
-       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
 
 clean-generic:
-       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
-       -rm -f Makefile $(DISTCLEANFILES)
+       -rm -f Makefile $(CONFIG_CLEAN_FILES)
        -rm -f config.cache config.log stamp-h stamp-h[0-9]*
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
-       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
 mostlyclean:  mostlyclean-generic
 
 clean:  clean-generic mostlyclean
index c77eb9a87d2470fd5d3d3d374eca8552ba53bd10..4d3650d47e2a70335288e005ebe3e5e9ac5500ca 100644 (file)
@@ -32,7 +32,7 @@ mandir = @mandir@
 includedir = @includedir@
 oldincludedir = /usr/include
 
-DISTDIR =
+DESTDIR =
 
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -182,19 +182,14 @@ installdirs:
 
 
 mostlyclean-generic:
-       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
 
 clean-generic:
-       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
-       -rm -f Makefile $(DISTCLEANFILES)
+       -rm -f Makefile $(CONFIG_CLEAN_FILES)
        -rm -f config.cache config.log stamp-h stamp-h[0-9]*
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
-       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
 mostlyclean:  mostlyclean-generic
 
 clean:  clean-generic mostlyclean
This page took 0.057976 seconds and 5 git commands to generate.