Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / overrid.test
1 #! /bin/sh
2 # Copyright (C) 2003, 2004, 2006  Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
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/>.
16
17 # Make sure automake -Woverride suggests using TARGET-local instead
18 # of TARGET when possible.
19
20 . ./defs || Exit 1
21
22 set -e
23
24 cat >> configure.in << 'END'
25 AM_CONDITIONAL([COND], [:])
26 END
27
28 cat > Makefile.am << 'END'
29 install:
30         :
31 installcheck:
32         :
33 html:
34         :
35 clean-am:
36         :
37
38 if COND
39 ps: mine
40         :
41 endif
42 END
43
44 $ACLOCAL
45 $AUTOMAKE -Wno-override
46 AUTOMAKE_fails
47 grep ':.*install-local' stderr && Exit 1 # There is no such thing as install-local
48 grep ':.*installcheck-local' stderr
49 grep ':.*html-local' stderr
50 # Make sure overriding *-am targets suggest using *-local, not *-am.
51 grep ':.*clean-am-local' stderr && Exit 1
52 grep ':.*clean-local' stderr
53
54 # Conditional overrides ought to be diagnosed, but it can't be done yet.
55 # See the FIXME in Automake::Rule::define.  Once this is fixed, the grep below
56 # will fail.  If you see the failure, it means you fixed Automake.  Well done!
57 # Just strip out the next '&& Exit 1' and this comment.
58 grep ':.*overrides.*ps' stderr && Exit 1
59
60 # Test for another issue.  Overriding html: should cause only one
61 # html: rule to be output.
62 test `grep '^html:' Makefile.in | wc -l` = 1
63
64 # ps: should be output in two conditions
65 test `grep '[^-]ps:' Makefile.in | wc -l` = 2
66 grep '@COND_TRUE@ps: mine' Makefile.in
67 grep '@COND_FALSE@ps: ps-am' Makefile.in