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