2 # Copyright (C) 2011-2018 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 <https://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.sh'.
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_DECL int yylex (void)
58 #define YY_NO_UNISTD_H 1
59 int isatty
(int fd
) { return 0; }
70 cp parsefoo.lxx parsebar.ll
72 cat > mainfoo.cc
<< 'END'
73 // This
file should contain valid C
++ but invalid C.
74 extern
"C" int yylex
(void
);
76 int main
(int argc
, char
**argv
)
81 cp mainfoo.cc mainbar.cpp
82 cp mainfoo.cc mainbaz.c
++
83 cp mainfoo.cc mainqux.cxx
91 cp config.status config.sav
97 test -f bar-parsebar.cc
101 test -f qux-parsequx.cpp
103 for target
in clean distclean
; do
107 test -f bar-parsebar.cc
108 test ! -e parsebaz.l
++
109 test ! -e parsebaz.c
++
110 test ! -e parsequx.lpp
111 test ! -e qux-parsequx.cpp
114 cp config.sav config.status
115 .
/config.status
# re-create Makefile
117 $MAKE maintainer-clean
121 test ! -e parsefoo.cxx
122 test ! -e bar-parsebar.cc
125 test ! -e parsefoo.cxx
126 test ! -e bar-parsebar.cc