1 # Copyright (C) 2002-2018 Free Software Foundation, Inc.
2 # Original Makefile.sub written by Werner Lemberg <wl@gnu.org>
3 # Automake migration by
4 # Bertrand Garrigues <bertrand.garrigues@laposte.net>
7 # This file is part of groff.
9 # groff is free software; you can redistribute it and/or modify it under
10 # the terms of the GNU General Public License as published by the Free
11 # Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
14 # groff is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 doc_srcdir = $(abs_top_srcdir)/doc
23 doc_builddir = $(abs_top_builddir)/doc
25 DOC_SED = $(SED) -e "s;[@]VERSION[@];$(VERSION);"
28 GROFF_COMMAND_PREFIX= \
29 GROFF_BIN_PATH="$(GROFF_BIN_PATH)" \
30 $(GROFFBIN) -I$(abs_top_builddir) -M $(doc_srcdir) \
31 $(TFLAG) $(FFLAG) -Upet -ww
33 DOC_GROFF = $(DOC_SED) $< | $(DOC_GROFF_ONLY)
35 # Other doc, installed in $(docdir)
37 # Files located in the source tree
43 # Files generated in the build tree
50 otherdocdir = $(docdir)
51 dist_otherdoc_DATA = $(DOCFILES)
52 nodist_otherdoc_DATA = $(PROCESSEDDOCFILES)
53 MOSTLYCLEANFILES += $(PROCESSEDDOCFILES)
55 EXTRA_DIST += $(DOCFILES)
58 # pdf doc, written in mom and therefore using contrib/mom/mom.am
60 EXTRA_DIST += doc/automake.mom
62 docpdfdocdir = $(pdfdocdir)
63 nodist_docpdfdoc_DATA = doc/automake.pdf
64 MOSTLYCLEANFILES += doc/automake.pdf
66 doc/automake.pdf: doc/automake.mom \
67 groff troff gropdf pdfmom font/devpdf/build_font_files \
70 # GNU PIC html documentation, installed in $(htmldocdir)
71 # Other pic*.html files are installed by the local rule
75 htmlpicdir = $(htmldocdir)
76 htmlpic_DATA = $(HTMLDOCFILES)
77 HTMLDOCFILESALL = pic*.html
78 HTMLDOCIMAGEFILES = pic*
81 # Examples files, installed in $(exampledir)
91 # Generated in the build tree
92 PROCESSEDEXAMPLEFILES = \
95 docexamplesdir = $(exampledir)
96 dist_docexamples_DATA = $(EXAMPLEFILES)
97 nodist_docexamples_DATA = $(PROCESSEDEXAMPLEFILES)
98 MOSTLYCLEANFILES += $(PROCESSEDEXAMPLEFILES)
100 EXTRA_DIST += $(EXAMPLEFILES)
103 if BUILD_HTMLEXAMPLES
104 # webpage.html is generated, webpage*.html files are installed by the local rule.
105 HTMLEXAMPLEFILES = doc/webpage.html
106 HTMLEXAMPLEFILESALL = webpage*.html
107 HTMLEXAMPLEIMAGEFILES = webpage*
108 htmlexamplesdir = $(exampledir)
109 nodist_htmlexamples_DATA = $(HTMLEXAMPLEFILES)
113 htmldocimagedir = $(htmldocdir)/img
114 exampleimagedir = $(exampledir)/img
116 MOSTLYCLEANFILES += doc/examples.stamp
123 SUFFIXES += .me .ms .ps .html .txt .texi .dvi .pdf .xhtml
125 # For simplicity, we always call preconv, grn, and eqn.
127 $(GROFF_V)$(MKDIR_P) `dirname $@` \
128 && $(DOC_GROFF) -k -Tutf8 -ge -me >$@
130 $(GROFF_V)$(MKDIR_P) `dirname $@` \
131 && $(DOC_GROFF) -k -Tps -ge -me >$@
134 $(GROFF_V)$(MKDIR_P) `dirname $@` \
135 && $(DOC_GROFF) -P-p -P-b -P-I`basename $< | sed -e 's|.ms$$||'` \
136 -P-D$(imagedir) -Thtml -ms >$@
138 $(GROFF_V)$(MKDIR_P) `dirname $@` \
139 && $(DOC_GROFF) -Tascii -ms -mwww >$@
141 $(GROFF_V)$(MKDIR_P) `dirname $@` \
142 && $(DOC_GROFF) -Tps -ms -mwww >$@
144 $(PROCESSEDEXAMPLEFILES): $(bin_PROGRAMS) $(prefixexecbin_PROGRAMS) gnu.eps
145 $(PROCESSEDEXAMPLEFILES): $(dist_devpsfont_DATA) $(nodist_devpsfont_DATA) $(hdtbltmac_DATA)
146 $(PROCESSEDEXAMPLEFILES): $(dist_tmac_DATA) $(nodist_tmac_DATA)
147 $(PROCESSEDDOCFILES): $(bin_PROGRAMS) $(prefixexecbin_PROGRAMS) gnu.eps
149 doc/pic.html: tmac/www.tmac
150 doc/pic.html: $(bin_PROGRAMS) $(prefixexecbin_PROGRAMS)
151 doc/pic.html: doc/examples.stamp
152 doc/pic.html: $(dist_devpsfont_DATA) $(nodist_devpsfont_DATA)
153 doc/pic.html: $(doc_srcdir)/pic.ms $(devhtmlfont_DATA)
154 $(GROFF_V)$(MKDIR_P) $(doc_builddir) \
155 && cd $(doc_builddir) \
156 && $(DOC_SED) $(doc_srcdir)/pic.ms \
157 | $(DOC_GROFF_ONLY) -P-p -P-Ipic -P-D$(imagedir) -P-jpic \
158 -Thtml -ms > pic.html
160 doc/examples.stamp: doc/groff.css
161 @$(MKDIR_P) $(doc_builddir)
162 test -f $(doc_builddir)/groff.css || cp $(doc_srcdir)/groff.css $(doc_builddir)
165 doc/webpage.html: $(bin_PROGRAMS) $(prefixexecbin_PROGRAMS)
166 doc/webpage.html: doc/examples.stamp $(devhtmlfont_DATA)
167 doc/webpage.html: $(dist_devpsfont_DATA) $(nodist_devpsfont_DATA)
168 doc/webpage.html: $(doc_srcdir)/webpage.ms gnu.eps $(doc_srcdir)/groff.css
169 $(GROFF_V)$(MKDIR_P) doc \
170 && cd $(doc_builddir) \
171 && $(DOC_SED) $(doc_srcdir)/webpage.ms \
172 | $(DOC_GROFF_ONLY) -P-jwebpage -P-nrpb -P-Iwebpage \
173 -P-D$(imagedir) -Thtml -ms > webpage.html
175 doc/grnexmpl.ps: doc/grnexmpl.me doc/grnexmpl.g
177 # Note that we remove groff.css only if out-of-source build tree
178 mostlyclean-local: mostlyclean_doc
181 if test -d $(doc_builddir); then \
182 cd $(doc_builddir) && \
183 for f in $(HTMLDOCFILESALL); do \
187 if test -d $(doc_builddir)/$(imagedir); then \
188 cd $(doc_builddir)/$(imagedir) && \
189 for f in $(HTMLDOCIMAGEFILES); do \
194 if test $(top_builddir) != $(top_srcdir); then \
195 $(RM) $(top_builddir)/doc/groff.css; \
198 if BUILD_HTMLEXAMPLES
199 if test -d $(doc_builddir); then \
200 cd $(doc_builddir) && \
201 for f in $(HTMLEXAMPLEFILESALL); do \
205 if test -d $(doc_builddir)/$(imagedir); then \
206 cd $(doc_builddir)/$(imagedir) && \
207 for f in $(HTMLEXAMPLEIMAGEFILES); do \
213 install-data-hook: install_doc_htmldoc
216 cd $(doc_builddir) && \
217 for f in `ls $(HTMLDOCFILESALL)`; do \
218 $(RM) $(DESTDIR)$(htmldocdir)/$$f; \
219 $(INSTALL_DATA) $$f $(DESTDIR)$(htmldocdir)/$$f; \
221 -test -d $(DESTDIR)$(htmldocimagedir) \
222 || $(mkinstalldirs) $(DESTDIR)$(htmldocimagedir)
223 $(RM) $(DESTDIR)$(htmldocimagedir)/$(HTMLDOCIMAGEFILES)
224 $(INSTALL_DATA) $(doc_builddir)/$(imagedir)/$(HTMLDOCIMAGEFILES) \
225 $(DESTDIR)$(htmldocimagedir)
228 install-data-hook: install_doc_examples
229 install_doc_examples: gnu.eps
231 # Prefer gnu.eps in builddir over srcdir.
232 d=.; test -f "gnu.eps" || d=$(doc_srcdir); \
233 $(RM) $(DESTDIR)$(exampledir)/gnu.eps; \
234 $(INSTALL_DATA) $$d/gnu.eps $(DESTDIR)$(exampledir)/gnu.eps
236 if BUILD_HTMLEXAMPLES
237 cd $(doc_builddir) && \
238 for f in `ls $(HTMLEXAMPLEFILESALL)`; do \
239 $(RM) $(DESTDIR)$(exampledir)/$$f; \
240 $(INSTALL_DATA) $$f $(DESTDIR)$(exampledir)/$$f; \
242 -test -d $(DESTDIR)$(exampleimagedir) \
243 || $(mkinstalldirs) $(DESTDIR)$(exampleimagedir)
244 $(RM) $(DESTDIR)$(exampleimagedir)/$(HTMLEXAMPLEIMAGEFILES)
245 $(INSTALL_DATA) $(doc_builddir)/$(imagedir)/$(HTMLEXAMPLEIMAGEFILES) \
246 $(DESTDIR)$(exampleimagedir)
249 uninstall-hook: uninstall_doc_examples uninstall_doc_htmldoc uninstall_mom
250 uninstall_doc_examples:
252 $(RM) -f $(DESTDIR)$(exampledir)/gnu.eps
254 if BUILD_HTMLEXAMPLES
255 -test -d $(DESTDIR)$(docexamplesdir) && \
256 cd $(DESTDIR)$(docexamplesdir) && \
257 for f in $(HTMLEXAMPLEFILESALL); do \
260 -test -d $(DESTDIR)$(docexamplesdir)/$(imagedir) && \
261 cd $(DESTDIR)$(docexamplesdir)/$(imagedir) && \
262 for f in $(HTMLEXAMPLEIMAGEFILES); do \
265 -rmdir $(DESTDIR)$(docexamplesdir)/$(imagedir)
266 -rmdir $(DESTDIR)$(docexamplesdir)
269 uninstall_doc_htmldoc:
271 -test -d $(DESTDIR)$(htmldocdir) && \
272 cd $(DESTDIR)$(htmldocdir) && \
273 for f in $(HTMLDOCFILESALL); do \
276 -test -d $(DESTDIR)$(htmldocdir)/$(imagedir) && \
277 cd $(DESTDIR)$(htmldocdir)/$(imagedir) && \
278 for f in $(HTMLDOCIMAGEFILES); do \
281 -rmdir $(DESTDIR)$(htmldocdir)/$(imagedir)
282 -rmdir $(DESTDIR)$(htmldocdir)
287 # Users who want to print out the groff manual are expected to have a
288 # working TeX installation. Note that texi2dvi properly honours the
289 # `MAKEINFO' environment variable.
291 # We can't use automake's facilities because the make dist target attempts to
292 # generate a pdf version of groff.texi by invoking texi2dvi without the -e
293 # option, which is needed to build this file.
294 # info_TEXINFOS = doc/groff.texi
295 # doc_groff_TEXINFOS = doc/fdl.texi
297 # Note that GNU standards require to install only info doc. Info doc
298 # can still be disabled by passing
299 # --with-doc=<something else than info or yes>
304 build_infodoc: doc/groff.info
305 groffinfodir = $(infodir)
306 groffpdfdir = $(infodir)
307 MOSTLYCLEANFILES += doc/groff.info doc/groff.info-2 doc/groff.info-2
308 doc/groff.info: $(doc_srcdir)/groff.texi
309 @$(MKDIR_P) $(doc_builddir)
312 $(MAKEINFO) -o doc/groff.info --enable-encoding -I$(doc_srcdir) $(doc_srcdir)/groff.texi
316 EXTRA_DIST += doc/groff.texi doc/fdl.texi
318 # GNU Make has a built-in variable TEXI2DVI but it is not the case of
319 # all 'make' implementation. As it default to 'texi2dvi' we simply
323 texi2dvi_missing = no
324 # Rules to generate various doc files from .texi files.
326 @$(MKDIR_P) $(doc_builddir)
329 $(MAKEINFO) --enable-encoding -I$(doc_srcdir) --plaintext -o $@ $<
333 @$(MKDIR_P) $(doc_builddir)
336 TEXINPUTS="$(top_srcdir)/build-aux:$(TEXINPUTS)" \
337 MAKEINFO='$(MAKEINFO) -I $(doc_srcdir)' \
338 $(TEXI2DVI) -e --batch --build-dir=doc/`basename $@`.t2d -o $@ $<
340 @echo "Program texi2dvi is missing, cannot generate dvi doc"; \
346 @$(MKDIR_P) $(doc_builddir)
349 TEXINPUTS="$(top_srcdir)/build-aux:$(TEXINPUTS)" \
350 MAKEINFO='$(MAKEINFO) -I $(doc_srcdir)' \
351 $(TEXI2DVI) -e --batch --pdf --build-dir=doc/`basename $@`.t2p -o $@ $<
353 @echo "Program texi2dvi is missing, cannot generate pdf doc"; \
357 # This will generate both html split into several files and html doc
358 # in a single file. If texinfo version < 5.0, we process the resulting
359 # (mono) .html file with fixinfo.sh du to a problem with blockquote
360 # closing (for example 5.6.1 Setting Registers, the 'Request'
361 # blockquote is not properly closed, see fixinfo.sh for more details
363 @$(MKDIR_P) $(doc_builddir)/
366 $(MAKEINFO) --html -I $(doc_srcdir) \
367 -o doc/`basename $@`.node $<
370 $(MAKEINFO) --html -I $(doc_srcdir) --no-split \
372 if test "$(makeinfo_version_numeric)" -lt 5000; then \
373 echo "patching $@ with fixinfo.sh"; \
374 $(SHELL) $(doc_srcdir)/fixinfo.sh \
375 doc/`basename $@`.mono/`basename $@`; \
378 # Targets to make all the doc in all formats. These doc are not built
379 # by default. pdf, dvi, ps, html and their install equivalent
380 # install-pdf, install-dvi, install-ps, install-html are standard
385 doc_all: doc_txt dvi pdf html
386 doc_txt: doc/groff.txt
388 doc_dvi: doc/groff.dvi
390 doc_pdf: doc/groff.pdf
392 doc_html: doc/groff.html
393 install-doc: install-pdf install-html
396 distclean-local: clean_infodoc clean_otherdoc
397 maintainer-clean-local: clean_infodoc clean_otherdoc
399 -$(RM) $(doc_builddir)/groff.info*
400 -$(RM) $(doc_builddir)/groff.pdf
401 -$(RM) $(doc_builddir)/groff.dvi
402 -$(RM) -r $(doc_builddir)/groff.html.*
404 -cd $(doc_builddir) && \
405 $(RM) -r *.pdf *.html *.txt *.dvi *.t2p *.t2d
407 install-data-local: install_infodoc
409 install_infodoc: doc/groff.info
410 -test -d $(DESTDIR)$(infodir) || $(mkinstalldirs) $(DESTDIR)$(infodir)
411 for p in doc/groff.info `ls doc/groff.info*`; do \
413 $(RM) $(DESTDIR)$(infodir)/$$f; \
414 $(INSTALL_DATA) $$p $(DESTDIR)$(infodir)/$$f; \
416 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) \
417 $(DESTDIR)$(infodir)/groff.info
418 install-pdf-local: doc/groff.pdf
419 -test -d $(DESTDIR)$(pdfdocdir) || $(mkinstalldirs) $(DESTDIR)$(pdfdocdir)
420 cp $(top_builddir)/doc/groff.pdf $(DESTDIR)$(pdfdocdir)
421 install-html-local: doc/groff.html
422 -test -d $(DESTDIR)$(htmldocdir)/groff.html.mono || $(mkinstalldirs) $(DESTDIR)$(htmldocdir)/groff.html.mono
423 cp -r $(top_builddir)/doc/groff.html $(DESTDIR)$(htmldocdir)/groff.html.mono
424 cp -r $(top_builddir)/doc/groff.html.node $(DESTDIR)$(htmldocdir)
429 uninstall-local: uninstall_infodoc uninstall-pdf uninstall-html
430 uninstall_doc: uninstall-local
431 uninstall-doc: uninstall-local
434 -$(INSTALL_INFO) --remove --info-dir=$(DESTDIR)$(infodir) \
435 $(DESTDIR)$(infodir)/groff.info
436 -for f in `ls $(DESTDIR)$(infodir)/groff.info*`; do \
442 -$(RM) -f $(DESTDIR)$(pdfdocdir)/groff.pdf
446 -$(RM) -r $(DESTDIR)$(htmldocdir)/groff.html.*
449 # File used by contrib/hdtbl and contrib/pdfmark. It is distributed in
450 # doc.eps. We try in priority to use the file in 'doc'.
451 EXTRA_DIST += doc/gnu.xpm
452 MOSTLYCLEANFILES += gnu.eps
455 if test -f $(top_srcdir)/doc/gnu.eps; then \
456 cp $(top_srcdir)/doc/gnu.eps . ; \
457 elif test -f $(top_builddir)/doc/gnu.eps; then \
458 cp $(top_builddir)/doc/gnu.eps . ; \
460 if test ""$(XPMTOPPM) != "found"; then \
461 echo "Program xpmtoppm is missing, can't generate gnu.eps" ; \
464 if test ""$(pnmtops) != "found"; then \
465 echo "Program pnmtops is missing, can't generate gnu.eps" ; \
468 if test "$(pnmtops_nosetpage)" != "pnmtops -nosetpage"; then \
469 echo "Program pnmtops can't handle -nosetpage, can't generate gnu.eps" ; \
472 xpmtoppm $(top_srcdir)/doc/gnu.xpm | pnmdepth 15 \
473 | $(pnmtops_nosetpage) -noturn -rle >$@ ; \
476 # Copy gnu.eps in 'doc' directory
477 dist-hook: dist-gnueps
479 chmod u+w $(distdir)/doc
480 cp -f gnu.eps $(distdir)/doc
483 ########################################################################
486 # mode: makefile-automake