doc: typos in test file.
[automake.git] / t / yacc-nodist.sh
blob9699207e8673c83283e40c0b23409fbf395977af
1 #! /bin/sh
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)
7 # any later version.
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 # Checks for .c and .h files derived from non-distributed yacc sources.
18 # The test 'yacc-pr204.sh' does similar check with AM_MAINTAINER_MODE
19 # enabled.
20 # The tests 'lex-nodist.sh' and 'lex-pr204.sh' does similar checks
21 # for lex-generated .c files.
23 required='cc yacc'
24 . test-init.sh
26 cat >> configure.ac << 'END'
27 AC_PROG_CC
28 AC_PROG_YACC
29 AC_CONFIG_FILES([sub1/Makefile sub2/Makefile])
30 AC_OUTPUT
31 END
33 cat > Makefile.am << 'END'
34 AM_LFLAGS = --never-interactive
36 SUBDIRS = sub1 sub2
37 .PHONY: test-build test-dist
38 test-build: all
39 ls -l . sub1 sub2
40 test -f sub1/parse.y
41 test -f sub1/parse.c
42 test -f sub2/parse.y
43 test -f sub2/parse.c
44 test -f sub2/parse.h
45 test-dist: distdir
46 ls -l $(distdir) $(distdir)/sub1 $(distdir)/sub2
47 test ! -r $(distdir)/sub1/parse.y
48 test ! -r $(distdir)/sub1/parse.c
49 test ! -r $(distdir)/sub1/parse.h
50 test ! -r $(distdir)/sub2/parse.y
51 test ! -r $(distdir)/sub2/parse.c
52 test ! -r $(distdir)/sub2/parse.h
53 check-local: test-build test-dist
54 END
56 mkdir sub1 sub2
58 cat > sub1/Makefile.am << 'END'
59 parse.y:
60 rm -f $@ $@-t
61 :; { : \
62 && echo "%{" \
63 && echo "int yylex () { return 0; }" \
64 && echo "void yyerror (const char *s) {}" \
65 && echo "%}" \
66 && echo "%%" \
67 && echo "maude : 'm' 'a' 'u' 'd' 'e' {}"; \
68 } > $@-t
69 chmod a-w $@-t && mv -f $@-t $@
71 bin_PROGRAMS = prog
72 prog_SOURCES = main.c
73 nodist_prog_SOURCES = parse.y
74 CLEANFILES = $(nodist_prog_SOURCES)
75 END
77 cat sub1/Makefile.am - > sub2/Makefile.am << 'END'
78 AM_YFLAGS = -d
79 BUILT_SOURCES = parse.h
80 END
82 cat > sub1/main.c << 'END'
83 extern int yyparse(void);
85 int main ()
87 return yyparse ();
89 END
90 cat - sub1/main.c > sub2/main.c << 'END'
91 #include "parse.h"
92 END
94 $ACLOCAL
95 $AUTOCONF
96 $AUTOMAKE -a
98 ./configure
99 $MAKE
100 $MAKE test-build
101 $MAKE test-dist
103 yl_distcheck