2005-10-19 22:00:35 -04:00
|
|
|
top_builddir=..
|
|
|
|
include $(top_builddir)/Makefile.config
|
2005-09-15 09:58:31 -04:00
|
|
|
|
|
|
|
SUBDIRS = man
|
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
# A little trick to simplify some of the rules.
|
|
|
|
VPATH = $(builddir):$(srcdir):$(top_srcdir)/contrib/perl
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
docdir = $(datadir)/doc
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
# Used by install-doc
|
|
|
|
HTML_DIR = $(DESTDIR)$(docdir)/$(PACKAGE)/html
|
|
|
|
PDF_DIR = $(DESTDIR)$(docdir)/$(PACKAGE)/pdf
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
ASCIIDOC_CONF = $(srcdir)asciidoc.conf
|
|
|
|
ASCIIDOC_FLAGS += -f $(ASCIIDOC_CONF) -a "builddir=$(CURDIR)/"
|
2006-01-09 17:51:29 -05:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
#############################################################################
|
|
|
|
# Build files
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
TXT_DOCS = \
|
|
|
|
features.txt \
|
|
|
|
keymap-actions.txt \
|
|
|
|
keymap-defaults.txt \
|
|
|
|
option-command.txt \
|
|
|
|
option-config.txt
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-08 15:46:21 -05:00
|
|
|
HTML_DOCS-$(CONFIG_ASCIIDOC) += \
|
|
|
|
elinks.1.html \
|
2006-01-29 06:52:19 -05:00
|
|
|
elinks.conf.5.html \
|
2006-01-08 15:46:21 -05:00
|
|
|
elinkskeys.5.html \
|
|
|
|
hacking.html \
|
|
|
|
manual.html
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-08 15:46:21 -05:00
|
|
|
HTML_DOCS-$(CONFIG_XMLTO) += \
|
|
|
|
manual.html-chunked
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-08 15:46:21 -05:00
|
|
|
HTML_DOCS-$(CONFIG_POD2HTML) += \
|
|
|
|
perl.html \
|
|
|
|
perl-hooks.html
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-08 15:46:21 -05:00
|
|
|
MAN_DOCS-$(CONFIG_XMLTO) += \
|
2006-01-29 06:52:19 -05:00
|
|
|
elinks.1 \
|
|
|
|
elinks.conf.5 \
|
|
|
|
elinkskeys.5
|
2005-09-15 22:38:48 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
# Use jw for generating PDF, since xmlto seems to freak out.
|
2006-01-08 15:46:21 -05:00
|
|
|
PDF_DOCS-$(CONFIG_JW) += \
|
|
|
|
manual.pdf
|
2005-09-15 09:58:31 -04:00
|
|
|
|
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
#############################################################################
|
|
|
|
## Set the default doc rules
|
|
|
|
|
|
|
|
MAN_DOCS = $(MAN_DOCS-yes)
|
|
|
|
HTML_DOCS = $(HTML_DOCS-yes)
|
|
|
|
PDF_DOCS = $(PDF_DOCS-yes)
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
txt: $(TXT_DOCS)
|
|
|
|
html: txt $(HTML_DOCS)
|
|
|
|
pdf: txt $(PDF_DOCS)
|
|
|
|
man: txt $(MAN_DOCS)
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
all-docs: man html pdf
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
install-doc: all-docs update-man install
|
|
|
|
@$(foreach doc,$(HTML_DOCS), \
|
|
|
|
if test -d $(doc); then \
|
|
|
|
$(MKINSTALLDIRS) $(DESTDIR)$(docdir)/$(PACKAGE)/html/$(doc); \
|
|
|
|
$(call ncmd,installdata,$(doc)/*,$(HTML_DIR)/$(doc)); \
|
|
|
|
else \
|
|
|
|
$(MKINSTALLDIRS) $(DESTDIR)$(docdir)/$(PACKAGE)/html; \
|
|
|
|
$(call ncmd,installdata,$(doc),$(HTML_DIR)); \
|
|
|
|
fi;)
|
|
|
|
@$(foreach doc,$(PDF_DOCS), \
|
|
|
|
$(MKINSTALLDIRS) $(DESTDIR)$(docdir)/$(PACKAGE)/pdf; \
|
|
|
|
$(call ncmd,installdata,$(doc),$(PDF_DIR);))
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
update-man: man
|
|
|
|
@$(if $(MAN_DOCS), \
|
|
|
|
$(call ncmd,installdata,elinks.1,man/man1/elinks.1.in); \
|
|
|
|
$(call ncmd,installdata,elinkskeys.5,man/man5/); \
|
|
|
|
$(call ncmd,installdata,elinks.conf.5,man/man5/))
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2005-09-27 15:11:28 -04:00
|
|
|
clean-local:
|
2006-01-29 06:52:19 -05:00
|
|
|
@$(RM) -r $(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
|
|
|
|
HELP2DOC = $(srcdir)tools/help2doc
|
|
|
|
CONF2DOC = $(srcdir)tools/conf2doc
|
|
|
|
KEYS2DOC = $(srcdir)tools/keys2doc
|
|
|
|
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 = $(LOCALES) $(CONF2DOC) $(FEATURES) > $@
|
|
|
|
|
|
|
|
quiet_cmd_keys2doc = ' [$(LINK_COLOR)KEYS2DOC$(END_COLOR)] $(RELPATH)$@'
|
|
|
|
cmd_keys2doc = $(LOCALES) $(KEYS2DOC) $(KBDBIND) $@ > $@
|
|
|
|
|
|
|
|
quiet_cmd_code2doc = ' [$(LINK_COLOR)CODE2DOC$(END_COLOR)] $(RELPATH)$@'
|
|
|
|
cmd_code2doc = $(LOCALES) $(CODE2DOC) $< > $@
|
|
|
|
|
|
|
|
features.txt: $(FEATURES) $(CONF2DOC)
|
|
|
|
$(call cmd,conf2doc)
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
keymap-%.txt: $(KBDBIND) $(KEYS2DOC)
|
|
|
|
$(call cmd,keys2doc)
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
option-%.txt: $(ELINKS) $(HELP2DOC)
|
|
|
|
$(call cmd,help2doc)
|
2005-09-15 09:58:31 -04:00
|
|
|
|
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
#############################################################################
|
|
|
|
# Build commands and macros
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
quiet_cmd_jw = ' [$(LINK_COLOR)JW$(END_COLOR)] $(RELPATH)$@'
|
|
|
|
cmd_jw = $(JW) -b $(2) $<
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
quiet_cmd_xmlto = ' [$(LINK_COLOR)XMLTO$(END_COLOR)] $(RELPATH)$@'
|
|
|
|
cmd_xmlto = $(XMLTO) -o $(call outdir) $(3) $(2) $<
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
quiet_cmd_pod2html = ' [$(LINK_COLOR)POD2HTML$(END_COLOR)] $(RELPATH)$@'
|
|
|
|
cmd_pod2html = $(POD2HTML) --outfile=$@ < $<
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
quiet_cmd_asciidoc = ' [$(LINK_COLOR)ASCIIDOC$(END_COLOR)] $(RELPATH)$@'
|
|
|
|
cmd_asciidoc = $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b $(call backend) -d $(call doctype) -o $@ $<
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
# Based on $@ find out asciidoc doctype or backend + xmlto output dir.
|
|
|
|
doctype = $(if $(findstring .1.,$@)$(findstring .5.,$@),manpage,book)
|
|
|
|
backend = $(if $(findstring .xml,$@),docbook,xhtml11)
|
|
|
|
outdir = $(if $(findstring -chunked,$@),$@,.)
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
# Loosely track dependencies via asciidoc includes.
|
|
|
|
asciidoc_dep = sed -n 's/[{]builddir}//g;s@include::\(.*\)\[.*@$@: $< \1@p' < $< > .deps/$(@F).asciidoc
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
-include .deps/*.asciidoc
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
# Do a little post-processing of man pages. Inserting title headers and date.
|
|
|
|
MAN_DATE = $(shell date -I)
|
|
|
|
man_desc = `sed -n 's/:Description:\s*\(.*\)/\1/p' < $(srcdir)$(subst .xml,.txt,$(<F))`
|
|
|
|
man_hack = sed "s/^\(\.TH \"ELINKS[^\"]*\" [0-9] \).*/\1\"$(1)\" \"$(MAN_DATE)\" \"$(1)\"/" < $@ | \
|
|
|
|
sed "s/@squote@/\\\\'/g" > $@.tmp && mv $@.tmp $@
|
2005-09-15 09:58:31 -04:00
|
|
|
|
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
#############################################################################
|
|
|
|
# Build recipies
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
%.html: %.txt $(ASCIIDOC_CONF)
|
|
|
|
$(call cmd,asciidoc,xhtml11)
|
|
|
|
@-$(call asciidoc_dep)
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
%.xml: %.txt $(ASCIIDOC_CONF)
|
|
|
|
$(call cmd,asciidoc,docbook)
|
|
|
|
@-$(call asciidoc_dep)
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
%.1: %.1.xml
|
|
|
|
$(call cmd,xmlto,man)
|
|
|
|
@$(call man_hack,$(call man_desc))
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
%.5: %.5.xml
|
|
|
|
$(call cmd,xmlto,man)
|
|
|
|
@$(call man_hack,$(call man_desc))
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
%.html-chunked: %.xml
|
|
|
|
$(call cmd,xmlto,html)
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
%.pdf: %.xml
|
|
|
|
$(call cmd,jw,pdf)
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
%.html: %.pod
|
|
|
|
$(call cmd,pod2html)
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-29 06:52:19 -05:00
|
|
|
perl-%.html: %.pl
|
|
|
|
$(call cmd,pod2html)
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2005-09-15 22:38:48 -04:00
|
|
|
|
2005-10-19 19:11:47 -04:00
|
|
|
include $(top_srcdir)/Makefile.lib
|