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

Make it possible to build all-docs when $(builddir) != $(srcdir)

This commit is contained in:
Jonas Fonseca 2006-01-16 00:18:39 +01:00 committed by Jonas Fonseca
parent becf3b42ab
commit a892c84601
6 changed files with 22 additions and 16 deletions

View File

@ -12,6 +12,9 @@ docdir = $(datadir)/doc
HTML_DIR = $(DESTDIR)$(docdir)/$(PACKAGE)/html
PDF_DIR = $(DESTDIR)$(docdir)/$(PACKAGE)/pdf
ASCIIDOC_CONF = $(srcdir)asciidoc.conf
ASCIIDOC_FLAGS = -f $(ASCIIDOC_CONF) -a "builddir=$(CURDIR)/"
#############################################################################
# Build files
@ -108,7 +111,7 @@ 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) > $@
cmd_conf2doc = $(LOCALES) $(CONF2DOC) $(FEATURES) > $@
quiet_cmd_keys2doc = ' [$(LINK_COLOR)KEYS2DOC$(END_COLOR)] $(RELPATH)$@'
cmd_keys2doc = $(LOCALES) $(KEYS2DOC) $(KBDBIND) $@ > $@
@ -149,25 +152,27 @@ api: $(patsubst %.txt,%.html,$(API_TXT))
cmd_jw = $(JW) -b $(2) $<
quiet_cmd_xmlto = ' [$(LINK_COLOR)XMLTO$(END_COLOR)] $(RELPATH)$@'
cmd_xmlto = $(XMLTO) $(3) $(2) $<
cmd_xmlto = $(XMLTO) -o $(call outdir) $(3) $(2) $<
quiet_cmd_pod2html = ' [$(LINK_COLOR)POD2HTML$(END_COLOR)] $(RELPATH)$@'
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 $@ $<
cmd_asciidoc = $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b $(call backend) -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))
# 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,$@),$@,.)
# Loosely track dependencies via asciidoc includes.
asciidoc_dep = sed -n 's@include::\(.*\)\[.*@$@: \1@p' < $< > .deps/$(@F).asciidoc
asciidoc_dep = sed -n 's/[{]builddir}//g;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_desc = `sed -n 's/:Description:\s*\(.*\)/\1/p' < $(subst .xml,.txt,$<)`
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 $@
@ -175,11 +180,11 @@ man_hack = sed "s/^\(\.TH \"ELINKS[^\"]*\" [0-9] \).*/\1\"$(1)\" \"$(MAN_DATE)\"
#############################################################################
# Build recipies
%.html: %.txt asciidoc.conf
%.html: %.txt $(ASCIIDOC_CONF)
$(call cmd,asciidoc,xhtml11)
@-$(call asciidoc_dep)
%.xml: %.txt asciidoc.conf
%.xml: %.txt $(ASCIIDOC_CONF)
$(call cmd,asciidoc,docbook)
@-$(call asciidoc_dep)
@ -192,7 +197,7 @@ man_hack = sed "s/^\(\.TH \"ELINKS[^\"]*\" [0-9] \).*/\1\"$(1)\" \"$(MAN_DATE)\"
@$(call man_hack,$(call man_desc))
%.html-chunked: %.xml
$(call cmd,xmlto,html,-o $@)
$(call cmd,xmlto,html)
%.pdf: %.xml
$(call cmd,jw,pdf)

View File

@ -35,7 +35,7 @@ Most options can be set in the user interface or config file, so usually you
do not need to care about them. Note that this list is roughly equivalent to
the output of running ELinks with the option `--long-help`.
include::option-command.txt[]
include::{builddir}option-command.txt[]
ENVIRONMENT VARIABLES
---------------------

View File

@ -56,7 +56,7 @@ Some sample settings:
OPTIONS
-------
include::option-config.txt[]
include::{builddir}option-config.txt[]
SEE ALSO
--------

View File

@ -93,7 +93,7 @@ FIXME:
KEYMAP ACTIONS
--------------
include::keymap-actions.txt[]
include::{builddir}keymap-actions.txt[]
DEFAULT BINDINGS
----------------
@ -101,7 +101,7 @@ DEFAULT BINDINGS
The default bindings are shown below. Any bindings in `~/.elinks/elinks.conf`
will override these.
include::keymap-defaults.txt[]
include::{builddir}keymap-defaults.txt[]
AUTHOR
------

View File

@ -71,6 +71,6 @@ include::small.txt[]
include::ecmascript.txt[]
include::features.txt[]
include::{builddir}features.txt[]
endif::installation-webpage[]

View File

@ -4,6 +4,7 @@
# Copyright (c) Jonas Fonseca <fonseca@diku.dk>, 2005
#
CONFFILE="$1"
TMPFILE=$(mktemp import-features.conf.XXXXXX) || exit 1
strip_comment()
@ -53,7 +54,7 @@ __END__
fi
}
cat ../features.conf | while read line; do
cat "$CONFFILE" | while read line; do
case "$line" in
"### "*)
print_section