summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2015-01-06 22:03:06 +0100
committerStefano Lattarini <stefano.lattarini@gmail.com>2015-01-06 22:43:20 +0100
commit8f3a565e9a708298be5e6fa136210c3ef4f5163d (patch)
tree7776ec837bb30604786784d7ddb4b87c8d145d69
parent9fb499a9b6f4ee175ba8a8d7d00bd756e4242173 (diff)
parent6357a630dc3cac6682a0f17b255104b4dd78f89a (diff)
downloadautomake-8f3a565e9a708298be5e6fa136210c3ef4f5163d.tar.gz
Merge branch 'master' into ng/master (bug#13928 fixed by this)
Part of this merge is actually a no-op, since we had already fixed Automake-NG so that the 'subdir-object' option (enabled by default) would work when foo_SOURCES contains $(var). OTOH, even Automake-NG suffered of the bug where built object files, as well as dependency-tracking makefile fragments, could be placed in $(srcdir) when a source file was specified as '$(srdir)/foo.c' or '$(top_srcdir)/bar.c'. See bug#16375 and bug#15293. * master: deps: fix corner-case "make distclean" bug compile: don't place built object files in $(srcdir), ever ... tests: fix some bugs in an XFAILing test deps: 'subdir-object' option now works when foo_SOURCES contains $(var) NEWS: fix a typo Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
-rw-r--r--NEWS45
-rw-r--r--PLANS/subdir-objects.txt10
-rw-r--r--THANKS1
-rw-r--r--bin/automake.in47
-rw-r--r--t/Makefile.inc1
-rw-r--r--t/depcomp8a.sh13
-rw-r--r--t/depcomp8b.sh8
-rw-r--r--t/extra-sources.sh2
-rw-r--r--t/lex-depend-cxx.sh6
-rw-r--r--t/lex-depend-grep.sh2
-rw-r--r--t/subobj-indir-pr13928.sh4
-rw-r--r--t/subobj-pr13928-more-langs.sh138
-rw-r--r--t/subobj-vpath-pr13928.sh89
13 files changed, 317 insertions, 49 deletions
diff --git a/NEWS b/NEWS
index 7cdf3049e..539ce0f4a 100644
--- a/NEWS
+++ b/NEWS
@@ -140,6 +140,49 @@ New in 2.0:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+New in 1.16:
+
+* Bugs fixed:
+
+ - Automatic dependency tracking has been fixed to work also when the
+ 'subdir-object' option is used and some 'foo_SOURCES' definition
+ contains unexpanded references to make variables, as in, e.g.:
+
+ a_src = sources/libs/aaa
+ b_src = sources/bbb
+ foo_SOURCES = $(a_src)/bar.c $(b_src)/baz.c
+
+ With such a setup, the created makefile fragment containing dependency
+ tracking information will be correctly placed under the directories
+ named 'sources/libs/aaa/.deps' and 'sources/bbb/.deps', rather than
+ mistakenly under directories named (literally!) '$(src_a)/.deps' and
+ '$(src_b)/.deps' (this was the first part of automake bug#13928).
+
+ Notice that in order to fix this bug we had to slightly change the
+ semantics of how config.status bootstraps the makefile fragments
+ required for the dependency tracking to work: rather than attempting
+ to parse the Makefiles via grep and sed trickeries only, we actually
+ invoke 'make' on a slightly preprocessed version of those Makefiles,
+ using a private target that is only meant to bootstrap the required
+ makefile fragments.
+
+ - The 'subdir-object' option no longer causes object files corresponding
+ to source files specified with an explicit '$(srcdir)' component to be
+ placed in the source tree rather than in the build tree.
+
+ For example, if Makefile.am contains:
+
+ AUTOMAKE_OPTIONS = subdir-objects
+ foo_SOURCES = $(srcdir)/foo.c $(srcdir)/s/bar.c $(top_srcdir)/baz.c
+
+ then "make all" will create 'foo.o' and 's/bar.o' in $(builddir) rather
+ than in $(srcdir), and will create 'baz.o' in $(top_builddir) rather
+ than in $(top_srcdir).
+
+ This was the second part of automake bug#13928.
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
New in 1.15:
* Improvements and refactorings in the install-sh script:
@@ -160,7 +203,7 @@ New in 1.15:
* Automake-generated testsuites:
- - The default test-driver used by the Automake-generates testsuites
+ - The default test-driver used by the Automake-generated testsuites
now appends the result and exit status of each "plain" test to the
associated log file (automake bug#11814).
diff --git a/PLANS/subdir-objects.txt b/PLANS/subdir-objects.txt
index 3cf610124..c849e338e 100644
--- a/PLANS/subdir-objects.txt
+++ b/PLANS/subdir-objects.txt
@@ -5,9 +5,6 @@ We want to make the behaviour currently enabled by the 'subdir-objects'
the default one, and in fact the *only* one, in Automake 2.0.
See automake bug#13378: <http://debbugs.gnu.org/13378>.
-Sadly, **THIS IS IMPOSSIBLE** until automake bug#13928 is resolved:
-http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13928
-
Details
-------
@@ -53,11 +50,10 @@ We also make sure to avoid the warning when it would be irrelevant, i.e.,
if all source files sit in "current" directory (thanks to Peter Johansson
for suggesting this).
-For some automake 1.x (*before* 2.0 can be released)
-----------------------------------------------------
+For automake 1.16 (*before* 2.0 can be released)
+------------------------------------------------
-Find a proper way to fix the blocking automake bug#13928:
-http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13928
+Submit the pending patch series that fixes http://debbugs.gnu.org/13928
For automake 2.0
----------------
diff --git a/THANKS b/THANKS
index b66f744f3..8b87d585b 100644
--- a/THANKS
+++ b/THANKS
@@ -192,6 +192,7 @@ Joel N. Weber II nemo@koa.iolani.honolulu.hi.us
Joerg-Martin Schwarz jms@jms.prima.ruhr.de
Johan Dahlin jdahlin@async.com.br
Johan Danielsson joda@pdc.kth.se
+Johan Kristensen johankristensen@gmail.com
Johannes Nicolai johannes.nicolai@student.hpi.uni-potsdam.de
John Calcote john.calcote@gmail.com
John F Trudeau JohnTrudeau@firsthealth.com
diff --git a/bin/automake.in b/bin/automake.in
index 7b3d1c9c4..b55b5080d 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -1453,9 +1453,9 @@ sub handle_single_transform
my $renamed = 0;
my ($linker, $object);
- # This records whether we've seen a derived source file (e.g.
- # yacc output).
- my $derived_source = 0;
+ # This records whether we've seen a derived source file (e.g., yacc
+ # or lex output).
+ my $derived_source;
# This holds the 'aggregate context' of the file we are
# currently examining. If the file is compiled with
@@ -1506,17 +1506,36 @@ sub handle_single_transform
# Now extract linker and other info.
$linker = $lang->linker;
- my $this_obj_ext;
- if (defined $source_extension)
- {
- $this_obj_ext = $source_extension;
- $derived_source = 1;
- }
- else
- {
- $this_obj_ext = $obj;
- }
- $object = $base . $this_obj_ext;
+ my $this_obj_ext;
+ if (defined $source_extension)
+ {
+ $this_obj_ext = $source_extension;
+ $derived_source = 1;
+ }
+ else
+ {
+ $this_obj_ext = $obj;
+ $derived_source = 0;
+ # Don't ever place built object files in $(srcdir),
+ # even when sources are specified explicitly as (say)
+ # '$(srcdir)/foo.c' or '$(top_srcdir)/foo.c'.
+ # See automake bug#13928.
+ my @d = split '/', $directory;
+ if (@d > 0 && option 'subdir-objects')
+ {
+ my $d = $d[0];
+ if ($d eq '$(srcdir)' or $d eq '${srcdir}')
+ {
+ shift @d;
+ }
+ elsif ($d eq '$(top_srcdir)' or $d eq '${top_srcdir}')
+ {
+ $d[0] = '$(top_builddir)';
+ }
+ $directory = join '/', @d;
+ }
+ }
+ $object = $base . $this_obj_ext;
if ($have_per_exec_flags)
{
diff --git a/t/Makefile.inc b/t/Makefile.inc
index 15f0a523b..c3e72fc7e 100644
--- a/t/Makefile.inc
+++ b/t/Makefile.inc
@@ -96,7 +96,6 @@ XFAIL_TESTS = \
%D%/remake-timing-bug-pr8365.sh \
%D%/remake-am-pr10111.sh \
%D%/remake-m4-pr10111.sh \
- %D%/subobj-vpath-pr13928.sh \
%D%/var-undef-append.sh \
$(perl_fake_XFAIL_TESTS)
diff --git a/t/depcomp8a.sh b/t/depcomp8a.sh
index c9d49107f..2190800dc 100644
--- a/t/depcomp8a.sh
+++ b/t/depcomp8a.sh
@@ -48,14 +48,11 @@ int bar (void)
END
$ACLOCAL
-# FIXME: stop disabling the warnings in the 'unsupported' category
-# FIXME: once the 'subdir-objects' option has been mandatory.
-$AUTOMAKE -a -Wno-unsupported
-grep include Makefile.in # For debugging.
-grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in
-
-LC_ALL=C grep 'include.*[^a-zA-Z0-9_/]sub/\$(DEPDIR)/bar\.P' Makefile.in
-$EGREP 'include.*/(\.|sub)/\$\(DEPDIR\)' Makefile.in && exit 1
+$AUTOMAKE -a
+grep '\.P' Makefile.in # For debugging.
+grep '\./\$(DEPDIR)/foo\.Po' Makefile.in
+grep '[^a-zA-Z0-9_/]sub/\$(DEPDIR)/bar\.Po' Makefile.in
+$EGREP '/(\.|sub)/\$\(DEPDIR\)' Makefile.in && exit 1
$AUTOCONF
# Don't reject slower dependency extractors, for better coverage.
diff --git a/t/depcomp8b.sh b/t/depcomp8b.sh
index 25a945ada..7395b5bc5 100644
--- a/t/depcomp8b.sh
+++ b/t/depcomp8b.sh
@@ -42,10 +42,10 @@ libtoolize
$ACLOCAL
$AUTOMAKE -a
-grep include Makefile.in # For debugging.
-LC_ALL=C grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in
-LC_ALL=C grep 'include.*[^a-zA-Z0-9_/]sub/\$(DEPDIR)/bar\.P' Makefile.in
-$EGREP 'include.*/(\.|sub)/\$\(DEPDIR\)' Makefile.in && exit 1
+grep '\.P' Makefile.in # For debugging.
+grep '\./\$(DEPDIR)/foo\.Plo' Makefile.in
+grep '[^a-zA-Z0-9_/]sub/\$(DEPDIR)/bar\.Plo' Makefile.in
+$EGREP '/(\.|sub)/\$\(DEPDIR\)' Makefile.in && exit 1
$AUTOCONF
# Don't reject slower dependency extractors, for better coverage.
diff --git a/t/extra-sources.sh b/t/extra-sources.sh
index 2ff7f8b47..ffea3f5b6 100644
--- a/t/extra-sources.sh
+++ b/t/extra-sources.sh
@@ -21,7 +21,7 @@
echo AC_PROG_CC >> configure.ac
-cat > Makefile.am << 'END'
+cat > Makefile.am <<'END'
bin_PROGRAMS = www
www_SOURCES = www.c
EXTRA_www_SOURCES = xtra.c
diff --git a/t/lex-depend-cxx.sh b/t/lex-depend-cxx.sh
index 5412e9c9f..3e2821f1d 100644
--- a/t/lex-depend-cxx.sh
+++ b/t/lex-depend-cxx.sh
@@ -83,6 +83,12 @@ $AUTOCONF
./configure --enable-dependency-tracking
$MAKE
+
+# For debugging.
+for f in $(find . -name '*.Po'); do
+ cat $f
+done
+
$MAKE test-deps-exist
$sleep
diff --git a/t/lex-depend-grep.sh b/t/lex-depend-grep.sh
index dedea2d31..70e5cb8d2 100644
--- a/t/lex-depend-grep.sh
+++ b/t/lex-depend-grep.sh
@@ -40,7 +40,7 @@ $AUTOMAKE -a
$EGREP '([mj]oe|_[01234]|include|\.P)' Makefile.in # For debugging.
for x in joe moe _0 _1 _2 _3 _4; do
- grep "include.*$x\.Po" Makefile.in
+ $EGREP '\$\(DEPDIR\)/'"$x"'\.Po( |$)' Makefile.in
done
:
diff --git a/t/subobj-indir-pr13928.sh b/t/subobj-indir-pr13928.sh
index afad53b21..9a7116d35 100644
--- a/t/subobj-indir-pr13928.sh
+++ b/t/subobj-indir-pr13928.sh
@@ -38,7 +38,9 @@ END
mkdir s
echo 'int main(void) { return 0; }' > s/foo.c
-$ACLOCAL && $AUTOCONF && $AUTOMAKE -a || fatal_ "autotools failed"
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
./configure
$MAKE
diff --git a/t/subobj-pr13928-more-langs.sh b/t/subobj-pr13928-more-langs.sh
new file mode 100644
index 000000000..323e24899
--- /dev/null
+++ b/t/subobj-pr13928-more-langs.sh
@@ -0,0 +1,138 @@
+#! /bin/sh
+# Copyright (C) 2015 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Expose part of automake bug#13928, also for non-C languages: if the
+# subdir-objects option is in use and a source file is listed in a
+# _SOURCES variable with a leading $(srcdir) component, Automake will
+# generate a Makefile that tries to create the corresponding object
+# file in $(srcdir) as well.
+
+required='cc c++ fortran77 fortran'
+. test-init.sh
+
+cat >> configure.ac <<'END'
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_F77
+AC_PROG_FC
+AM_CONDITIONAL([OBVIOUS], [:])
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+AUTOMAKE_OPTIONS = subdir-objects
+SUBDIRS = sub
+
+LESS = m/o/r/e
+
+noinst_PROGRAMS = test test2
+test_SOURCES = $(srcdir)/test.f90
+
+test2_SOURCES = $(indir)
+
+indir = ${indir2} $(empty)
+indir2 =
+if OBVIOUS
+indir2 += ${srcdir}/$(LESS)///test.f
+else
+endif
+
+test-objs:
+ ls -la @srcdir@ .
+ :
+ test ! -f @srcdir@/test.$(OBJEXT)
+ test -f test.$(OBJEXT)
+ test ! -f @srcdir@/m/o/r/e/test.$(OBJEXT)
+ test -f m/o/r/e/test.$(OBJEXT)
+ :
+ test ! -f @srcdir@/bar.$(OBJEXT)
+ test -f bar.$(OBJEXT)
+ test ! -f @srcdir@/baz.$(OBJEXT)
+ test -f baz.$(OBJEXT)
+ :
+ test ! -d @srcdir@/$(DEPDIR)
+ test ! -d @srcdir@/m/o/r/e/$(DEPDIR)
+ test -d $(DEPDIR)
+ test -d m/o/r/e/$(DEPDIR)
+
+check-local: test-objs
+END
+
+mkdir sub
+cat > sub/Makefile.am <<'END'
+AUTOMAKE_OPTIONS = subdir-objects
+bin_PROGRAMS = foo
+foo = baz
+foo_SOURCES = foo.h \
+ $(top_srcdir)/bar.cc \
+ ${top_srcdir}/$(foo).c
+END
+
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+mkfiles='Makefile.in sub/Makefile.in'
+$EGREP '(test|ba[rz])\.|DEPDIR|dirstamp|srcdir' $mkfiles # For debugging.
+$EGREP '\$.(top_)?srcdir./(test|ba[rz]|\$.foo.)\.[o$]' $mkfiles && exit 1
+$FGREP '\$.(top_)?srcdir./.*$(am__dirstamp)' $mkfiles && exit 1
+$FGREP '\$.(top_)?srcdir./.*$(DEPDIR)' $mkfiles && exit 1
+
+cat > test.f90 <<'EOF'
+ program foo
+ stop
+ end
+EOF
+
+mkdir -p m/o/r/e
+cp test.f90 m/o/r/e/test.f
+
+cat > sub/foo.h <<'END'
+#ifdef __cplusplus
+extern "C"
+#endif
+int foo (void);
+END
+
+cat > bar.cc <<'END'
+#include "foo.h"
+#include <iostream>
+int main (void)
+{
+ std::cout << "OK!" << "\n";
+ return foo ();
+}
+END
+
+cat > baz.c <<'END'
+#include "foo.h"
+int foo (void)
+{
+ return 0;
+}
+END
+
+mkdir build
+cd build
+../configure
+
+$MAKE
+$MAKE test-objs
+$MAKE distcheck
+
+:
diff --git a/t/subobj-vpath-pr13928.sh b/t/subobj-vpath-pr13928.sh
index a10d65776..a7db9d8ad 100644
--- a/t/subobj-vpath-pr13928.sh
+++ b/t/subobj-vpath-pr13928.sh
@@ -22,39 +22,106 @@
required=cc
. test-init.sh
-cat >> configure.ac << 'END'
+cat >> configure.ac <<'END'
AC_PROG_CC
AM_PROG_CC_C_O
+AM_CONDITIONAL([OBVIOUS], [:])
+AC_CONFIG_FILES([sub/Makefile])
AC_OUTPUT
END
cat > Makefile.am <<'END'
AUTOMAKE_OPTIONS = subdir-objects
-noinst_PROGRAMS = test
+SUBDIRS = sub
+
+LESS = more
+
+noinst_PROGRAMS = test test2
test_SOURCES = $(srcdir)/test.c
+
+test2_SOURCES = $(indir)
+
+indir =
+if OBVIOUS
+indir += ${srcdir}/$(LESS)/test.c
+else
+endif
+
test-objs:
- test ! -f $(srcdir)/test.$(OBJEXT)
+ ls -la @srcdir@ .
+ :
+ test ! -f @srcdir@/test.$(OBJEXT)
test -f test.$(OBJEXT)
+ test ! -f @srcdir@/more/test.$(OBJEXT)
+ test -f more/test.$(OBJEXT)
+ :
+ test ! -f @srcdir@/bar.$(OBJEXT)
+ test -f bar.$(OBJEXT)
+ test ! -f @srcdir@/baz.$(OBJEXT)
+ test -f baz.$(OBJEXT)
+ :
+ test ! -d @srcdir@/$(DEPDIR)
+ test ! -d @srcdir@/more/$(DEPDIR)
+ test -d $(DEPDIR)
+ test -d more/$(DEPDIR)
+
+check-local: test-objs
+END
+
+mkdir sub
+cat > sub/Makefile.am <<'END'
+AUTOMAKE_OPTIONS = subdir-objects
+bin_PROGRAMS = foo
+foo_SOURCES = foo.h \
+ $(top_srcdir)/bar.c \
+ ${top_srcdir}/baz.c
+END
+
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+mkfiles='Makefile.in sub/Makefile.in'
+$EGREP '(test|ba[rz])\.|DEPDIR|dirstamp|srcdir' $mkfiles # For debugging.
+$EGREP '\$.(top_)?srcdir./(test|ba[rz])\.[o$]' $mkfiles && exit 1
+$FGREP '\$.(top_)?srcdir./.*$(am__dirstamp)' $mkfiles && exit 1
+$FGREP '\$.(top_)?srcdir./.*$(DEPDIR)' $mkfiles && exit 1
+
+cat > test.c <<'END'
+int main (void)
+{
+ return 0;
+}
END
-$ACLOCAL && $AUTOCONF && $AUTOMAKE -a || fatal_ "autotools failed"
+mkdir more
+cp test.c more/test.c
-$EGREP 'test\.|DEPDIR|dirstamp|srcdir' Makefile.in || : # For debugging.
-$EGREP '\$.srcdir./test\.[o$]' Makefile.in && exit 1
-$FGREP '$(srcdir)/$(am__dirstamp)' Makefile.in && exit 1
-$FGREP '$(srcdir)/$(DEPDIR)' && exit 1
+echo 'int foo (void);' > sub/foo.h
-cat > test.c << 'END'
+cat > bar.c <<'END'
+#include "foo.h"
int main (void)
{
+ return foo ();
+}
+END
+
+cat > baz.c <<'END'
+#include "foo.h"
+int foo (void)
+{
return 0;
}
END
-mkdir build && cd build || fatal "preparation of build directory failed"
-../configure || fatal_ "./configure failed"
+mkdir build
+cd build
+../configure
$MAKE
$MAKE test-objs
+$MAKE distcheck
: