2 include $(top_builddir
)/Makefile.config
6 # A little trick to simplify some of the rules.
7 VPATH
= $(builddir
):$(srcdir):$(top_srcdir
)/contrib
/perl
9 docdir
= $(datadir)/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
+= --no-conf
-f
$(srcdir)tools
/asciidoc
/asciidoc.conf \
18 -f
$(srcdir)tools
/asciidoc
/$(call backend
).conf \
20 -a
"builddir=$(CURDIR)/" \
21 -a elinks_version
=$(VERSION
)
23 #############################################################################
26 TXT_DOCS_NOINSTALL
= \
34 HTML_DOCS-
$(CONFIG_ASCIIDOC
) += \
41 HTML_DOCS-
$(CONFIG_XMLTO
) += \
44 HTML_DOCS-
$(CONFIG_POD2HTML
) += \
48 # We don't nowadays run pod2html on the po/perl/ scripts, because
49 # "make install" does not install them and they do not have the .pl
50 # suffix expected by the pod2html rule below.
52 MAN_DOCS-
$(CONFIG_XMLTO
) += \
57 # Use jw for generating PDF, since xmlto seems to freak out.
58 PDF_DOCS-
$(CONFIG_JW
) += \
61 API_DOCS-
$(CONFIG_DOXYGEN
) += \
64 #############################################################################
65 ## Set the default doc rules
67 MAN_DOCS
= $(MAN_DOCS-yes
)
68 HTML_DOCS
= $(HTML_DOCS-yes
)
69 PDF_DOCS
= $(PDF_DOCS-yes
)
70 API_DOCS
= $(API_DOCS-yes
)
72 txt
: $(TXT_DOCS_NOINSTALL
)
73 html
: txt
$(HTML_DOCS
)
78 all-docs
: man html pdf
80 install-doc
: all-docs update-man
install
81 @
$(foreach doc
,$(HTML_DOCS
), \
82 if
test -d
$(doc
); then \
83 $(MKINSTALLDIRS
) $(DESTDIR
)$(docdir
)/$(PACKAGE
)/html
/$(doc
); \
84 $(call ncmd
,installdata
,$(doc
)/*,$(HTML_DIR
)/$(doc
)); \
86 $(MKINSTALLDIRS
) $(DESTDIR
)$(docdir
)/$(PACKAGE
)/html
; \
87 $(call ncmd
,installdata
,$(doc
),$(HTML_DIR
)); \
89 @
$(foreach doc
,$(PDF_DOCS
), \
90 $(MKINSTALLDIRS
) $(DESTDIR
)$(docdir
)/$(PACKAGE
)/pdf
; \
91 $(call ncmd
,installdata
,$(doc
),$(PDF_DIR
));)
92 @
$(foreach doc
,$(TXT_DOCS_ASIS
), \
93 $(MKINSTALLDIRS
) $(DESTDIR
)$(docdir
)/$(PACKAGE
)/txt
; \
94 $(call ncmd
,installdata
,$(srcdir)$(doc
),$(TXT_DIR
));)
98 $(call ncmd
,installdata
,elinks
.1,$(srcdir)man
/man1
/elinks
.1.in
); \
99 $(call ncmd
,installdata
,elinkskeys
.5,$(srcdir)man
/man5
/); \
100 $(call ncmd
,installdata
,elinks.conf
.5,$(srcdir)man
/man5
/))
103 @
$(RM
) -r api
$(TXT_DOCS_NOINSTALL
) $(MAN_DOCS
) $(HTML_DOCS
) $(PDF_DOCS
) *.tmp
*.xml
105 # TODO: perl.pod should be pod2ized during make install. --pasky
108 #############################################################################
109 # Generated asciidoc files
111 # Scripts and Dependencies
112 HELP2XML
= $(srcdir)tools
/help2xml
113 CONF2DOC
= $(srcdir)tools
/conf2doc
114 KEYS2DOC
= $(srcdir)tools
/keys2doc
115 ELINKS
= $(top_builddir
)/src
/elinks
116 FEATURES
= $(top_srcdir
)/features.conf
117 KBDBIND
= $(top_srcdir
)/src
/config
/kbdbind.c
119 # Locale env vars to override system one to ensure commands
120 # using elinks binary will generate texts in english
121 LOCALES
= LC_ALL
=C LANGUAGE
=en
123 # FIXME: Keep generated .txt files relative to the source directory and files
124 # they are included in.
125 quiet_cmd_help2xml
= ' [$(LINK_COLOR)HELP2XML$(END_COLOR)] $(RELPATH)$@'
126 cmd_help2xml
= $(LOCALES
) $(HELP2XML
) $(ELINKS
) $@
128 quiet_cmd_conf2doc
= ' [$(LINK_COLOR)CONF2DOC$(END_COLOR)] $(RELPATH)$@'
129 cmd_conf2doc
= $(LOCALES
) $(CONF2DOC
) $(FEATURES
) > $@
131 quiet_cmd_keys2doc
= ' [$(LINK_COLOR)KEYS2DOC$(END_COLOR)] $(RELPATH)$@'
132 cmd_keys2doc
= $(LOCALES
) $(KEYS2DOC
) $(KBDBIND
) $@
> $@
134 features.txt
: $(FEATURES
) $(CONF2DOC
)
137 keymap-
%.txt
: $(KBDBIND
) $(KEYS2DOC
)
140 option-
%.frag.xml
: $(ELINKS
) $(HELP2XML
)
143 option-
%.frag.xhtml
: $(ELINKS
) $(HELP2XML
)
146 #############################################################################
147 # Build commands and macros
149 quiet_cmd_jw
= ' [$(LINK_COLOR)JW$(END_COLOR)] $(RELPATH)$@'
150 cmd_jw
= $(JW
) -b
$(2) $<
152 quiet_cmd_xmlto
= ' [$(LINK_COLOR)XMLTO$(END_COLOR)] $(RELPATH)$@'
153 cmd_xmlto
= $(XMLTO
) -o
$(call outdir
) $(3) $(2) $<
155 quiet_cmd_pod2html
= ' [$(LINK_COLOR)POD2HTML$(END_COLOR)] $(RELPATH)$@'
156 cmd_pod2html
= $(POD2HTML
) --outfile
=$@
< $<
158 quiet_cmd_asciidoc
= ' [$(LINK_COLOR)ASCIIDOC$(END_COLOR)] $(RELPATH)$@'
159 cmd_asciidoc
= $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b
$(call backend
) -d
$(call doctype
) -o
$@
$<
161 quiet_cmd_doxygen
= ' [$(LINK_COLOR)DOXYGEN$(END_COLOR)] $(RELPATH)$@'
162 cmd_doxygen
= $(DOXYGEN
) $(2)
164 # Based on $@ find out asciidoc doctype or backend + xmlto output dir.
165 doctype
= $(if
$(findstring .1.
,$@
)$(findstring .5.
,$@
),manpage
,book
)
166 backend
= $(if
$(findstring .xml
,$@
),docbook
,xhtml11
)
167 outdir
= $(if
$(findstring -chunked
,$@
),$@
,.
)
169 # Loosely track dependencies via asciidoc includes.
170 asciidoc_dep
= sed
-n
's/[{]builddir}//g;s@include1\{0,1\}::\(.*\)\[.*@$@: $< \1@p' < $< > .deps
/$(@F
).asciidoc
172 -include .deps
/*.asciidoc
175 #############################################################################
178 %.html
: %.txt
$(ASCIIDOC_CONF
)
179 $(call cmd
,asciidoc
,xhtml11
)
180 @
-$(call asciidoc_dep
)
182 %.xml
: %.txt
$(ASCIIDOC_CONF
)
183 $(call cmd
,asciidoc
,docbook
)
184 @
-$(call asciidoc_dep
)
186 # asciidoc_dep above also generates these dependencies, but it runs
187 # only after asciidoc has succeeded, which won't happen if the files
189 elinks
.1.xml
: option-command.frag.xml
190 elinks.conf
.5.xml
: option-config.frag.xml
191 elinks
.1.html
: option-command.frag.xhtml
192 elinks.conf
.5.html
: option-config.frag.xhtml
195 $(call cmd
,xmlto
,man
)
198 $(call cmd
,xmlto
,man
)
200 %.html-chunked
: %.xml
201 $(call cmd
,xmlto
,html
)
212 Doxyfile
: $(srcdir)Doxyfile.in
$(top_srcdir
)/configure.in
213 cd
$(top_builddir
) && \
214 CONFIG_FILES
="$(RELPATH)$@" CONFIG_HEADERS
= $(SHELL
) .
/config.status
216 api
/doxygen
: Doxyfile
$(shell find
$(top_srcdir
)/src
/ -name
'*.[ch]' -o
-name options.inc
-o
-name
'actions-*.inc' |
sort)
217 $(call cmd
,doxygen
,$<)
219 include $(top_srcdir
)/Makefile.lib