+2001-05-08 Tom Tromey <tromey@redhat.com>
+
+ Fixes test subobj6.test and PR automake/160:
+ * tests/Makefile.am (XFAIL_TESTS): Removed subobj6.test.
+ * compile.am (mostlyclean-compile): Added MOSTLYRMS.
+ (distclean-compile): Added DISTRMS.
+ * tests/subobj6.test (wish_SOURCES): Updated to reflect
+ `mostlyclean' use; added test for non-subdir case.
+ * automake.in (compile_clean_files): New global.
+ (MOSTLY_CLEAN, DIST_CLEAN): New constants.
+ (initialize_per_input): Initialize compile_clean_files.
+ (handle_single_transform_list): Set compile_clean_files entries.
+ (handle_compile): Handle compilation cleanups.
+
2001-05-08 Lars J. Aas <larsa@sim.no>
* automake.texi (Canonicalizing Automake macros): Document not
my $AC_CANONICAL_HOST = 1;
my $AC_CANONICAL_SYSTEM = 2;
+# Values indicating when something should be cleaned. Right now we
+# only need to handle `mostly'- and `dist'-clean; add more as
+# required.
+my $MOSTLY_CLEAN = 0;
+my $DIST_CLEAN = 1;
+
# Files installed by libtoolize.
my @libtoolize_files = ('ltmain.sh', 'config.guess', 'config.sub');
# ltconfig appears here for compatibility with old versions of libtool.
# A list of files deleted by `maintainer-clean'.
my @maintainer_clean_files;
+# Keys in this hash table are object files or other files in
+# subdirectories which need to be removed. This only holds files
+# which are created by compilations. The value in the hash indicates
+# when the file should be removed.
+my %compile_clean_files;
+
# These are pretty obvious, too. They are used to define the
# SOURCES and OBJECTS variables.
my @sources;
@var_list = ();
$get_object_extension_was_run = 0;
+
+ %compile_clean_files = ();
}
&am_error ("`$full' contains `..' component but should not");
}
+ # Make sure object is removed by `make mostlyclean'.
+ $compile_clean_files{$object} = $MOSTLY_CLEAN;
+
push (@dep_list, $directory . '/.dirstamp');
# If we're generating dependencies, we also want
if (! defined $directory_map{$directory})
{
$directory_map{$directory} = 1;
+
+ # Directory must be removed by `make distclean'.
+ $compile_clean_files{$directory . "/.dirstamp"} =
+ $DIST_CLEAN;
$output_rules .= ($directory . "/.dirstamp:\n"
. "\t\@\$(mkinstalldirs) $directory\n"
. "\t\@: > $directory/.dirstamp\n");
}
}
+ my (@mostly_rms, @dist_rms);
+ foreach my $item (sort keys %compile_clean_files)
+ {
+ if ($compile_clean_files{$item} == $MOSTLY_CLEAN)
+ {
+ push (@mostly_rms, "\t-rm -f $item");
+ }
+ elsif ($compile_clean_files{$item} == $DIST_CLEAN)
+ {
+ push (@dist_rms, "\t-rm -f $item");
+ }
+ else
+ {
+ &prog_error ("invalid entry in \%compile_clean_files");
+ }
+ }
+
my ($coms, $vars, $rules) =
&file_contents_internal (1, "$am_dir/compile.am",
- ('DEFAULT_INCLUDES' => $default_includes));
+ ('DEFAULT_INCLUDES' => $default_includes,
+ 'MOSTLYRMS' => join ("\n", @mostly_rms),
+ 'DISTRMS' => join ("\n", @dist_rms)));
$output_vars .= $vars;
$output_rules .= "$coms$rules";
#! /bin/sh
-# Test of subdir make dist rules.
+# Test of subdir make distclean rules.
# From Robert Collins
. $srcdir/defs || exit 1
cat > configure.in << 'END'
-AC_INIT(generic/a.c)
+AC_INIT(f)
AM_INIT_AUTOMAKE(nonesuch, nonesuch)
AM_PROG_CC_C_O
AC_PROG_CC
wish_SOURCES = generic/a.c
END
+# The ac-init file.
+: > f
+
mkdir generic
cat > generic/a.c << 'END'
#include <stdio.h>
../configure
$MAKE
-$MAKE distclean
+$MAKE mostlyclean
test -f generic/a.o && exit 1
+
+$MAKE distclean
test -f generic/.dirstamp && exit 1
-exit 0
+cd ..
+
+# Now test without the subdir.
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = subdir-objects
+bin_PROGRAMS = wish
+wish_SOURCES = a.c
+END
+
+mv generic/a.c a.c
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --include-deps --copy --add-missing
+
+mkdir build2
+cd build2
+
+../configure
+$MAKE
+$MAKE mostlyclean