+2003-11-22 Alexandre Duret-Lutz <adl@gnu.org>
+
+ Fix for PR automake/411:
+ * automake.in (rewrite_inputs_into_dependencies): Simplify, and rename
+ into ...
+ (prepend_srcdir): ... this.
+ (rewrite_inputs_into_dependencies): New function, extracted from ...
+ (handle_configure): ... here. Adjust to use prepend_srcdir
+ or rewrite_inputs_into_dependencies where needed. Especially,
+ using (the new) rewrite_inputs_into_dependencies to compute
+ Makefile dependencies will fix PR/411.
+ * lib/am/configure.am (DIST_COMMON): Remove %MAKEFILE-IN%, it's
+ already distributed by rewrite_inputs_into_dependencies.
+ * tests/Makefile.am (TESTS): Add output10.test, remove distcom.test.
+ * tests/colon3.test: Use set -e. Don't allow any AUTOMAKE
+ invocation refer to zardoz. Make sure two.in and three.in
+ appear as $(srcdir)/two.in and $(srcdir)/three.in dependencies.
+ * tests/distcom.test: Delete. This is covered by tests/output9.test.
+ * tests/output10.test: New file, for PR/411.
+
2003-11-21 Alexandre Duret-Lutz <adl@gnu.org>
* automake.in (append_exeext): Do not append $(EXEEXT) to
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = .
-DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.in \
- $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL \
- Makefile.am NEWS THANKS TODO configure configure.ac
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \
+ ChangeLog INSTALL NEWS THANKS TODO configure configure.ac
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \
$(top_srcdir)/m4/auxdir.m4 $(top_srcdir)/m4/init.m4 \
.SUFFIXES:
am--refresh:
@:
-$(srcdir)/Makefile.in: Makefile.am $(am__configure_deps)
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
}
-# @DEPENDENCY
-# &rewrite_inputs_into_dependencies ($ADD_SRCDIR, @INPUTS)
-# --------------------------------------------------------
-# Rewrite a list of input files into a form suitable to put on a
-# dependency list. The idea is that if an input file has a directory
-# part the same as the current directory, then the directory part is
-# simply removed. But if the directory part is different, then
-# $(top_srcdir) is prepended. Among other things, this is used to
-# generate the dependency list for the output files generated by
-# AC_OUTPUT. Consider what the dependencies should look like in this
-# case:
-# AC_OUTPUT(src/out:src/in1:lib/in2)
-# If the first argument, ADD_SRCDIR, is non-zero (e.g. 1), $(top_srcdir)
-# is added to files which are not in the current directory.
-# If ADD_SRCDIR is a filename and the filename occurs in INPUTS, it
-# will be prefixed with $(srcdir) unless already prefixed by $(top_srcdir)
-# by the above rule.
-sub rewrite_inputs_into_dependencies ($@)
-{
- my ($add_srcdir, @inputs) = @_;
+# @DEPENDENCIES
+# &prepend_srcdir (@INPUTS)
+# -------------------------
+# Prepend $(srcdir) or $(top_srcdir) to all @INPUTS. The idea is that
+# if an input file has a directory part the same as the current
+# directory, then the directory part is simply replaced by $(srcdir).
+# But if the directory part is different, then $(top_srcdir) is
+# prepended.
+sub prepend_srcdir (@)
+{
+ my @inputs = @_;
my @newinputs;
foreach my $single (@inputs)
{
if (dirname ($single) eq $relative_dir)
{
- push (@newinputs,
- ($add_srcdir eq $single ? '$(srcdir)/' : '')
- . basename ($single));
+ push (@newinputs, '$(srcdir)/' . basename ($single));
}
else
{
- push (@newinputs,
- ($add_srcdir ? '$(top_srcdir)/' : '') . $single);
+ push (@newinputs, '$(top_srcdir)/' . $single);
}
}
return @newinputs;
}
+# @DEPENDENCIES
+# rewrite_inputs_into_dependencies ($OUTPUT, @INPUTS)
+# ---------------------------------------------------
+# Compute a list of dependencies appropriate for the rebuild
+# rule of
+# AC_CONFIG_FILES($OUTPUT:$INPUT[0]:$INPUTS[1]:...)
+# Also distribute $INPUTs which are not build by another AC_CONFIG_FILES.
+sub rewrite_inputs_into_dependencies ($@)
+{
+ my ($file, @inputs) = @_;
+ my @res = ();
+
+ for my $i (@inputs)
+ {
+ if (exists $ac_config_files_location{$i})
+ {
+ if (dirname ($i) eq $relative_dir)
+ {
+ $i = basename $i;
+ }
+ else
+ {
+ $i = '$(top_builddir)/' . $i;
+ }
+ }
+ else
+ {
+ msg ('error', $ac_config_files_location{$file},
+ "required file `$i' not found")
+ unless exists $output_files{$i} || -f $i;
+ ($i) = prepend_srcdir ($i);
+ push_dist_common ($i);
+ }
+ push @res, $i;
+ }
+ return @res;
+}
+
+
# &handle_configure ($MAKEFILE_AM, $MAKEFILE_IN, $MAKEFILE, @INPUTS)
# ------------------------------------------------------------------
prog_error 'empty @inputs'
unless @inputs;
- my ($rel_makefile_am) = rewrite_inputs_into_dependencies (1, $makefile_am);
- my ($rel_makefile_in) = rewrite_inputs_into_dependencies ($makefile_in,
+ my ($rel_makefile_am, $rel_makefile_in) = prepend_srcdir ($makefile_am,
$makefile_in);
my $rel_makefile = basename $makefile;
my $colon_infile = ':' . join (':', @inputs);
$colon_infile = '' if $colon_infile eq ":$makefile.in";
- my @rewritten = rewrite_inputs_into_dependencies ($makefile_in, @inputs);
+ my @rewritten = rewrite_inputs_into_dependencies ($makefile, @inputs);
my ($regen_aclocal_m4, @aclocal_m4_deps) = scan_aclocal_m4;
define_pretty_variable ('am__aclocal_m4_deps', TRUE, INTERNAL,
@configure_deps, @aclocal_m4_deps,
{
error $config_header_location, "required file `$in' not found"
unless -f $in;
- push_dist_common (rewrite_inputs_into_dependencies (1, $in));
+ push_dist_common (prepend_srcdir ($in));
}
- @ins = rewrite_inputs_into_dependencies (1, @ins);
+ @ins = prepend_srcdir (@ins);
# Header defined and in this directory.
my @files;
}
}
- # An input file is either output by some other AC_CONFIG_FILES,
- # or it must exist and be relative to $(top_srcdir). In the
- # latter case, we distribute it; in the former, we should not.
- my @rewritten_inputs = ();
- for my $i (@inputs)
- {
- if (exists $ac_config_files_location{$i})
- {
- if (dirname ($i) eq $relative_dir)
- {
- $i = basename $i;
- }
- else
- {
- $i = '$(top_builddir)/' . $i;
- }
- }
- else
- {
- msg ('error', $ac_config_files_location{$file},
- "required file `$i' not found")
- unless -f $i;
- ($i) = rewrite_inputs_into_dependencies (1, $i);
- push_dist_common ($i);
- }
- push @rewritten_inputs, $i;
- }
+ my @rewritten_inputs = rewrite_inputs_into_dependencies ($file, @inputs);
$output_rules .= ($local . ': '
. '$(top_builddir)/config.status '
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = doc
+DIST_COMMON = $(automake_TEXINFOS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(srcdir)/stamp-vti \
+ $(srcdir)/version.texi
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \
$(top_srcdir)/m4/auxdir.m4 $(top_srcdir)/m4/init.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-DIST_COMMON = $(automake_TEXINFOS) $(srcdir)/Makefile.in \
- $(srcdir)/stamp-vti $(srcdir)/version.texi Makefile.am
mkinstalldirs = $(SHELL) $(top_srcdir)/lib/mkinstalldirs
CONFIG_CLEAN_FILES =
SOURCES =
.SUFFIXES:
.SUFFIXES: .dvi .html .info .pdf .ps .texi
-$(srcdir)/Makefile.in: Makefile.am $(am__configure_deps)
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = lib/Automake
+DIST_COMMON = $(dist_perllib_DATA) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \
$(top_srcdir)/m4/auxdir.m4 $(top_srcdir)/m4/init.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-DIST_COMMON = $(dist_perllib_DATA) $(srcdir)/Makefile.in Makefile.am
mkinstalldirs = $(SHELL) $(top_srcdir)/lib/mkinstalldirs
CONFIG_CLEAN_FILES =
SOURCES =
all: all-recursive
.SUFFIXES:
-$(srcdir)/Makefile.in: Makefile.am $(am__configure_deps)
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = lib/Automake/tests
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \
$(top_srcdir)/m4/auxdir.m4 $(top_srcdir)/m4/init.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
mkinstalldirs = $(SHELL) $(top_srcdir)/lib/mkinstalldirs
CONFIG_CLEAN_FILES =
SOURCES =
all: all-am
.SUFFIXES:
-$(srcdir)/Makefile.in: Makefile.am $(am__configure_deps)
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = lib
+DIST_COMMON = $(dist_pkgvdata_DATA) $(dist_script_DATA) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in COPYING INSTALL \
+ ansi2knr.1 ansi2knr.c compile config.guess config.sub depcomp \
+ elisp-comp install-sh mdate-sh missing mkinstalldirs \
+ py-compile texinfo.tex ylwrap
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \
$(top_srcdir)/m4/auxdir.m4 $(top_srcdir)/m4/init.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-DIST_COMMON = $(dist_pkgvdata_DATA) $(dist_script_DATA) \
- $(srcdir)/Makefile.in COPYING INSTALL Makefile.am ansi2knr.1 \
- ansi2knr.c compile config.guess config.sub depcomp elisp-comp \
- install-sh mdate-sh missing mkinstalldirs py-compile \
- texinfo.tex ylwrap
mkinstalldirs = $(SHELL) $(top_srcdir)/lib/mkinstalldirs
CONFIG_CLEAN_FILES =
SOURCES =
all: all-recursive
.SUFFIXES:
-$(srcdir)/Makefile.in: Makefile.am $(am__configure_deps)
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = lib/am
+DIST_COMMON = $(dist_am_DATA) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \
$(top_srcdir)/m4/auxdir.m4 $(top_srcdir)/m4/init.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-DIST_COMMON = $(dist_am_DATA) $(srcdir)/Makefile.in Makefile.am
mkinstalldirs = $(SHELL) $(top_srcdir)/lib/mkinstalldirs
CONFIG_CLEAN_FILES =
SOURCES =
all: all-am
.SUFFIXES:
-$(srcdir)/Makefile.in: Makefile.am $(am__configure_deps)
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(SHELL) ./config.status %CONFIG-MAKEFILE% $(am__depfiles_maybe);; \
esac;
-DIST_COMMON += %MAKEFILE-AM% %MAKEFILE-IN%
+DIST_COMMON += %MAKEFILE-AM%
## --------------------------- ##
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = m4
+DIST_COMMON = $(dist_m4data_DATA) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \
$(top_srcdir)/m4/auxdir.m4 $(top_srcdir)/m4/init.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-DIST_COMMON = $(dist_m4data_DATA) $(srcdir)/Makefile.in Makefile.am
mkinstalldirs = $(SHELL) $(top_srcdir)/lib/mkinstalldirs
CONFIG_CLEAN_FILES =
SOURCES =
all: all-am
.SUFFIXES:
-$(srcdir)/Makefile.in: Makefile.am $(am__configure_deps)
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
dirforbid.test \
dirlist.test \
discover.test \
-distcom.test \
distcom2.test \
distcom3.test \
distcom4.test \
output7.test \
output8.test \
output9.test \
+output10.test \
overrid.test \
parse.test \
percent.test \
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = tests
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/aclocal.in $(srcdir)/automake.in $(srcdir)/defs.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \
$(top_srcdir)/m4/auxdir.m4 $(top_srcdir)/m4/init.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-DIST_COMMON = README $(srcdir)/Makefile.in Makefile.am aclocal.in \
- automake.in defs.in
mkinstalldirs = $(SHELL) $(top_srcdir)/lib/mkinstalldirs
CONFIG_CLEAN_FILES = defs aclocal-${APIVERSION} automake-${APIVERSION}
SOURCES =
dirforbid.test \
dirlist.test \
discover.test \
-distcom.test \
distcom2.test \
distcom3.test \
distcom4.test \
output7.test \
output8.test \
output9.test \
+output10.test \
overrid.test \
parse.test \
percent.test \
all: all-am
.SUFFIXES:
-$(srcdir)/Makefile.in: Makefile.am $(am__configure_deps)
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-defs: $(top_builddir)/config.status defs.in
+defs: $(top_builddir)/config.status $(srcdir)/defs.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-aclocal-${APIVERSION}: $(top_builddir)/config.status aclocal.in
+aclocal-${APIVERSION}: $(top_builddir)/config.status $(srcdir)/aclocal.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-automake-${APIVERSION}: $(top_builddir)/config.status automake.in
+automake-${APIVERSION}: $(top_builddir)/config.status $(srcdir)/automake.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
uninstall-info-am:
tags: TAGS
#! /bin/sh
-# Copyright (C) 1996, 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003
+# Free Software Foundation, Inc.
#
# This file is part of GNU Automake.
#
. ./defs || exit 1
+set -e
+
cat > configure.in << 'END'
AC_INIT
AM_INIT_AUTOMAKE(nonesuch, nonesuch)
: > two.in
: > three.in
-$ACLOCAL || exit 1
-$AUTOMAKE || exit 1
+$ACLOCAL
+$AUTOMAKE
# We actually check several things here.
# Automake should have created zardoz.in.
-test -f zardoz.in || exit 1
+test -f zardoz.in
# The generated file should refer to zardoz.in and zardoz.am, but
-# never just "zardoz" -- except the actual automake invocation can
-# refer to it (don't ask).
+# never just "zardoz".
echo Grep1
-grep zardoz zardoz.in | $FGREP -v 'zardoz.in' | $FGREP -v 'zardoz.am' \
- | $FGREP -v AUTOMAKE > O
+grep zardoz zardoz.in | $EGREP -v 'zardoz.in' | $FGREP -v 'zardoz.am' > O || :
# We cat the output file so we see in when verbose.
cat O
-test -z "`cat O`" || exit 1
+test -z "`cat O`"
# Makefile should depend on two.in.
echo Grep2
-grep '^Makefile:.* two.in' zardoz.in || exit 1
+grep '^Makefile:.* \$(srcdir)/two.in' zardoz.in
# Likewise three.in.
echo Grep3
-grep '^Makefile:.* three.in' zardoz.in
+grep '^Makefile:.* \$(srcdir)/three.in' zardoz.in
#! /bin/sh
-# Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+# Copyright (C) 2003 Free Software Foundation, Inc.
#
# This file is part of GNU Automake.
#
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
-# A test for failure to include files provided in AC_OUTPUT into
-# DIST_COMMON
-# From Derek R. Price.
+# Make sure an AC_CONFIG_FILES can have an AC_CONFIG_FILES output as input.
+# This is comparable to output9.test, but testing Makefile rules.
+# PR/411
. ./defs || exit 1
-cat > configure.in << EOF
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_OUTPUT(subdir/bar \
- Makefile \
- subdir/Makefile)
-EOF
+set -e
+
+cat >> configure.in << END
+AC_SUBST([FOO], [top])
+AC_SUBST([BAR], [bot])
+AC_CONFIG_FILES([a/top])
+AC_CONFIG_FILES([a/bot])
+AC_CONFIG_FILES([b/Makefile:a/top:b/Makefile.in:a/bot])
+AC_OUTPUT
+END
-: > Makefile.am
+mkdir a
+mkdir b
-mkdir subdir
-: > subdir/Makefile.am
-: > subdir/bar.in
+cat >Makefile.am <<\EOF
+SUBDIRS = b
+dist-hook:
+ test ! -f $(distdir)/a/top
+ test ! -f $(distdir)/a/bot
+EOF
+
+cat >b/Makefile.am <<\EOF
+output:
+ echo $(TOP)$(BOT) > ok
+EOF
-$ACLOCAL || exit 1
-$AUTOMAKE || exit 1
+echo TOP=@FOO@ >a/top.in
+echo BOT=@BAR@ >a/bot.in
-# verify bar.in
-grep 'DIST_COMMON.*bar.in' subdir/Makefile.in || exit 1
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
-exit 0
+mkdir build
+cd build
+../configure
+cd b
+$MAKE output
+grep topbot ok
+cd ..
+$MAKE distcheck