glr2.cc: put glr_state_set and glr_stack_item in unnamed namespace
[bison.git] / doc / local.mk
bloba8aa2088c9141521d0bf626d99f8356a4bc83291
1 ## Copyright (C) 2001-2003, 2005-2015, 2018-2021 Free Software
2 ## 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 3 of the License, or
7 ## (at your option) any later version.
8 ##
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 AM_MAKEINFOFLAGS = \
18 --no-split \
19 --set-customization-variable=SECTION_NAME_IN_TITLE=true \
20 --set-customization-variable=AVOID_MENU_REDUNDANCY=true \
21 --set-customization-variable=ICONS=true
23 info_TEXINFOS = %D%/bison.texi
24 %C%_bison_TEXINFOS = \
25 $(CROSS_OPTIONS_TEXI) \
26 %D%/fdl.texi \
27 %D%/gpl-3.0.texi \
28 %D%/relocatable.texi
30 # Cannot express dependencies directly on file names because of Automake.
31 # Obfuscate with a variable.
32 %C%_bison = %D%/bison
33 $(%C%_bison).dvi: $(FIGS_GV:.gv=.eps)
34 $(%C%_bison).info: $(FIGS_GV:.gv=.txt)
35 $(%C%_bison).pdf: $(FIGS_GV:.gv=.pdf)
36 $(%C%_bison).html: $(FIGS_GV:.gv=.svg)
38 TEXI2DVI = texi2dvi --build-dir=%D%/bison.t2d -I %D%
39 CLEANDIRS += %D%/bison.t2d
41 MOSTLYCLEANFILES += $(top_srcdir)/%D%/*.tmp
43 CROSS_OPTIONS_PL = $(top_srcdir)/build-aux/cross-options.pl
44 CROSS_OPTIONS_TEXI = $(top_srcdir)/%D%/cross-options.texi
45 $(CROSS_OPTIONS_TEXI): %D%/bison.help $(CROSS_OPTIONS_PL)
46 # Create $@~ which is the previous contents. Don't use 'mv' here so
47 # that even if we are interrupted, the file is still available for
48 # diff in the next run. Note that $@ might not exist yet.
49 $(AM_V_GEN){ test ! -f $@ || cat $@; } >$@~
50 $(AM_V_at)test ! -f $@.tmp || rm -f $@.tmp
51 $(AM_V_at)$(PERL) $(CROSS_OPTIONS_PL) $(top_srcdir)/src/scan-gram.l \
52 <$(top_srcdir)/%D%/bison.help >$@.tmp
53 $(AM_V_at)diff -u $@~ $@.tmp || true
54 $(AM_V_at)mv $@.tmp $@
55 MAINTAINERCLEANFILES = $(CROSS_OPTIONS_TEXI)
58 # Fix Info's @code in @deftype
59 # https://lists.gnu.org/r/help-texinfo/2019-11/msg00004.html
60 all-local: $(srcdir)/$(%C%_bison).info.bak
61 $(srcdir)/$(%C%_bison).info.bak: $(srcdir)/$(%C%_bison).info
62 $(AM_V_GEN) $(PERL) -pi.bak -0777 \
63 -e 's{(^ --.*\n(?: {10}.*\n)*)}' \
64 -e '{' \
65 -e ' $$def = $$1;' \
66 -e ' $$def =~ s/‘|’//g;' \
67 -e ' $$def;' \
68 -e '}gem;' $(srcdir)/$(%C%_bison).info
69 @ touch $@
70 EXTRA_DIST += $(srcdir)/$(%C%_bison).info.bak
71 MAINTAINERCLEANFILES += $(srcdir)/$(%C%_bison).info.bak
74 ## ---------- ##
75 ## Ref card. ##
76 ## ---------- ##
78 EXTRA_DIST += %D%/refcard.tex
79 CLEANFILES += %D%/refcard.pdf
81 %D%/refcard.pdf: %D%/refcard.tex
82 $(AM_V_GEN) cd %D% && pdftex $(abs_top_srcdir)/%D%/refcard.tex
86 ## ---------------- ##
87 ## %D%/bison.help. ##
88 ## ---------------- ##
90 # Some of our targets (cross-options.texi, bison.1) use "bison --help".
91 # Since we want to ship the generated file to avoid additional
92 # requirements over the user environment, we used to not depend on
93 # src/bison itself, but on src/getargs.c and other files. Yet, we
94 # need "bison --help" to work to make help2man happy, so we used to
95 # include "make src/bison" in the commands. Then we may have a
96 # problem with concurrent builds, since one make might be aiming one
97 # of its jobs at compiling src/bison, and another job at generating
98 # the man page. If the latter is faster than the former, then we have
99 # two makes that concurrently try to compile src/bison. Doomed to
100 # failure.
102 # As a simple scheme to get our way out, make a stamp file,
103 # bison.help, which contains --version then --help. This file can
104 # depend on bison, which ensures its correctness. But update it
105 # *only* if needed (content changes). This way, we avoid useless
106 # compilations of cross-options.texi and bison.1. At the cost of
107 # repeated builds of bison.help.
109 EXTRA_DIST += $(top_srcdir)/%D%/bison.help
110 if ! CROSS_COMPILING
111 MAINTAINERCLEANFILES += $(top_srcdir)/%D%/bison.help
112 $(top_srcdir)/%D%/bison.help: src/bison$(EXEEXT)
113 $(AM_V_GEN)$(MKDIR_P) %D%
114 $(AM_V_at) LC_ALL=C tests/bison --version >%D%/bison.help.tmp
115 $(AM_V_at) LC_ALL=C tests/bison --help | \
116 ## Avoid depending on the path to Bison.
117 sed -e 's,^Usage: .*/bison \[OPTION\],Usage: bison [OPTION],g' \
118 ## Avoid variations in the output depending on whether we are
119 ## on a glibc system.
120 -e '/translation bugs/d' >>%D%/bison.help.tmp
121 $(AM_V_at)$(top_srcdir)/build-aux/move-if-change %D%/bison.help.tmp $@
122 endif ! CROSS_COMPILING
125 ## ----------- ##
126 ## Man Pages. ##
127 ## ----------- ##
129 dist_man_MANS = $(top_srcdir)/%D%/bison.1
131 EXTRA_DIST += $(dist_man_MANS:.1=.x)
132 MAINTAINERCLEANFILES += $(dist_man_MANS)
134 # Differences to ignore when comparing man pages (the date).
135 remove_time_stamp = \
136 sed 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/'
138 # Depend on configure to get version number changes.
139 if ! CROSS_COMPILING
140 MAN_DEPS = %D%/bison.help %D%/bison.x $(top_srcdir)/configure
141 endif
143 # If we don't have help2man, just touch the target. Maintainers must
144 # have the real thing, so if there's a .git directory, fail hard.
146 # We shouldn't need this, but on some OS the timestamps in the tarball
147 # leave us no choice. See
148 # https://lists.gnu.org/r/bug-bison/2020-05/msg00055.html.
149 $(top_srcdir)/%D%/bison.1: $(MAN_DEPS)
150 $(AM_V_GEN)if $(HELP2MAN) --version >/dev/null 2>&1; then \
151 $(HELP2MAN) \
152 --include=$(top_srcdir)/%D%/bison.x \
153 --output=$@.tmp tests/bison && \
154 { $(remove_time_stamp) $@ >$@a.tmp || true; } && \
155 $(remove_time_stamp) $@.tmp >$@b.tmp && \
156 if diff $@a.tmp $@b.tmp >/dev/null 2>&1; then \
157 touch $@; \
158 else \
159 mv $@.tmp $@; \
160 fi && \
161 rm -f $@*.tmp; \
162 elif test -d $(srcdir)/.git; then \
163 echo >&2 "ERROR: $@: help2man is needed"; \
164 exit 1; \
165 else \
166 touch $@; \
169 if ENABLE_YACC
170 nodist_man_MANS = %D%/yacc.1
171 endif
173 ## ----------------------------- ##
174 ## Graphviz examples generation. ##
175 ## ----------------------------- ##
177 CLEANFILES += $(FIGS_GV:.gv=.eps) $(FIGS_GV:.gv=.pdf) $(FIGS_GV:.gv=.svg)
178 FIGS_GV = \
179 %D%/figs/example.gv \
180 %D%/figs/example-reduce.gv %D%/figs/example-shift.gv
181 EXTRA_DIST += \
182 $(FIGS_GV) $(FIGS_GV:.gv=.txt) \
183 $(FIGS_GV:.gv=.eps) $(FIGS_GV:.gv=.pdf) $(FIGS_GV:.gv=.svg)
184 SUFFIXES += .gv .eps .pdf .svg
186 .gv.eps:
187 $(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
188 $(AM_V_at) $(DOT) -Gmargin=0 -Teps $< >$@.tmp
189 $(AM_V_at) mv $@.tmp $@
191 .gv.pdf:
192 $(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
193 $(AM_V_at) $(DOT) -Gmargin=0 -Tpdf $< >$@.tmp
194 $(AM_V_at) mv $@.tmp $@
196 .gv.svg:
197 $(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
198 $(AM_V_at) $(DOT) -Gmargin=0 -Tsvg $< >$@.tmp
199 $(AM_V_at) mv $@.tmp $@
201 ## -------------- ##
202 ## Doxygenation. ##
203 ## -------------- ##
205 DOXYGEN = doxygen
207 .PHONY: doc html
209 doc: html
211 html-local: %D%/Doxyfile
212 $(AM_V_GEN) $(DOXYGEN) %D%/Doxyfile
214 edit = sed -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
215 -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
216 -e 's,@PERL\@,$(PERL),g' \
217 -e 's,@top_builddir\@,$(top_builddir),g' \
218 -e 's,@top_srcdir\@,$(top_srcdir),g'
220 EXTRA_DIST += %D%/Doxyfile.in
221 CLEANFILES += %D%/Doxyfile
222 # Sed is used to generate Doxyfile from Doxyfile.in instead of
223 # configure, because the former is way faster than the latter.
224 %D%/Doxyfile: $(top_srcdir)/%D%/Doxyfile.in
225 $(AM_V_GEN) $(edit) $(top_srcdir)/%D%/Doxyfile.in >%D%/Doxyfile
227 CLEANDIRS += %D%/html