3ccf846fc40c488229e09c7131a49159e2cd6b24
[tool/hledger.git] / doc / GNUmakefile
1 tool:=$(dir $(lastword $(MAKEFILE_LIST)))
2
3 all: $(HOME)/.asciidoc/backends/slidy2
4
5 $(HOME)/.asciidoc/backends/slidy2: tool:=$(tool)
6 $(HOME)/.asciidoc/backends/slidy2: \
7 $(tool)/.../lib/tool/asciidoc/backend/slidy2/install
8 $<
9
10 tool/asciidoc := $(tool)/.../lib/tool/asciidoc
11 include $(tool/asciidoc)/GNUmakefile
12
13 export VERSION:=$(patsubst v%,%,$(shell which git >/dev/null && \
14 git describe --tags --match 'v[0-9][0-9][0-9][0-9].[0-9][0-9].[0-9][0-9]' --always || \
15 TZ=UTC date +'v%Y.%m.%d'))
16
17 ### lib
18 tool/lib/targets:=$(addprefix .../,$(shell cd ... && git config -f .gitmodules \
19 --get-regexp submodule'\.lib/.*\.'path | \
20 cut -d ' ' -f 2))
21 .PHONY: $(tool/lib/targets) $(tool)/lib/all $(tool)/lib
22 $(tool/lib/targets):
23 cd "$(tool)"/... && git submodule update --init -- $(patsubst .../%,%,$@)
24 cd "$(tool)"/$@ && git checkout -f HEAD && git clean -dfx
25 $(tool)/.../lib: $(tool)/lib/all
26 $(tool)/.../lib/all: $(tool/lib/targets)
27 $(tool)/.../lib/tool/asciidoc/GNUmakefile: \
28 $(if $(wildcard .../lib/tool/asciidoc/.git),,.../lib/tool/asciidoc)
29
30
31 ### slidy
32 %.slidy.html: export ASCIIDOC_FLAGS+=-arevnumber="$(VERSION)"
33 %.slidy.html: export ASCIIDOC_FLAGS+=-atabsize=0
34 %.slidy.html: export ASCIIDOC_FLAGS+=-alatexmath
35
36 $(patsubst %.ad,%.html,$(wildcard *.slidy.ad)): \
37 $(tool/asciidoc)/conf/latexmath.conf \
38 $(tool/asciidoc)/conf/vim.conf