1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00
elinks/doc/Makefile

193 lines
4.4 KiB
Makefile
Raw Normal View History

2005-10-19 22:00:35 -04:00
top_builddir=..
include $(top_builddir)/Makefile.config
SUBDIRS = man
VPATH = $(builddir):$(srcdir):$(top_srcdir)/contrib/perl
#export PATH="tools:$(PATH)"
# TODO: perl.pod should be pod2ized during make install. --pasky
### Script Dependencies
#
ELINKS = $(top_builddir)/src/elinks
FEATURES = $(top_srcdir)/features.conf
KBDBIND = $(top_srcdir)/src/config/kbdbind.c
### Locale env vars to override system one to ensure commands
# using elinks binary will generate texts in english
#
LOCALES = LC_ALL=C LANGUAGE=en
### Scripts
#
CODE2DOC = $(top_srcdir)/doc/tools/code2doc
HELP2DOC = $(top_srcdir)/doc/tools/help2doc
IMPORT_FEATURES_CONF = $(top_srcdir)/doc/tools/import-features.conf
TXT_DOCS = \
bookmarks.txt \
ecmascript.txt \
elinks.1.txt \
elinkskeys.5.txt \
exmode.txt \
faq.txt \
installation.txt \
introduction.txt \
lua-scripting.txt \
mailcap.txt \
manual.txt \
marks.txt \
mime.txt \
remote.txt \
small.txt \
tabs.txt \
terminals.txt \
urlshortcuts.txt
GEN_TXT_DOCS = \
import-features.conf.txt \
option-command.txt \
option-config.txt \
keymap-defaults.txt \
keymap-actions.txt
TXT_DOCS += $(GEN_TXT_DOCS)
2006-01-08 15:46:21 -05:00
HTML_DOCS-$(CONFIG_ASCIIDOC) += \
2006-01-08 15:57:55 -05:00
elinks.1.html \
elinks.conf.5.html \
2006-01-08 15:57:55 -05:00
elinkskeys.5.html \
hacking.html \
manual.html
2006-01-08 15:46:21 -05:00
HTML_DOCS-$(CONFIG_XMLTO) += \
2006-01-08 15:57:55 -05:00
manual.html-chunked
HTML_DOCS-$(CONFIG_POD2HTML) += \
perl.html \
perl-hooks.html \
2006-01-08 15:46:21 -05:00
MAN_DOCS-$(CONFIG_XMLTO) += \
elinks.1 \
elinks.conf.5 \
elinkskeys.5
2005-09-15 22:38:48 -04:00
# Only jw is used for generating PDF.
2006-01-08 15:46:21 -05:00
PDF_DOCS-$(CONFIG_JW) += \
2006-01-08 15:57:55 -05:00
manual.pdf
## API Docs
#
ifneq ($(findstring api,$(MAKECMDGOALS)),)
API = $(shell find $(top_srcdir)/src/ -name '*.h' -exec grep -q 'API Doc' \{\} \; -printf "%p " | sort)
endif
define api_doc
api/$(2).txt: $(1)
@$(CODE2DOC) $(1) > $$@
API_TXT += api/$(2).txt
endef
$(foreach api,$(API),$(eval $(call api_doc,$(api),$(shell sed -n 's/.*API Doc\s*::\s*\([^ ]*\).*/\1/p' < $(api)),)))
## Se the default doc rules
MAN_DOCS = elinks.conf.5 $(MAN_DOCS-yes)
HTML_DOCS = $(HTML_DOCS-yes)
PDF_DOCS = $(PDF_DOCS-yes)
API_DOCS = $(patsubst %.txt,%.html,$(API_TXT))
api-dir:
@test -d api || $(MKINSTALLDIRS) api
txt: $(addprefix $(srcdir),$(TXT_DOCS))
html: txt $(HTML_DOCS)
pdf: txt $(PDF_DOCS)
2006-01-12 04:29:05 -05:00
man: txt $(MAN_DOCS)
api: api-dir $(API_DOCS)
all-docs: man html pdf
2006-01-12 04:29:05 -05:00
update-man: man
$(call cmd,installdata,$(srcdir)elinks.1,man/man1/elinks.1.in)
$(call cmd,installdata,$(srcdir)elinkskeys.5,man/man5/)
$(call cmd,installdata,$(srcdir)elinks.conf.5,man/man5/)
clean-local:
@$(RM) -r api $(GEN_TXT_DOCS) $(MAN_DOCS) $(HTML_DOCS) $(PDF_DOCS) *.tmp
# Autogenerated files.
# FIXME: Keep generated .txt files relative to the source directory and files
# they are included in.
2006-01-12 04:29:05 -05:00
quiet_cmd_help2doc = ' [$(LINK_COLOR)HELP2DOC$(END_COLOR)] $(RELPATH)$@'
cmd_help2doc = $(LOCALES) $(HELP2DOC) $(ELINKS) $@ > $@
import-features.conf.txt: $(FEATURES) $(IMPORT_FEATURES_CONF)
$(IMPORT_FEATURES_CONF) > $@
keymap-defaults.txt keymap-actions.txt: $(MAKE_ELINKSKEYS_MANPAGE) $(KBDBIND)
$(LOCALES) $(srcdir)tools/make-elinkskeys-manpage $(KBDBIND)
option-%.txt: $(ELINKS) $(HELP2DOC)
2006-01-12 04:29:05 -05:00
$(call cmd,help2doc)
## Default build rules
#
quiet_cmd_asciidoc = ' [$(LINK_COLOR)ASCIIDOC$(END_COLOR)] $(RELPATH)$@'
cmd_asciidoc = $(ASCIIDOC) -f asciidoc.conf -b $(2) -d $(call doctype,$<) -o $@ $<
quiet_cmd_xmlto = ' [$(LINK_COLOR)XMLTO$(END_COLOR)] $(RELPATH)$@'
cmd_xmlto = $(XMLTO) $(3) $(2) $<
quiet_cmd_jw = ' [$(LINK_COLOR)JW$(END_COLOR)] $(RELPATH)$@'
cmd_jw = $(JW) -b $(2) $<
quiet_cmd_pod2html = ' [$(LINK_COLOR)POD2HTML$(END_COLOR)] $(RELPATH)$@'
cmd_pod2html = $(POD2HTML) --outfile=$@ < $<
doctype = $(if $(findstring .1.,$(1)),manpage,$(if $(findstring .5.,$(1)),manpage,book))
2006-01-12 04:29:05 -05:00
MAN_DATE = $(shell date -I)
man_desc = `sed -n 's/:Description:\s*\(.*\)/\1/p' < $(subst .xml,.txt,$<)`
man_hack = sed "s/^\(\.TH \"ELINKS[^\"]*\" [0-9] \).*/\1\"$(1)\" \"$(MAN_DATE)\" \"$(1)\"/" < $@ | \
sed "s/@squote@/\\\\'/g" > $@.tmp && mv $@.tmp $@
%.html: %.txt asciidoc.conf
2006-01-11 05:12:03 -05:00
$(call cmd,asciidoc,xhtml11)
%.xml: %.txt asciidoc.conf
2006-01-11 05:12:03 -05:00
$(call cmd,asciidoc,docbook)
%.1: %.1.xml
2006-01-11 05:12:03 -05:00
$(call cmd,xmlto,man)
2006-01-12 04:29:05 -05:00
$(call man_hack,$(call man_desc))
%.5: %.5.xml
2006-01-11 05:12:03 -05:00
$(call cmd,xmlto,man)
2006-01-12 04:29:05 -05:00
$(call man_hack,$(call man_desc))
%.html-chunked: %.xml
2006-01-11 05:12:03 -05:00
$(call cmd,xmlto,html,-o $@)
2005-09-15 22:38:48 -04:00
%.pdf: %.xml
2006-01-11 05:12:03 -05:00
$(call cmd,jw,pdf)
%.html: %.pod
2006-01-11 05:12:03 -05:00
$(call cmd,pod2html)
perl-%.html: %.pl
2006-01-11 05:12:03 -05:00
$(call cmd,pod2html)
include $(top_srcdir)/Makefile.lib