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 files derived from non-distributed Lex sources
18 # are cleaned by "make clean", while C++ source files derived from
19 # distributed Lex sources are cleaned by "make maintainer-clean".
20 # See also sister test 'lex-clean.test'.
25 cat >> configure.ac << 'END'
31 cat > Makefile.am << 'END'
32 bin_PROGRAMS = foo bar baz qux
34 foo_SOURCES = mainfoo.cc parsefoo.lxx
36 bar_SOURCES = mainbar.cpp parsebar.ll
37 bar_LFLAGS = $(AM_LFLAGS)
39 baz_SOURCES = mainbaz.c++
40 nodist_baz_SOURCES = parsebaz.l++
42 qux_SOURCES = mainqux.cxx
43 nodist_qux_SOURCES = parsequx.lpp
44 qux_LFLAGS = $(AM_LFLAGS)
46 parsebaz.l++ parsequx.lpp:
47 cp $(srcdir)/parsefoo.lxx $@
49 CLEANFILES = parsebaz.l++ parsequx.lpp
54 cat > parsefoo.lxx << 'END'
56 #define YY_NO_UNISTD_H 1
57 int isatty (int fd) { return 0; }
68 cp parsefoo.lxx parsebar.ll
70 cat > mainfoo.cc << 'END'
71 // This file should contain valid C++ but invalid C.
73 int main (int argc, char **argv)
75 extern int yylex (void);
79 cp mainfoo.cc mainbar.cpp
80 cp mainfoo.cc mainbaz.c++
81 cp mainfoo.cc mainqux.cxx
89 cp config.status config.sav
95 test -f bar-parsebar.cc
99 test -f qux-parsequx.cpp
101 for target in clean distclean; do
105 test -f bar-parsebar.cc
106 test ! -e parsebaz.l++
107 test ! -e parsebaz.c++
108 test ! -e parsequx.lpp
109 test ! -e qux-parsequx.cpp
112 cp config.sav config.status
113 ./config.status # re-create Makefile
115 $MAKE maintainer-clean
119 test ! -e parsefoo.cxx
120 test ! -e bar-parsebar.cc
123 test ! -e parsefoo.cxx
124 test ! -e bar-parsebar.cc