]> git.saurik.com Git - bison.git/blame - doc/local.mk
build: don't try to generate docs when cross-compiling
[bison.git] / doc / local.mk
CommitLineData
3209eb1c 1## Copyright (C) 2001-2003, 2005-2015 Free Software Foundation, Inc.
e2c2f696
AD
2
3## This program is free software: you can redistribute it and/or modify
4## it under the terms of the GNU General Public License as published by
5## the Free Software Foundation, either version 3 of the License, or
6## (at your option) any later version.
7##
8## This program is distributed in the hope that it will be useful,
9## but WITHOUT ANY WARRANTY; without even the implied warranty of
10## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11## GNU General Public License for more details.
12##
13## You should have received a copy of the GNU General Public License
14## along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16AM_MAKEINFOFLAGS = --no-split
22b081de 17info_TEXINFOS = doc/bison.texi
e9690142
JD
18doc_bison_TEXINFOS = \
19 $(CROSS_OPTIONS_TEXI) \
20 doc/fdl.texi \
e2c2f696
AD
21 doc/gpl-3.0.texi
22
f039b518
TR
23# Cannot express dependencies directly on file names because of Automake.
24# Obfuscate with a variable.
25doc_bison = doc/bison
b97bbbae 26$(doc_bison).dvi: $(FIGS_GV:.gv=.eps)
c4aa4ff5 27$(doc_bison).info: $(FIGS_GV:.gv=.txt)
b97bbbae
AD
28$(doc_bison).pdf: $(FIGS_GV:.gv=.pdf)
29$(doc_bison).html: $(FIGS_GV:.gv=.png)
f039b518
TR
30
31TEXI2DVI = texi2dvi --build-dir=doc/bison.t2d -I doc
45d4c012 32CLEANDIRS = doc/bison.t2d
e2c2f696
AD
33clean-local:
34 rm -rf $(CLEANDIRS)
35
9f14e187
AD
36MOSTLYCLEANFILES += $(top_srcdir)/doc/*.t
37
e2c2f696
AD
38CROSS_OPTIONS_PL = $(top_srcdir)/build-aux/cross-options.pl
39CROSS_OPTIONS_TEXI = $(top_srcdir)/doc/cross-options.texi
9f14e187 40$(CROSS_OPTIONS_TEXI): doc/bison.help $(CROSS_OPTIONS_PL)
45eebca4 41# Create $@~ which is the previous contents. Don't use 'mv' here so
796a2b0a
AD
42# that even if we are interrupted, the file is still available for
43# diff in the next run. Note that $@ might not exist yet.
f67c0a1c
AD
44 $(AM_V_GEN){ test ! -f $@ || cat $@; } >$@~
45 $(AM_V_at)test ! -f $@.tmp || rm -f $@.tmp
46 $(AM_V_at)src/bison$(EXEEXT) --help | \
5aaad6c4 47 $(PERL) $(CROSS_OPTIONS_PL) $(top_srcdir)/src/scan-gram.l >$@.tmp
f67c0a1c
AD
48 $(AM_V_at)diff -u $@~ $@.tmp || true
49 $(AM_V_at)mv $@.tmp $@
e2c2f696
AD
50MAINTAINERCLEANFILES = $(CROSS_OPTIONS_TEXI)
51
52## ---------- ##
53## Ref card. ##
54## ---------- ##
55
56EXTRA_DIST += doc/refcard.tex
45d4c012 57CLEANFILES += doc/refcard.pdf
e2c2f696 58
45d4c012
AD
59doc/refcard.pdf: doc/refcard.tex
60 $(AM_V_GEN) cd doc && pdftex $(abs_top_srcdir)/doc/refcard.tex
e2c2f696 61
e2c2f696
AD
62
63
9f14e187
AD
64## ---------------- ##
65## doc/bison.help. ##
66## ---------------- ##
67
68# Some of our targets (cross-option.texi, bison.1) use "bison --help".
69# Since we want to ship the generated file to avoid additional
70# requirements over the user environment, we used not depend on
71# src/bison itself, but on src/getargs.c and other files. Yet, we
72# need "bison --help" to work to make help2man happy, so we used to
73# include "make src/bison" in the commands. Then we may have a
74# problem with concurrent builds, since one make might be aiming one
75# of its jobs at compiling src/bison, and another job at generating
76# the man page. If the latter is faster than the former, then we have
77# two makes that concurrently try to compile src/bison. Doomed to
78# failure.
79#
80# As a simple scheme to get our way out, make a stamp file,
81# bison.help, which contains --version then --help. This file can
82# depend on bison, which ensures its correctness. But update it
83# *only* if needed (content changes). This way, we avoid useless
84# compilations of cross-option.texi and bison.1. At the cost of
85# repeated builds of bison.help.
86
87EXTRA_DIST += $(top_srcdir)/doc/bison.help
a16074bb 88if ! CROSS_COMPILING
9f14e187
AD
89MAINTAINERCLEANFILES += $(top_srcdir)/doc/bison.help
90$(top_srcdir)/doc/bison.help: src/bison$(EXEEXT)
da83f838
AD
91 $(AM_V_GEN)src/bison$(EXEEXT) --version >doc/bison.help.tmp
92 $(AM_V_at) src/bison$(EXEEXT) --help >>doc/bison.help.tmp
93 $(AM_V_at)$(top_srcdir)/build-aux/move-if-change doc/bison.help.tmp $@
a16074bb 94endif ! CROSS_COMPILING
9f14e187
AD
95
96
e2c2f696
AD
97## ----------- ##
98## Man Pages. ##
99## ----------- ##
100
101dist_man_MANS = $(top_srcdir)/doc/bison.1
102
9f14e187 103EXTRA_DIST += $(dist_man_MANS:.1=.x)
e2c2f696
AD
104MAINTAINERCLEANFILES += $(dist_man_MANS)
105
e2c2f696
AD
106# Differences to ignore when comparing the man page (the date).
107remove_time_stamp = \
108 sed 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/'
109
9f14e187 110# Depend on configure to get version number changes.
a16074bb
AD
111if ! CROSS_COMPILING
112MAN_DEPS = doc/bison.help doc/bison.x $(top_srcdir)/configure
113endif
114
115$(top_srcdir)/doc/bison.1: $(MAN_DEPS)
f67c0a1c
AD
116 $(AM_V_GEN)$(HELP2MAN) \
117 --include=$(top_srcdir)/doc/bison.x \
9f14e187 118 --output=$@.t src/bison$(EXEEXT)
f67c0a1c 119 $(AM_V_at)if $(remove_time_stamp) $@ >$@a.t 2>/dev/null && \
e2c2f696 120 $(remove_time_stamp) $@.t | cmp $@a.t - >/dev/null 2>&1; then \
f67c0a1c
AD
121 touch $@; \
122 else \
123 mv $@.t $@; \
e2c2f696 124 fi
f67c0a1c 125 $(AM_V_at)rm -f $@*.t
e2c2f696 126
265640d5 127if ENABLE_YACC
e2c2f696 128nodist_man_MANS = doc/yacc.1
265640d5 129endif
e2c2f696 130
d0a30438
AD
131## ----------------------------- ##
132## Graphviz examples generation. ##
133## ----------------------------- ##
134
135CLEANDIRS += doc/figs
b97bbbae
AD
136FIGS_GV = \
137 doc/figs/example.gv \
138 doc/figs/example-reduce.gv doc/figs/example-shift.gv
139EXTRA_DIST += \
c4aa4ff5 140 $(FIGS_GV) $(FIGS_GV:.gv=.txt) \
b97bbbae
AD
141 $(FIGS_GV:.gv=.eps) $(FIGS_GV:.gv=.pdf) $(FIGS_GV:.gv=.png)
142SUFFIXES += .gv .eps .pdf .png
143
144.gv.eps:
d0a30438
AD
145 $(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
146 $(AM_V_at) $(DOT) -Gmargin=0 -Teps $< >$@.tmp
147 $(AM_V_at) mv $@.tmp $@
148
b97bbbae 149.gv.pdf:
d0a30438
AD
150 $(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
151 $(AM_V_at) $(DOT) -Gmargin=0 -Tpdf $< >$@.tmp
152 $(AM_V_at) mv $@.tmp $@
153
b97bbbae 154.gv.png:
d0a30438
AD
155 $(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
156 $(AM_V_at) $(DOT) -Gmargin=0 -Tpng $< >$@.tmp
157 $(AM_V_at) mv $@.tmp $@
158
e2c2f696
AD
159## -------------- ##
160## Doxygenation. ##
161## -------------- ##
162
163DOXYGEN = doxygen
164
165.PHONY: doc html
166
167doc: html
168
169html-local: doc/Doxyfile
ed3c2b91 170 $(AM_V_GEN) $(DOXYGEN) doc/Doxyfile
e2c2f696
AD
171
172edit = sed -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
173 -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
5aaad6c4 174 -e 's,@PERL\@,$(PERL),g' \
e2c2f696
AD
175 -e 's,@top_builddir\@,$(top_builddir),g' \
176 -e 's,@top_srcdir\@,$(top_srcdir),g'
177
178EXTRA_DIST += doc/Doxyfile.in
179CLEANFILES += doc/Doxyfile
180# Sed is used to generate Doxyfile from Doxyfile.in instead of
181# configure, because the former is way faster than the latter.
182doc/Doxyfile: $(top_srcdir)/doc/Doxyfile.in
f67c0a1c 183 $(AM_V_GEN) $(edit) $(top_srcdir)/doc/Doxyfile.in >doc/Doxyfile
e2c2f696 184
ed3c2b91 185CLEANDIRS += doc/html