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.
includedir = @includedir@
oldincludedir = /usr/include
-DISTDIR =
+DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
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
# 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";
# 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'})
# 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';
@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 = ();
## 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@
## 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@
includedir = @includedir@
oldincludedir = /usr/include
-DISTDIR =
+DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
info:
dvi:
check: all
- $(MAKE)
installcheck:
install-exec:
@$(NORMAL_INSTALL)
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
includedir = @includedir@
oldincludedir = /usr/include
-DISTDIR =
+DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
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