Bug 1029: Use JS_CallFunctionValue in elinks_object.c
[elinks/kon.git] / doc / Makefile
blob792591c9dc7aee6c1078c21db7577098554beead
1 top_builddir=..
2 include $(top_builddir)/Makefile.config
4 SUBDIRS = man
6 # A little trick to simplify some of the rules.
7 VPATH = $(builddir):$(srcdir):$(top_srcdir)/contrib/perl
9 docdir = $(datadir)/doc
11 # Used by install-doc
12 HTML_DIR = $(DESTDIR)$(docdir)/$(PACKAGE)/html
13 PDF_DIR = $(DESTDIR)$(docdir)/$(PACKAGE)/pdf
14 TXT_DIR = $(DESTDIR)$(docdir)/$(PACKAGE)/txt
16 ASCIIDOC_CONF = $(srcdir)asciidoc.conf
17 ASCIIDOC_FLAGS += -f $(ASCIIDOC_CONF) \
18 -a "builddir=$(CURDIR)/" \
19 -a asciidoc7compatible \
20 -a elinks_version=$(VERSION)
22 #############################################################################
23 # Build files
25 TXT_DOCS_NOINSTALL = \
26 features.txt \
27 keymap-actions.txt \
28 keymap-defaults.txt \
30 TXT_DOCS_ASIS = \
31 python.txt
33 HTML_DOCS-$(CONFIG_ASCIIDOC) += \
34 elinks.1.html \
35 elinks.conf.5.html \
36 elinkskeys.5.html \
37 hacking.html \
38 manual.html
40 HTML_DOCS-$(CONFIG_XMLTO) += \
41 manual.html-chunked
43 HTML_DOCS-$(CONFIG_POD2HTML) += \
44 perl.html \
45 perl-hooks.html
47 # We don't nowadays run pod2html on the po/perl/ scripts, because
48 # "make install" does not install them and they do not have the .pl
49 # suffix expected by the pod2html rule below.
51 MAN_DOCS-$(CONFIG_XMLTO) += \
52 elinks.1 \
53 elinks.conf.5 \
54 elinkskeys.5
56 # Use jw for generating PDF, since xmlto seems to freak out.
57 PDF_DOCS-$(CONFIG_JW) += \
58 manual.pdf
60 API_DOCS-$(CONFIG_DOXYGEN) += \
61 api/doxygen
63 #############################################################################
64 ## Set the default doc rules
66 MAN_DOCS = $(MAN_DOCS-yes)
67 HTML_DOCS = $(HTML_DOCS-yes)
68 PDF_DOCS = $(PDF_DOCS-yes)
69 API_DOCS = $(API_DOCS-yes)
71 txt: $(TXT_DOCS_NOINSTALL)
72 html: txt $(HTML_DOCS)
73 pdf: txt $(PDF_DOCS)
74 man: txt $(MAN_DOCS)
75 api: $(API_DOCS)
77 all-docs: man html pdf
79 install-doc: all-docs update-man install
80 @$(foreach doc,$(HTML_DOCS), \
81 if test -d $(doc); then \
82 $(MKINSTALLDIRS) $(DESTDIR)$(docdir)/$(PACKAGE)/html/$(doc); \
83 $(call ncmd,installdata,$(doc)/*,$(HTML_DIR)/$(doc)); \
84 else \
85 $(MKINSTALLDIRS) $(DESTDIR)$(docdir)/$(PACKAGE)/html; \
86 $(call ncmd,installdata,$(doc),$(HTML_DIR)); \
87 fi;)
88 @$(foreach doc,$(PDF_DOCS), \
89 $(MKINSTALLDIRS) $(DESTDIR)$(docdir)/$(PACKAGE)/pdf; \
90 $(call ncmd,installdata,$(doc),$(PDF_DIR));)
91 @$(foreach doc,$(TXT_DOCS_ASIS), \
92 $(MKINSTALLDIRS) $(DESTDIR)$(docdir)/$(PACKAGE)/txt; \
93 $(call ncmd,installdata,$(srcdir)$(doc),$(TXT_DIR));)
95 update-man: man
96 @$(if $(MAN_DOCS), \
97 $(call ncmd,installdata,elinks.1,$(srcdir)man/man1/elinks.1.in); \
98 $(call ncmd,installdata,elinkskeys.5,$(srcdir)man/man5/); \
99 $(call ncmd,installdata,elinks.conf.5,$(srcdir)man/man5/))
101 clean-local:
102 @$(RM) -r api $(TXT_DOCS_NOINSTALL) $(MAN_DOCS) $(HTML_DOCS) $(PDF_DOCS) *.tmp *.xml
104 # TODO: perl.pod should be pod2ized during make install. --pasky
105 install-local:
107 #############################################################################
108 # Generated asciidoc files
110 # Scripts and Dependencies
111 HELP2XML = $(srcdir)tools/help2xml
112 CONF2DOC = $(srcdir)tools/conf2doc
113 KEYS2DOC = $(srcdir)tools/keys2doc
114 ELINKS = $(top_builddir)/src/elinks
115 FEATURES = $(top_srcdir)/features.conf
116 KBDBIND = $(top_srcdir)/src/config/kbdbind.c
118 # Locale env vars to override system one to ensure commands
119 # using elinks binary will generate texts in english
120 LOCALES = LC_ALL=C LANGUAGE=en
122 # FIXME: Keep generated .txt files relative to the source directory and files
123 # they are included in.
124 quiet_cmd_help2xml = ' [$(LINK_COLOR)HELP2XML$(END_COLOR)] $(RELPATH)$@'
125 cmd_help2xml = $(LOCALES) $(HELP2XML) $(ELINKS) $@
127 quiet_cmd_conf2doc = ' [$(LINK_COLOR)CONF2DOC$(END_COLOR)] $(RELPATH)$@'
128 cmd_conf2doc = $(LOCALES) $(CONF2DOC) $(FEATURES) > $@
130 quiet_cmd_keys2doc = ' [$(LINK_COLOR)KEYS2DOC$(END_COLOR)] $(RELPATH)$@'
131 cmd_keys2doc = $(LOCALES) $(KEYS2DOC) $(KBDBIND) $@ > $@
133 features.txt: $(FEATURES) $(CONF2DOC)
134 $(call cmd,conf2doc)
136 keymap-%.txt: $(KBDBIND) $(KEYS2DOC)
137 $(call cmd,keys2doc)
139 option-%.frag.xml: $(ELINKS) $(HELP2XML)
140 $(call cmd,help2xml)
142 option-%.frag.xhtml: $(ELINKS) $(HELP2XML)
143 $(call cmd,help2xml)
145 #############################################################################
146 # Build commands and macros
148 quiet_cmd_jw = ' [$(LINK_COLOR)JW$(END_COLOR)] $(RELPATH)$@'
149 cmd_jw = $(JW) -b $(2) $<
151 quiet_cmd_xmlto = ' [$(LINK_COLOR)XMLTO$(END_COLOR)] $(RELPATH)$@'
152 cmd_xmlto = $(XMLTO) -o $(call outdir) $(3) $(2) $<
154 quiet_cmd_pod2html = ' [$(LINK_COLOR)POD2HTML$(END_COLOR)] $(RELPATH)$@'
155 cmd_pod2html = $(POD2HTML) --outfile=$@ < $<
157 quiet_cmd_asciidoc = ' [$(LINK_COLOR)ASCIIDOC$(END_COLOR)] $(RELPATH)$@'
158 cmd_asciidoc = $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b $(call backend) -d $(call doctype) -o $@ $<
160 quiet_cmd_doxygen = ' [$(LINK_COLOR)DOXYGEN$(END_COLOR)] $(RELPATH)$@'
161 cmd_doxygen = $(DOXYGEN) $(2)
163 # Based on $@ find out asciidoc doctype or backend + xmlto output dir.
164 doctype = $(if $(findstring .1.,$@)$(findstring .5.,$@),manpage,book)
165 backend = $(if $(findstring .xml,$@),docbook,xhtml11)
166 outdir = $(if $(findstring -chunked,$@),$@,.)
168 # Loosely track dependencies via asciidoc includes.
169 asciidoc_dep = sed -n 's/[{]builddir}//g;s@include1\{0,1\}::\(.*\)\[.*@$@: $< \1@p' < $< > .deps/$(@F).asciidoc
171 -include .deps/*.asciidoc
174 #############################################################################
175 # Build recipies
177 %.html: %.txt $(ASCIIDOC_CONF)
178 $(call cmd,asciidoc,xhtml11)
179 @-$(call asciidoc_dep)
181 %.xml: %.txt $(ASCIIDOC_CONF)
182 $(call cmd,asciidoc,docbook)
183 @-$(call asciidoc_dep)
185 # asciidoc_dep above also generates these dependencies, but it runs
186 # only after asciidoc has succeeded, which won't happen if the files
187 # are missing.
188 elinks.1.xml: option-command.frag.xml
189 elinks.conf.5.xml: option-config.frag.xml
190 elinks.1.html: option-command.frag.xhtml
191 elinks.conf.5.html: option-config.frag.xhtml
193 %.1: %.1.xml
194 $(call cmd,xmlto,man)
196 %.5: %.5.xml
197 $(call cmd,xmlto,man)
199 %.html-chunked: %.xml
200 $(call cmd,xmlto,html)
202 %.pdf: %.xml
203 $(call cmd,jw,pdf)
205 %.html: %.pod
206 $(call cmd,pod2html)
208 perl-%.html: %.pl
209 $(call cmd,pod2html)
211 Doxyfile: $(srcdir)Doxyfile.in $(top_srcdir)/configure.in
212 cd $(top_builddir) && \
213 CONFIG_FILES="$(RELPATH)$@" CONFIG_HEADERS= $(SHELL) ./config.status
215 api/doxygen: Doxyfile $(shell find $(top_srcdir)/src/ -name '*.[ch]' -o -name options.inc -o -name 'actions-*.inc' | sort)
216 $(call cmd,doxygen,$<)
218 include $(top_srcdir)/Makefile.lib