summaryrefslogtreecommitdiff
path: root/t
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 /t
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>
Diffstat (limited to 't')
-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
9 files changed, 236 insertions, 27 deletions
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
: