maint: update copyright year for 2013 (in branch maint)
[platform/upstream/automake.git] / t / yflags-cmdline-override.sh
1 #! /bin/sh
2 # Copyright (C) 2011-2013 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 # Check that automake can cope with user-redefinition of $(YFLAGS)
18 # at configure time and/or at make time.
19
20 required='cc yacc'
21 . test-init.sh
22
23 unset YFLAGS || :
24
25 cat >> configure.ac <<'END'
26 AC_PROG_CC
27 AC_PROG_YACC
28 AC_OUTPUT
29 END
30
31 cat > Makefile.am <<'END'
32 bin_PROGRAMS = foo
33 foo_SOURCES = foo.y
34 # A minor automake wart: automake doesn't generate code to clean
35 # '*.output' files generated by yacc (it's not even clear if that
36 # would be useful in general, so it's probably better to be
37 # conservative).
38 CLEANFILES = foo.output
39 # Another automake wart: '-d' flag won't be given at automake time,
40 # so automake won't be able to generate code to clean 'foo.h' :-(
41 MAINTAINERCLEANFILES = foo.h
42 END
43
44 cat > foo.y << 'END'
45 %{
46 int yylex () { return 0; }
47 void yyerror (char *s) { return; }
48 int main () { return 0; }
49 %}
50 %%
51 foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
52 END
53
54 $ACLOCAL
55 $AUTOMAKE -a
56 $AUTOCONF
57
58 ./configure YFLAGS='-d -v'
59 $MAKE
60 ls -l
61 test -f foo.c
62 test -f foo.h
63 test -f foo.output
64
65 $MAKE maintainer-clean
66 ls -l
67
68 ./configure YFLAGS='-v'
69 $MAKE
70 ls -l
71 test -f foo.c
72 test ! -e foo.h
73 test -f foo.output
74
75 $MAKE maintainer-clean
76 ls -l
77
78 ./configure YFLAGS='-v'
79 YFLAGS=-d $MAKE -e
80 ls -l
81 test -f foo.c
82 test -f foo.h
83 test ! -e foo.output
84
85 $MAKE maintainer-clean
86 ls -l
87
88 :