mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Simplify further; only list generated files; move things around; comment
This commit is contained in:
parent
63f4a15d91
commit
75bf42bfe0
206
doc/Makefile
206
doc/Makefile
@ -3,60 +3,18 @@ include $(top_builddir)/Makefile.config
|
|||||||
|
|
||||||
SUBDIRS = man
|
SUBDIRS = man
|
||||||
|
|
||||||
|
# A little trick to simplify some of the rules.
|
||||||
VPATH = $(builddir):$(srcdir):$(top_srcdir)/contrib/perl
|
VPATH = $(builddir):$(srcdir):$(top_srcdir)/contrib/perl
|
||||||
|
|
||||||
#export PATH="tools:$(PATH)"
|
#############################################################################
|
||||||
|
# Build files
|
||||||
# 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 = \
|
TXT_DOCS = \
|
||||||
bookmarks.txt \
|
features.txt \
|
||||||
ecmascript.txt \
|
keymap-actions.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-defaults.txt \
|
||||||
keymap-actions.txt
|
option-command.txt \
|
||||||
|
option-config.txt
|
||||||
TXT_DOCS += $(GEN_TXT_DOCS)
|
|
||||||
|
|
||||||
HTML_DOCS-$(CONFIG_ASCIIDOC) += \
|
HTML_DOCS-$(CONFIG_ASCIIDOC) += \
|
||||||
elinks.1.html \
|
elinks.1.html \
|
||||||
@ -77,20 +35,83 @@ MAN_DOCS-$(CONFIG_XMLTO) += \
|
|||||||
elinks.conf.5 \
|
elinks.conf.5 \
|
||||||
elinkskeys.5
|
elinkskeys.5
|
||||||
|
|
||||||
|
# Use jw for generating PDF, since xmlto seems to freak out.
|
||||||
# Only jw is used for generating PDF.
|
|
||||||
PDF_DOCS-$(CONFIG_JW) += \
|
PDF_DOCS-$(CONFIG_JW) += \
|
||||||
manual.pdf
|
manual.pdf
|
||||||
|
|
||||||
## API Docs
|
|
||||||
#
|
|
||||||
|
|
||||||
ifneq ($(findstring api,$(MAKECMDGOALS)),)
|
#############################################################################
|
||||||
|
## Set the default doc rules
|
||||||
|
|
||||||
|
MAN_DOCS = $(MAN_DOCS-yes)
|
||||||
|
HTML_DOCS = $(HTML_DOCS-yes)
|
||||||
|
PDF_DOCS = $(PDF_DOCS-yes)
|
||||||
|
|
||||||
|
txt: $(TXT_DOCS)
|
||||||
|
html: txt $(HTML_DOCS)
|
||||||
|
pdf: txt $(PDF_DOCS)
|
||||||
|
man: txt $(MAN_DOCS)
|
||||||
|
|
||||||
|
all-docs: man html pdf
|
||||||
|
|
||||||
|
update-man: man
|
||||||
|
$(call cmd,installdata,elinks.1,man/man1/elinks.1.in)
|
||||||
|
$(call cmd,installdata,elinkskeys.5,man/man5/)
|
||||||
|
$(call cmd,installdata,elinks.conf.5,man/man5/)
|
||||||
|
|
||||||
|
clean-local:
|
||||||
|
@$(RM) -r api $(TXT_DOCS) $(MAN_DOCS) $(HTML_DOCS) $(PDF_DOCS) *.tmp *.xml
|
||||||
|
|
||||||
|
# TODO: perl.pod should be pod2ized during make install. --pasky
|
||||||
|
install-local:
|
||||||
|
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
# Generated asciidoc files
|
||||||
|
|
||||||
|
# Scripts and Dependencies
|
||||||
|
CODE2DOC = $(srcdir)tools/code2doc
|
||||||
|
HELP2DOC = $(srcdir)tools/help2doc
|
||||||
|
IMPORT_FEATURES_CONF = $(srcdir)tools/import-features.conf
|
||||||
|
MAKE_ELINKSKEYS_MANPAGE = $(srcdir)tools/make-elinkskeys-manpage
|
||||||
|
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
|
||||||
|
|
||||||
|
# FIXME: Keep generated .txt files relative to the source directory and files
|
||||||
|
# they are included in.
|
||||||
|
quiet_cmd_help2doc = ' [$(LINK_COLOR)HELP2DOC$(END_COLOR)] $(RELPATH)$@'
|
||||||
|
cmd_help2doc = $(LOCALES) $(HELP2DOC) $(ELINKS) $@ > $@
|
||||||
|
|
||||||
|
quiet_cmd_conf2doc = ' [$(LINK_COLOR)CONF2DOC$(END_COLOR)] $(RELPATH)$@'
|
||||||
|
cmd_conf2doc = $(IMPORT_FEATURES_CONF) > $@
|
||||||
|
|
||||||
|
quiet_cmd_keys2doc = ' [$(LINK_COLOR)KEYS2DOC$(END_COLOR)] $(RELPATH)$@'
|
||||||
|
cmd_keys2doc = $(LOCALES) $(MAKE_ELINKSKEYS_MANPAGE) $(KBDBIND) $@ > $@
|
||||||
|
|
||||||
|
features.txt: $(FEATURES) $(IMPORT_FEATURES_CONF)
|
||||||
|
$(call cmd,conf2doc)
|
||||||
|
|
||||||
|
keymap-%.txt: $(MAKE_ELINKSKEYS_MANPAGE) $(KBDBIND)
|
||||||
|
$(call cmd,keys2doc)
|
||||||
|
|
||||||
|
option-%.txt: $(ELINKS) $(HELP2DOC)
|
||||||
|
$(call cmd,help2doc)
|
||||||
|
|
||||||
|
|
||||||
|
# API Docs
|
||||||
|
|
||||||
|
ifeq ($(findstring api,$(MAKECMDGOALS)),api)
|
||||||
API = $(shell find $(top_srcdir)/src/ -name '*.h' -exec grep -q 'API Doc' \{\} \; -printf "%p " | sort)
|
API = $(shell find $(top_srcdir)/src/ -name '*.h' -exec grep -q 'API Doc' \{\} \; -printf "%p " | sort)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
define api_doc
|
define api_doc
|
||||||
api/$(2).txt: $(1)
|
api/$(2).txt: $(1) $(CODE2DOC)
|
||||||
|
@test -d api || $(MKINSTALLDIRS) api
|
||||||
@$(CODE2DOC) $(1) > $$@
|
@$(CODE2DOC) $(1) > $$@
|
||||||
API_TXT += api/$(2).txt
|
API_TXT += api/$(2).txt
|
||||||
endef
|
endef
|
||||||
@ -98,81 +119,49 @@ endef
|
|||||||
api_name = $(shell sed -n 's/.*API Doc\s*::\s*\([^ ]*\).*/\1/p' < $(1))
|
api_name = $(shell sed -n 's/.*API Doc\s*::\s*\([^ ]*\).*/\1/p' < $(1))
|
||||||
$(foreach api,$(API),$(eval $(call api_doc,$(api),$(call api_name,$(api)))))
|
$(foreach api,$(API),$(eval $(call api_doc,$(api),$(call api_name,$(api)))))
|
||||||
|
|
||||||
|
api: $(patsubst %.txt,%.html,$(API_TXT))
|
||||||
## 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)
|
|
||||||
man: txt $(MAN_DOCS)
|
|
||||||
api: api-dir $(API_DOCS)
|
|
||||||
|
|
||||||
all-docs: man html pdf
|
|
||||||
|
|
||||||
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 *.xml
|
|
||||||
|
|
||||||
# Autogenerated files.
|
|
||||||
|
|
||||||
# FIXME: Keep generated .txt files relative to the source directory and files
|
|
||||||
# they are included in.
|
|
||||||
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) > $@
|
# Build commands and macros
|
||||||
|
|
||||||
keymap-defaults.txt keymap-actions.txt: $(MAKE_ELINKSKEYS_MANPAGE) $(KBDBIND)
|
|
||||||
$(LOCALES) $(srcdir)tools/make-elinkskeys-manpage $(KBDBIND)
|
|
||||||
|
|
||||||
option-%.txt: $(ELINKS) $(HELP2DOC)
|
|
||||||
$(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)$@'
|
quiet_cmd_jw = ' [$(LINK_COLOR)JW$(END_COLOR)] $(RELPATH)$@'
|
||||||
cmd_jw = $(JW) -b $(2) $<
|
cmd_jw = $(JW) -b $(2) $<
|
||||||
|
|
||||||
|
quiet_cmd_xmlto = ' [$(LINK_COLOR)XMLTO$(END_COLOR)] $(RELPATH)$@'
|
||||||
|
cmd_xmlto = $(XMLTO) $(3) $(2) $<
|
||||||
|
|
||||||
quiet_cmd_pod2html = ' [$(LINK_COLOR)POD2HTML$(END_COLOR)] $(RELPATH)$@'
|
quiet_cmd_pod2html = ' [$(LINK_COLOR)POD2HTML$(END_COLOR)] $(RELPATH)$@'
|
||||||
cmd_pod2html = $(POD2HTML) --outfile=$@ < $<
|
cmd_pod2html = $(POD2HTML) --outfile=$@ < $<
|
||||||
|
|
||||||
|
quiet_cmd_asciidoc = ' [$(LINK_COLOR)ASCIIDOC$(END_COLOR)] $(RELPATH)$@'
|
||||||
|
cmd_asciidoc = $(ASCIIDOC) -f asciidoc.conf -b $(2) -d $(call doctype,$<) -o $@ $<
|
||||||
|
|
||||||
|
# Based on filename in $(1) find out asciidoc doctype.
|
||||||
doctype = $(if $(findstring .1.,$(1)),manpage,$(if $(findstring .5.,$(1)),manpage,book))
|
doctype = $(if $(findstring .1.,$(1)),manpage,$(if $(findstring .5.,$(1)),manpage,book))
|
||||||
|
|
||||||
|
# Loosely track dependencies via asciidoc includes.
|
||||||
|
asciidoc_dep = sed -n 's@include::\(.*\)\[.*@$@: \1@p' < $< > .deps/$(@F).asciidoc
|
||||||
|
|
||||||
|
-include .deps/*.asciidoc
|
||||||
|
|
||||||
|
# Do a little post-processing of man pages. Inserting title headers and date.
|
||||||
MAN_DATE = $(shell date -I)
|
MAN_DATE = $(shell date -I)
|
||||||
man_desc = `sed -n 's/:Description:\s*\(.*\)/\1/p' < $(subst .xml,.txt,$<)`
|
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)\"/" < $@ | \
|
man_hack = sed "s/^\(\.TH \"ELINKS[^\"]*\" [0-9] \).*/\1\"$(1)\" \"$(MAN_DATE)\" \"$(1)\"/" < $@ | \
|
||||||
sed "s/@squote@/\\\\'/g" > $@.tmp && mv $@.tmp $@
|
sed "s/@squote@/\\\\'/g" > $@.tmp && mv $@.tmp $@
|
||||||
|
|
||||||
-include .deps/*
|
|
||||||
|
#############################################################################
|
||||||
|
# Build recipies
|
||||||
|
|
||||||
%.html: %.txt asciidoc.conf
|
%.html: %.txt asciidoc.conf
|
||||||
$(call cmd,asciidoc,xhtml11)
|
$(call cmd,asciidoc,xhtml11)
|
||||||
@-sed -n 's#include::\(.*\)\[.*#$@: \1#p' < $< > .deps/$(@F)
|
$(call asciidoc_dep)
|
||||||
|
|
||||||
%.xml: %.txt asciidoc.conf
|
%.xml: %.txt asciidoc.conf
|
||||||
$(call cmd,asciidoc,docbook)
|
$(call cmd,asciidoc,docbook)
|
||||||
@-sed -n 's#include::\(.*\)\[.*#$@: \1#p' < $< > .deps/$(@F)
|
$(call asciidoc_dep)
|
||||||
|
|
||||||
%.1: %.1.xml
|
%.1: %.1.xml
|
||||||
$(call cmd,xmlto,man)
|
$(call cmd,xmlto,man)
|
||||||
@ -194,4 +183,5 @@ man_hack = sed "s/^\(\.TH \"ELINKS[^\"]*\" [0-9] \).*/\1\"$(1)\" \"$(MAN_DATE)\"
|
|||||||
perl-%.html: %.pl
|
perl-%.html: %.pl
|
||||||
$(call cmd,pod2html)
|
$(call cmd,pod2html)
|
||||||
|
|
||||||
|
|
||||||
include $(top_srcdir)/Makefile.lib
|
include $(top_srcdir)/Makefile.lib
|
||||||
|
@ -71,6 +71,6 @@ include::small.txt[]
|
|||||||
|
|
||||||
include::ecmascript.txt[]
|
include::ecmascript.txt[]
|
||||||
|
|
||||||
include::import-features.conf.txt[]
|
include::features.txt[]
|
||||||
|
|
||||||
endif::installation-webpage[]
|
endif::installation-webpage[]
|
||||||
|
Loading…
Reference in New Issue
Block a user