]> git.saurik.com Git - bison.git/blame - doc/local.mk
Simplify y.tab.c when location tracking is disabled.
[bison.git] / doc / local.mk
CommitLineData
796a2b0a
AD
1## Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009
2## Free Software Foundation, Inc.
e2c2f696
AD
3
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.
13##
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/>.
16
17AM_MAKEINFOFLAGS = --no-split
18info_TEXINFOS = doc/bison.texinfo
19doc_bison_TEXINFOS = \
20 $(CROSS_OPTIONS_TEXI) \
21 doc/fdl.texi \
22 doc/gpl-3.0.texi
23
24CLEANFILES = doc/bison.fns
25CLEANDIRS = doc/*.t2d
26clean-local:
27 rm -rf $(CLEANDIRS)
28
9f14e187
AD
29MOSTLYCLEANFILES += $(top_srcdir)/doc/*.t
30
e2c2f696
AD
31CROSS_OPTIONS_PL = $(top_srcdir)/build-aux/cross-options.pl
32CROSS_OPTIONS_TEXI = $(top_srcdir)/doc/cross-options.texi
9f14e187 33$(CROSS_OPTIONS_TEXI): doc/bison.help $(CROSS_OPTIONS_PL)
796a2b0a
AD
34# Create $@~ which is the previous contents. Don't use `mv' here so
35# that even if we are interrupted, the file is still available for
36# diff in the next run. Note that $@ might not exist yet.
37 { test ! -f $@ || cat $@; } >$@~
38 test ! -f $@.tmp || rm -f $@.tmp
9f14e187 39 src/bison$(EXEEXT) --help | \
796a2b0a 40 perl $(CROSS_OPTIONS_PL) $(top_srcdir)/src/scan-gram.l >$@.tmp
01466c3e 41 diff -u $@~ $@.tmp || true
e2c2f696
AD
42 mv $@.tmp $@
43MAINTAINERCLEANFILES = $(CROSS_OPTIONS_TEXI)
44
45## ---------- ##
46## Ref card. ##
47## ---------- ##
48
49EXTRA_DIST += doc/refcard.tex
50CLEANFILES += doc/refcard.dvi doc/refcard.log doc/refcard.ps
51
52doc/refcard.dvi: doc/refcard.tex
53 cd doc && tex refcard.tex
54
55doc/refcard.ps: doc/refcard.dvi
56
57
9f14e187
AD
58## ---------------- ##
59## doc/bison.help. ##
60## ---------------- ##
61
62# Some of our targets (cross-option.texi, bison.1) use "bison --help".
63# Since we want to ship the generated file to avoid additional
64# requirements over the user environment, we used not depend on
65# src/bison itself, but on src/getargs.c and other files. Yet, we
66# need "bison --help" to work to make help2man happy, so we used to
67# include "make src/bison" in the commands. Then we may have a
68# problem with concurrent builds, since one make might be aiming one
69# of its jobs at compiling src/bison, and another job at generating
70# the man page. If the latter is faster than the former, then we have
71# two makes that concurrently try to compile src/bison. Doomed to
72# failure.
73#
74# As a simple scheme to get our way out, make a stamp file,
75# bison.help, which contains --version then --help. This file can
76# depend on bison, which ensures its correctness. But update it
77# *only* if needed (content changes). This way, we avoid useless
78# compilations of cross-option.texi and bison.1. At the cost of
79# repeated builds of bison.help.
80
81EXTRA_DIST += $(top_srcdir)/doc/bison.help
82MAINTAINERCLEANFILES += $(top_srcdir)/doc/bison.help
83$(top_srcdir)/doc/bison.help: src/bison$(EXEEXT)
84 $< --version >doc/bison.help.t
85 $< --help >>doc/bison.help.t
86 $(top_srcdir)/build-aux/move-if-change doc/bison.help.t $@
87
88
e2c2f696
AD
89## ----------- ##
90## Man Pages. ##
91## ----------- ##
92
93dist_man_MANS = $(top_srcdir)/doc/bison.1
94
9f14e187 95EXTRA_DIST += $(dist_man_MANS:.1=.x)
e2c2f696
AD
96MAINTAINERCLEANFILES += $(dist_man_MANS)
97
e2c2f696
AD
98# Differences to ignore when comparing the man page (the date).
99remove_time_stamp = \
100 sed 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/'
101
9f14e187
AD
102# Depend on configure to get version number changes.
103$(top_srcdir)/doc/bison.1: doc/bison.help doc/bison.x $(top_srcdir)/configure
e2c2f696 104 @echo "Updating man page $@"
9f14e187
AD
105 $(HELP2MAN) \
106 --include=$(top_srcdir)/doc/bison.x \
107 --output=$@.t src/bison$(EXEEXT)
e2c2f696
AD
108 if $(remove_time_stamp) $@ >$@a.t 2>/dev/null && \
109 $(remove_time_stamp) $@.t | cmp $@a.t - >/dev/null 2>&1; then \
9f14e187 110 touch $@; \
e2c2f696 111 else \
9f14e187 112 mv $@.t $@; \
e2c2f696
AD
113 fi
114 rm -f $@*.t
115
116nodist_man_MANS = doc/yacc.1
117
118## -------------- ##
119## Doxygenation. ##
120## -------------- ##
121
122DOXYGEN = doxygen
123
124.PHONY: doc html
125
126doc: html
127
128html-local: doc/Doxyfile
129 cd doc && $(DOXYGEN)
130
131edit = sed -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
132 -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
133 -e 's,@top_builddir\@,$(top_builddir),g' \
134 -e 's,@top_srcdir\@,$(top_srcdir),g'
135
136EXTRA_DIST += doc/Doxyfile.in
137CLEANFILES += doc/Doxyfile
138# Sed is used to generate Doxyfile from Doxyfile.in instead of
139# configure, because the former is way faster than the latter.
140doc/Doxyfile: $(top_srcdir)/doc/Doxyfile.in
141 $(edit) $(top_srcdir)/doc/Doxyfile.in >doc/Doxyfile
142
143CLEANDIRS += html latex