5183b571cf050a3da1d305b9ece67e2db1238f3f
[platform/upstream/automake.git] / tests / colon3.test
1 #! /bin/sh
2 # Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2010, 2011 Free
3 # Software Foundation, Inc.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 # Make sure ":" works with files automake generates.
19 # This test is for multiple ":"s.
20 # See also sister test `colon2.test'.
21
22 . ./defs || Exit 1
23
24 cat > configure.in <<END
25 AC_INIT([$me], [1.0])
26 AM_INIT_AUTOMAKE
27 AC_CONFIG_FILES([Makefile:zardoz.in:two.in:three.in])
28 AC_OUTPUT
29 END
30
31 cat > zardoz.am <<END
32 .PHONY: dummy
33 dummy:
34 END
35
36 : > two.in
37 : > three.in
38
39 $ACLOCAL
40 $AUTOMAKE
41
42 # Automake should have created zardoz.in.
43 test -f zardoz.in
44
45 # The generated file should refer to zardoz.in and zardoz.am, but
46 # never just "zardoz".
47 $FGREP 'zardoz.am' zardoz.in
48 $FGREP 'zardoz.in' zardoz.in
49 sed -e 's|zardoz\.am|zrdz.am|g' \
50     -e 's|zardoz\.in|zrdz.in|g' \
51   <zardoz.in | $FGREP 'zardoz' && Exit 1
52
53 # The configure-generated Makefile should depend on zardoz.in, two.in and
54 # three.in.  The automake-generated zardoz.in should depend on zardoz.am.
55 # Let's do this check the right way by running configure and make.
56
57 str='%% ZaR DoZ %%'
58 str2='// 2_TwO_2 //'
59 str3='== @thr33@ =='
60
61 $AUTOCONF
62 ./configure
63 test -f Makefile # Sanity check.
64
65 $MAKE dummy
66 # Again, make sure that the generated Makefile do not unduly
67 # refer to `zardoz' .
68 $MAKE -n zardoz && Exit 1
69
70 $sleep
71 cat >> zardoz.am <<END
72 check-local: testam testin testmk test2 test3
73 .PHONY: testam testin test2 testmk test3
74 testam:
75         grep '$str' \$(srcdir)/zardoz.am
76 testin:
77         grep '$str' \$(srcdir)/zardoz.in
78 testmk:
79         grep '$str' Makefile
80 test2:
81         grep '$str2' \$(srcdir)/two.in
82 test3:
83         grep '$str3' \$(srcdir)/three.in
84 END
85 echo "# $str2" >> two.in
86 echo "# $str3" >> three.in
87 $MAKE Makefile # For non-GNU make.
88 $MAKE testam testin testmk test2 test3
89
90 $MAKE distcheck
91
92 :