2 # Copyright (C) 2011-2024 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 and .h files derived from non-distributed .y sources
18 # are cleaned by "make clean", while .c and .h files derived from
19 # distributed .y sources are cleaned by "make maintainer-clean".
20 # See also sister test 'yacc-cxx-clean.sh'.
25 cat >> configure.ac
<< 'END'
28 AC_CONFIG_FILES
([sub
1/Makefile sub
2/Makefile
])
32 cat > Makefile.am
<< 'END'
33 # Use two subdirectories, one to test with '-d' in YFLAGS, the
34 # other one to test with empty YFLAGS.
40 cat > sub
1/Makefile.am
<< 'END'
41 AM_LFLAGS
= --never-interactive
43 bin_PROGRAMS
= foo bar baz qux
45 foo_SOURCES
= main.c parse.y
47 bar_SOURCES
= main.c parse.y
48 bar_YFLAGS
= $
(AM_YFLAGS
)
51 nodist_baz_SOURCES
= baz.y
54 nodist_qux_SOURCES
= baz.y
55 qux_YFLAGS
= $
(AM_YFLAGS
)
58 cp $
(srcdir
)/parse.y $@
63 cat > sub
2/Makefile.am
<< 'END'
64 include $
(top_srcdir
)/sub
1/Makefile.am
68 cat > sub
1/parse.y
<< 'END'
72 int yylex
() { return (getchar
()); }
73 void yyerror
(const char
*s
) {}
78 cp sub
1/parse.y sub
2/parse.y
80 cat > sub
1/main.c
<< 'END'
81 extern int yyparse
(void
);
88 cp sub
1/main.c sub
2/main.c
96 cp config.status config.sav
103 test -f sub
1/bar-parse.c
106 test -f sub
1/qux-baz.c
110 test -f sub
2/bar-parse.c
111 test -f sub
2/bar-parse.h
115 test -f sub
2/qux-baz.c
116 test -f sub
2/qux-baz.h
118 for target
in clean distclean
; do
123 test -f sub
1/bar-parse.c
126 test ! -e sub
1/qux-baz.c
130 test -f sub
2/bar-parse.c
131 test -f sub
2/bar-parse.h
135 test ! -e sub
2/qux-baz.c
136 test ! -e sub
2/qux-baz.h
139 cp config.sav config.status
140 .
/config.status
# Re-create 'Makefile'.
142 $MAKE maintainer-clean
145 test ! -e sub
1/parse.c
146 test ! -e sub
1/bar-parse.c
148 test ! -e sub
2/parse.c
149 test ! -e sub
2/parse.h
150 test ! -e sub
2/bar-parse.c
151 test ! -e sub
2/bar-parse.h