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 'yacc-clean.sh'.
26 cat >> configure.ac
<< 'END'
29 AC_CONFIG_FILES
([sub
1/Makefile sub
2/Makefile
])
33 cat > Makefile.am
<< 'END'
34 # Use two subdirectories, one to test with '-d' in YFLAGS, the
35 # other one to test with empty YFLAGS.
41 cat > sub
1/Makefile.am
<< 'END'
42 bin_PROGRAMS
= foo bar baz qux
44 foo_SOURCES
= mainfoo.cc parsefoo.yxx
46 bar_SOURCES
= mainbar.cpp parsebar.yy
47 bar_YFLAGS
= $
(AM_YFLAGS
)
49 baz_SOURCES
= mainbaz.c
++
50 nodist_baz_SOURCES
= parsebaz.y
++
52 qux_SOURCES
= mainqux.cxx
53 nodist_qux_SOURCES
= parsequx.ypp
54 qux_YFLAGS
= $
(AM_YFLAGS
)
56 parsebaz.y
++ parsequx.ypp
:
57 cp $
(srcdir
)/parsefoo.yxx $@
59 CLEANFILES
= parsebaz.y
++ parsequx.ypp
62 cat > sub
2/Makefile.am
<< 'END'
63 include $
(top_srcdir
)/sub
1/Makefile.am
67 cat > sub
1/parsefoo.yxx
<< 'END'
69 // This
file should contain valid C
++ but invalid C.
71 // "std::" qualification required by Sun C
++ 5.9.
72 int yylex
(void
) { return std
::getchar
(); }
73 void yyerror
(const char
*s
) { return; }
78 cp sub
1/parsefoo.yxx sub
1/parsebar.yy
79 cp sub
1/parsefoo.yxx sub
2/parsefoo.yxx
80 cp sub
1/parsefoo.yxx sub
2/parsebar.yy
82 cat > sub
1/mainfoo.cc
<< 'END'
83 // This
file should contain valid C
++ but invalid C.
85 int main
(int argc
, char
**argv
)
87 extern int yyparse
(void
);
91 cp sub
1/mainfoo.cc sub
1/mainbar.cpp
92 cp sub
1/mainfoo.cc sub
1/mainbaz.c
++
93 cp sub
1/mainfoo.cc sub
1/mainqux.cxx
94 cp sub
1/main???.c
* sub2
102 cp config.status config.sav
107 test -f sub
1/parsefoo.cxx
108 test -f sub
1/bar-parsebar.cc
109 test -f sub
1/parsebaz.y
++
110 test -f sub
1/parsebaz.c
++
111 test -f sub
1/parsequx.ypp
112 test -f sub
1/qux-parsequx.cpp
113 test -f sub
2/parsefoo.cxx
114 test -f sub
2/parsefoo.hxx
115 test -f sub
2/bar-parsebar.cc
116 test -f sub
2/bar-parsebar.hh
117 test -f sub
2/parsebaz.y
++
118 test -f sub
2/parsebaz.c
++
119 test -f sub
2/parsebaz.h
++
120 test -f sub
2/parsequx.ypp
121 test -f sub
2/qux-parsequx.cpp
122 test -f sub
2/qux-parsequx.hpp
124 for target
in clean distclean
; do
127 test -f sub
1/parsefoo.cxx
128 test -f sub
1/bar-parsebar.cc
129 test ! -e sub
1/parsebaz.y
++
130 test ! -e sub
1/parsebaz.c
++
131 test ! -e sub
1/parsequx.ypp
132 test ! -e sub
1/qux-parsequx.cpp
133 test -f sub
2/parsefoo.cxx
134 test -f sub
2/parsefoo.hxx
135 test -f sub
2/bar-parsebar.cc
136 test -f sub
2/bar-parsebar.hh
137 test ! -e sub
2/parsebaz.y
++
138 test ! -e sub
2/parsebaz.c
++
139 test ! -e sub
2/parsebaz.h
++
140 test ! -e sub
2/parsequx.ypp
141 test ! -e sub
2/qux-parsequx.cpp
142 test ! -e sub
2/qux-parsequx.hpp
145 cp config.sav config.status
146 .
/config.status
# re-create Makefile
148 $MAKE maintainer-clean
150 test -f sub
1/parsefoo.yxx
151 test -f sub
1/parsebar.yy
152 test ! -e sub
1/parsefoo.cxx
153 test ! -e sub
1/bar-parsebar.cc
154 test -f sub
2/parsefoo.yxx
155 test -f sub
2/parsebar.yy
156 test ! -e sub
2/parsefoo.cxx
157 test ! -e sub
2/parsefoo.hxx
158 test ! -e sub
2/bar-parsebar.cc
159 test ! -e sub
2/bar-parsebar.hh