Merge branch 'minor'
[automake.git] / t / yacc-dry.sh
blobd76f26ffe0d68e4931f8d3ba718ddf58e688a013
1 #! /bin/sh
2 # Copyright (C) 2010-2017 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 <https://www.gnu.org/licenses/>.
17 # Removal recovery rules for headers should not remove files with 'make -n'.
19 required='cc yacc'
20 . test-init.sh
22 cat >> configure.ac << 'END'
23 AC_PROG_CC
24 AC_PROG_YACC
25 AC_OUTPUT
26 END
28 cat > Makefile.am << 'END'
29 AM_YFLAGS = -d
30 bin_PROGRAMS = foo
31 foo_SOURCES = foo.c parse.y
32 END
34 cat > foo.c << 'END'
35 int main () { return 0; }
36 END
38 cat > parse.y << 'END'
40 int yylex () { return 0; }
41 void yyerror (char *s) {}
44 foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
45 END
47 $ACLOCAL
48 $AUTOMAKE --add-missing
49 $AUTOCONF
50 ./configure
51 $MAKE
53 rm -f parse.h
54 $MAKE -n parse.h
55 test -f parse.c
56 test ! -e parse.h