automake: do not emit rule with two dependents
[automake.git] / t / distcom2.sh
blobe7816de86d56f36c98c0d76944d45b91ae92f314
1 #! /bin/sh
2 # Copyright (C) 2001-2015 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Test to make sure that depcomp and compile are added to DIST_COMMON.
18 # Report from Pavel Roskin. Report of problems with '--no-force' from
19 # Scott James Remnant (Debian #206299)
21 . test-init.sh
23 cat >> configure.ac << 'END'
24 AC_PROG_CC
25 AC_CONFIG_FILES([subdir/Makefile])
26 AC_OUTPUT
27 END
29 cat > Makefile.am << 'END'
30 SUBDIRS = subdir
31 END
33 mkdir subdir
34 : > subdir/foo.c
36 cat > subdir/Makefile.am << 'END'
37 noinst_PROGRAMS = foo
38 foo_SOURCES = foo.c
39 foo_CFLAGS = -DBAR
40 END
42 $ACLOCAL
44 for opt in '' --no-force; do
46 rm -f compile depcomp
48 $AUTOMAKE $opt --add-missing
50 test -f compile
51 test -f depcomp
53 for dir in . subdir; do
54 sed -n -e "
55 /^am__DIST_COMMON =.*/ {
56 b body
57 :loop
59 :body
61 s/\\\\$/\\\\/
62 t loop
63 s/$/ /
64 s/[$tab ][$tab ]*/ /g
66 }" $dir/Makefile.in > $dir/dc.txt
67 done
69 cat dc.txt # For debugging.
70 cat subdir/dc.txt # Likewise.
72 $FGREP ' $(top_srcdir)/depcomp ' subdir/dc.txt
73 # The 'compile' script will be listed in the DIST_COMMON of the top-level
74 # Makefile because it's required in configure.ac (by AC_PROG_CC).
75 $FGREP ' $(top_srcdir)/compile ' dc.txt || $FGREP ' compile ' dc.txt
77 done