2 # Copyright (C) 2011-2012 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)
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 # Check that C++ source and header files derived from non-distributed
18 # Yacc sources are cleaned by "make clean", while C++ source and
19 # header files derived from distributed Yacc sources are cleaned by
20 # "make maintainer-clean".
21 # See also sister test 'lex-clean.test'.
26 cat >> configure.ac << 'END'
32 cat > Makefile.am << 'END'
33 bin_PROGRAMS = foo bar baz qux
35 foo_SOURCES = mainfoo.cc parsefoo.lxx
37 bar_SOURCES = mainbar.cpp parsebar.ll
38 bar_LFLAGS = $(AM_LFLAGS)
40 baz_SOURCES = mainbaz.c++
41 nodist_baz_SOURCES = parsebaz.l++
43 qux_SOURCES = mainqux.cxx
44 nodist_qux_SOURCES = parsequx.lpp
45 qux_LFLAGS = $(AM_LFLAGS)
47 parsebaz.l++ parsequx.lpp:
48 cp $(srcdir)/parsefoo.lxx $@
50 CLEANFILES = parsebaz.l++ parsequx.lpp
55 cat > parsefoo.lxx << 'END'
57 #define YY_NO_UNISTD_H 1
58 int isatty (int fd) { return 0; }
69 cp parsefoo.lxx parsebar.ll
71 cat > mainfoo.cc << 'END'
72 // This file should contain valid C++ but invalid C.
74 int main (int argc, char **argv)
76 extern int yylex (void);
80 cp mainfoo.cc mainbar.cpp
81 cp mainfoo.cc mainbaz.c++
82 cp mainfoo.cc mainqux.cxx
90 cp config.status config.sav
96 test -f bar-parsebar.cc
100 test -f qux-parsequx.cpp
102 for target in clean distclean; do
106 test -f bar-parsebar.cc
107 test ! -r parsebaz.l++
108 test ! -r parsebaz.c++
109 test ! -r parsequx.lpp
110 test ! -r qux-parsequx.cpp
113 cp config.sav config.status
114 ./config.status # re-create Makefile
116 $MAKE maintainer-clean
120 test ! -r parsefoo.cxx
121 test ! -r bar-parsebar.cc
124 test ! -r parsefoo.cxx
125 test ! -r bar-parsebar.cc