759b4b2f4090da6ca3f2d4f41bf387c8103c8577
[platform/upstream/groff.git] / doc / Makefile.in
1 # Copyright (C) 2002-2014  Free Software Foundation, Inc.
2 #      Written by Werner Lemberg <wl@gnu.org>
3 #
4 # This file is part of groff.
5 #
6 # groff is free software; you can redistribute it and/or modify it under
7 # the terms of the GNU General Public License as published by the Free
8 # Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # groff is distributed in the hope that it will be useful, but WITHOUT ANY
12 # WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 # for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19
20 # Use this file to produce documentation in various formats; e.g. you can
21 # say
22 #
23 #   make groff.pdf
24 #
25 # to get the groff texinfo manual as a PDF file.
26 #
27 # Note that you have to compile the groff package first.
28
29
30 srcdir=@srcdir@
31 top_srcdir=@abs_top_srcdir@
32 VPATH=@srcdir@
33 top_builddir=@abs_top_builddir@
34 pnmtops=@pnmtops_nosetpage@
35
36 # These may be overridden if cross-compiling.
37 TROFFBIN=$(top_builddir)/src/roff/troff/troff
38 GROFFBIN=$(top_builddir)/src/roff/groff/groff
39 GROFF_BIN_PATH=`echo $(groff_bin_dirs) \
40                 | LANG=C LC_ALL=C sed -e 's|  *|:|g'`
41
42 # info files are distributed with the groff package, so makeinfo is
43 # usually not needed (however, to build from the repo you NEED it!)
44 MAKEINFO=@MAKEINFO@
45
46 # Users who want to print out the groff manual are expected to have a
47 # working TeX installation.  Note that texi2dvi properly honours the
48 # `MAKEINFO' environment variable.
49 TEXI2DVI=texi2dvi
50
51 groff_bin_dirs=\
52   $(top_builddir)/src/roff/groff \
53   $(top_builddir)/src/roff/troff \
54   $(top_builddir)/src/preproc/preconv \
55   $(top_builddir)/src/preproc/pic \
56   $(top_builddir)/src/preproc/eqn \
57   $(top_builddir)/src/preproc/tbl \
58   $(top_builddir)/src/preproc/grn \
59   $(top_builddir)/src/preproc/refer \
60   $(top_builddir)/src/preproc/soelim \
61   $(top_builddir)/src/preproc/html \
62   $(top_builddir)/src/devices/grops \
63   $(top_builddir)/src/devices/gropdf \
64   $(top_builddir)/src/devices/grodvi \
65   $(top_builddir)/src/devices/grotty \
66   $(top_builddir)/src/devices/grolj4 \
67   $(top_builddir)/src/devices/grolbp \
68   $(top_builddir)/src/devices/grohtml
69
70 version=`cat $(top_srcdir)/VERSION`
71 # No additional number if revision is zero.
72 revision=`sed -e 's/^0$$//' -e 's/^[1-9].*$$/.&/' $(top_srcdir)/REVISION`
73
74 FFLAG=-F$(top_builddir)/font -F$(top_srcdir)/font
75 TFLAG=-M$(top_builddir)/tmac -M$(top_srcdir)/tmac
76
77 TROFF=$(TROFFBIN) $(TFLAG) $(FFLAG) -ww
78 GROFF=\
79   LANG=C \
80   LC_ALL=C \
81   sed -e "s;@VERSION@;$(version)$(revision);" $< \
82     | GROFF_COMMAND_PREFIX= \
83       GROFF_BIN_PATH="$(GROFF_BIN_PATH)" \
84       $(GROFFBIN) $(TFLAG) $(FFLAG) -Upet -ww
85
86 imagedir=img
87
88 .SUFFIXES: .me .ms .ps .html .txt .texinfo .dvi .pdf .xhtml
89 .PHONY: all prepare_examples clean distclean realclean extraclean
90
91 # For simplicity, we always call preconv, grn, and eqn.
92 .me.txt:
93         $(GROFF) -k -Tutf8 -ge -me >$@
94 .me.ps:
95         $(GROFF) -k -Tps -ge -me >$@
96
97 .ms.html:
98         $(GROFF) -P-p -P-b -P-I`basename $< | sed -e 's|.ms$$||'` \
99                  -P-D$(imagedir) -P-V -Thtml -ms >$@
100 .ms.txt:
101         $(GROFF) -Tascii -ms -mwww >$@
102 .ms.ps:
103         $(GROFF) -Tps -ms -mwww >$@
104
105 .texinfo.txt:
106         LANG=C \
107         LC_ALL=C \
108         $(MAKEINFO) --enable-encoding -I$(srcdir) --plaintext -o $@ $<
109 .texinfo.dvi:
110         LANG=C \
111         LC_ALL=C \
112         MAKEINFO=$(MAKEINFO) $(TEXI2DVI) -e $<
113 .texinfo.pdf:
114         LANG=C \
115         LC_ALL=C \
116         MAKEINFO=$(MAKEINFO) $(TEXI2DVI) -e --pdf $<
117 .texinfo.html:
118         LANG=C \
119         LC_ALL=C \
120         $(MAKEINFO) --enable-encoding -I$(srcdir) --html --no-split $< \
121           && $(SHELL) $(srcdir)/fixinfo.sh $@
122
123 all: prepare_examples
124
125 prepare_examples: grnexmpl.g groff.css
126         test -f grnexmpl.g || cp $(srcdir)/grnexmpl.g .
127         test -f groff.css || cp $(srcdir)/groff.css .
128
129 groff.info: groff.texinfo
130         $(MAKEINFO) --enable-encoding -I$(srcdir) $(srcdir)/groff.texinfo
131
132 gnu.eps: gnu.xpm
133         xpmtoppm $(srcdir)/gnu.xpm | pnmdepth 15 | $(pnmtops) -noturn >$@
134
135 pic.html: pic.ms
136         $(GROFF) -P-p -P-I`basename $< | sed -e 's|.ms$$||'` \
137                  -P-D$(imagedir) -P-j`basename $< | sed -e 's|.ms$$||'` \
138                  -Thtml -P-V -ms >$@
139
140 webpage.html: webpage.ms gnu.eps groff.css
141         $(GROFF) -P-j`basename $< | sed -e 's|.ms$$||'` \
142                  -P-nrpb -P-I`basename $< | sed -e 's|.ms$$||'` \
143                  -P-D$(imagedir) -Thtml -ms >$@
144
145 webpage.ps: gnu.eps
146
147 grnexmpl.ps: grnexmpl.me grnexmpl.g
148
149 split-html:
150         LANG=C \
151         LC_ALL=C \
152         $(MAKEINFO) --enable-encoding -I$(srcdir) --html groff.texinfo \
153           && for f in groff/*; do $(SHELL) $(srcdir)/fixinfo.sh $$f; done
154
155 clean:
156         rm -f *.ps *.html *.txt core
157         rm -f *.aux *.dvi *.pdf *.log *.toc texput.log
158         rm -f *.cp *.cps *.cv *.cn *.es *.ess *.fn *.fns *.ky *.kys \
159               *.ma *.mas *.op *.ops *.pg *.pgs *.rq *.rqs *.st *.sts \
160               *.tp *.tps *.tr *.vr *.vrs *.xhtml
161         -rm -rf img
162
163 distclean: clean
164
165 realclean: distclean
166         rm -f *.png *.eps
167
168 extraclean: distclean
169         rm -f core *~ \#* junk temp grot
170
171 ########################################################################
172 # Emacs settings
173 ########################################################################
174 #
175 # Local Variables:
176 # mode: makefile
177 # End: