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 asciidoc7compatible \
22 -a elinks_version
=$(VERSION
)
24 #############################################################################
27 TXT_DOCS_NOINSTALL
= \
35 HTML_DOCS-
$(CONFIG_ASCIIDOC
) += \
42 HTML_DOCS-
$(CONFIG_XMLTO
) += \
45 HTML_DOCS-
$(CONFIG_POD2HTML
) += \
49 # We don't nowadays run pod2html on the po/perl/ scripts, because
50 # "make install" does not install them and they do not have the .pl
51 # suffix expected by the pod2html rule below.
53 MAN_DOCS-
$(CONFIG_XMLTO
) += \
58 # Use jw for generating PDF, since xmlto seems to freak out.
59 PDF_DOCS-
$(CONFIG_JW
) += \
62 API_DOCS-
$(CONFIG_DOXYGEN
) += \
65 #############################################################################
66 ## Set the default doc rules
68 MAN_DOCS
= $(MAN_DOCS-yes
)
69 HTML_DOCS
= $(HTML_DOCS-yes
)
70 PDF_DOCS
= $(PDF_DOCS-yes
)
71 API_DOCS
= $(API_DOCS-yes
)
73 txt
: $(TXT_DOCS_NOINSTALL
)
74 html
: txt
$(HTML_DOCS
)
79 all-docs
: man html pdf
81 install-doc
: all-docs update-man
install
82 @
$(foreach doc
,$(HTML_DOCS
), \
83 if
test -d
$(doc
); then \
84 $(MKINSTALLDIRS
) $(DESTDIR
)$(docdir
)/$(PACKAGE
)/html
/$(doc
); \
85 $(call ncmd
,installdata
,$(doc
)/*,$(HTML_DIR
)/$(doc
)); \
87 $(MKINSTALLDIRS
) $(DESTDIR
)$(docdir
)/$(PACKAGE
)/html
; \
88 $(call ncmd
,installdata
,$(doc
),$(HTML_DIR
)); \
90 @
$(foreach doc
,$(PDF_DOCS
), \
91 $(MKINSTALLDIRS
) $(DESTDIR
)$(docdir
)/$(PACKAGE
)/pdf
; \
92 $(call ncmd
,installdata
,$(doc
),$(PDF_DIR
));)
93 @
$(foreach doc
,$(TXT_DOCS_ASIS
), \
94 $(MKINSTALLDIRS
) $(DESTDIR
)$(docdir
)/$(PACKAGE
)/txt
; \
95 $(call ncmd
,installdata
,$(srcdir)$(doc
),$(TXT_DIR
));)
99 $(call ncmd
,installdata
,elinks
.1,$(srcdir)man
/man1
/elinks
.1.in
); \
100 $(call ncmd
,installdata
,elinkskeys
.5,$(srcdir)man
/man5
/); \
101 $(call ncmd
,installdata
,elinks.conf
.5,$(srcdir)man
/man5
/))
104 @
$(RM
) -r api
$(TXT_DOCS_NOINSTALL
) $(MAN_DOCS
) $(HTML_DOCS
) $(PDF_DOCS
) *.tmp
*.xml
106 # TODO: perl.pod should be pod2ized during make install. --pasky
109 #############################################################################
110 # Generated asciidoc files
112 # Scripts and Dependencies
113 HELP2XML
= $(srcdir)tools
/help2xml
114 CONF2DOC
= $(srcdir)tools
/conf2doc
115 KEYS2DOC
= $(srcdir)tools
/keys2doc
116 ELINKS
= $(top_builddir
)/src
/elinks
117 FEATURES
= $(top_srcdir
)/features.conf
118 KBDBIND
= $(top_srcdir
)/src
/config
/kbdbind.c
120 # Locale env vars to override system one to ensure commands
121 # using elinks binary will generate texts in english
122 LOCALES
= LC_ALL
=C LANGUAGE
=en
124 # FIXME: Keep generated .txt files relative to the source directory and files
125 # they are included in.
126 quiet_cmd_help2xml
= ' [$(LINK_COLOR)HELP2XML$(END_COLOR)] $(RELPATH)$@'
127 cmd_help2xml
= $(LOCALES
) $(HELP2XML
) $(ELINKS
) $@
129 quiet_cmd_conf2doc
= ' [$(LINK_COLOR)CONF2DOC$(END_COLOR)] $(RELPATH)$@'
130 cmd_conf2doc
= $(LOCALES
) $(CONF2DOC
) $(FEATURES
) > $@
132 quiet_cmd_keys2doc
= ' [$(LINK_COLOR)KEYS2DOC$(END_COLOR)] $(RELPATH)$@'
133 cmd_keys2doc
= $(LOCALES
) $(KEYS2DOC
) $(KBDBIND
) $@
> $@
135 features.txt
: $(FEATURES
) $(CONF2DOC
)
138 keymap-
%.txt
: $(KBDBIND
) $(KEYS2DOC
)
141 option-
%.frag.xml
: $(ELINKS
) $(HELP2XML
)
144 option-
%.frag.xhtml
: $(ELINKS
) $(HELP2XML
)
147 #############################################################################
148 # Build commands and macros
150 quiet_cmd_jw
= ' [$(LINK_COLOR)JW$(END_COLOR)] $(RELPATH)$@'
151 cmd_jw
= $(JW
) -b
$(2) $<
153 quiet_cmd_xmlto
= ' [$(LINK_COLOR)XMLTO$(END_COLOR)] $(RELPATH)$@'
154 cmd_xmlto
= $(XMLTO
) -o
$(call outdir
) $(3) $(2) $<
156 quiet_cmd_pod2html
= ' [$(LINK_COLOR)POD2HTML$(END_COLOR)] $(RELPATH)$@'
157 cmd_pod2html
= $(POD2HTML
) --outfile
=$@
< $<
159 quiet_cmd_asciidoc
= ' [$(LINK_COLOR)ASCIIDOC$(END_COLOR)] $(RELPATH)$@'
160 cmd_asciidoc
= $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b
$(call backend
) -d
$(call doctype
) -o
$@
$<
162 quiet_cmd_doxygen
= ' [$(LINK_COLOR)DOXYGEN$(END_COLOR)] $(RELPATH)$@'
163 cmd_doxygen
= $(DOXYGEN
) $(2)
165 # Based on $@ find out asciidoc doctype or backend + xmlto output dir.
166 doctype
= $(if
$(findstring .1.
,$@
)$(findstring .5.
,$@
),manpage
,book
)
167 backend
= $(if
$(findstring .xml
,$@
),docbook
,xhtml11
)
168 outdir
= $(if
$(findstring -chunked
,$@
),$@
,.
)
170 # Loosely track dependencies via asciidoc includes.
171 asciidoc_dep
= sed
-n
's/[{]builddir}//g;s@include1\{0,1\}::\(.*\)\[.*@$@: $< \1@p' < $< > .deps
/$(@F
).asciidoc
173 -include .deps
/*.asciidoc
176 #############################################################################
179 %.html
: %.txt
$(ASCIIDOC_CONF
)
180 $(call cmd
,asciidoc
,xhtml11
)
181 @
-$(call asciidoc_dep
)
183 %.xml
: %.txt
$(ASCIIDOC_CONF
)
184 $(call cmd
,asciidoc
,docbook
)
185 @
-$(call asciidoc_dep
)
187 # asciidoc_dep above also generates these dependencies, but it runs
188 # only after asciidoc has succeeded, which won't happen if the files
190 elinks
.1.xml
: option-command.frag.xml
191 elinks.conf
.5.xml
: option-config.frag.xml
192 elinks
.1.html
: option-command.frag.xhtml
193 elinks.conf
.5.html
: option-config.frag.xhtml
196 $(call cmd
,xmlto
,man
)
199 $(call cmd
,xmlto
,man
)
201 %.html-chunked
: %.xml
202 $(call cmd
,xmlto
,html
)
213 Doxyfile
: $(srcdir)Doxyfile.in
$(top_srcdir
)/configure.in
214 cd
$(top_builddir
) && \
215 CONFIG_FILES
="$(RELPATH)$@" CONFIG_HEADERS
= $(SHELL
) .
/config.status
217 api
/doxygen
: Doxyfile
$(shell find
$(top_srcdir
)/src
/ -name
'*.[ch]' -o
-name options.inc
-o
-name
'actions-*.inc' |
sort)
218 $(call cmd
,doxygen
,$<)
220 include $(top_srcdir
)/Makefile.lib