tool:=$(dir $(lastword $(MAKEFILE_LIST))) mul=$(foreach p,$1,$(foreach s,$2,$p$s)) all: $(HOME)/.asciidoc/backends/slidy2 $(HOME)/.asciidoc/backends/slidy2: tool:=$(tool) $(HOME)/.asciidoc/backends/slidy2: \ $(tool)/.../lib/tool/asciidoc/backend/slidy2/install $< $(call mul,$(patsubst %.ad,%,$(wildcard *.ad)),.roff .html): \ $(tool)/.../script/hledger-equity \ $(tool)/.../script/hledger-print-csv $(tool)/.../script/%: $(MAKE) -C $(@D) $(@F) tool/asciidoc := $(tool)/.../lib/tool/asciidoc include $(tool/asciidoc)/GNUmakefile export VERSION:=$(patsubst v%,%,$(shell which git >/dev/null && \ git describe --tags --match 'v[0-9][0-9][0-9][0-9].[0-9][0-9].[0-9][0-9]' --always || \ TZ=UTC date +'v%Y.%m.%d')) ### lib tool/lib/targets:=$(addprefix .../,$(shell cd ... && git config -f .gitmodules \ --get-regexp submodule'\.lib/.*\.'path | \ cut -d ' ' -f 2)) .PHONY: $(tool/lib/targets) $(tool)/lib/all $(tool)/lib $(tool/lib/targets): cd "$(tool)"/... && git submodule update --init -- $(patsubst .../%,%,$@) cd "$(tool)"/$@ && git checkout -f HEAD && git clean -dfx $(tool)/.../lib: $(tool)/lib/all $(tool)/.../lib/all: $(tool/lib/targets) $(tool)/.../lib/tool/asciidoc/GNUmakefile: \ $(if $(wildcard .../lib/tool/asciidoc/.git),,.../lib/tool/asciidoc) ### slidy %.slidy.html: export ASCIIDOC_FLAGS+=-arevnumber="$(VERSION)" %.slidy.html: export ASCIIDOC_FLAGS+=-atabsize=0 %.slidy.html: export ASCIIDOC_FLAGS+=-alatexmath $(patsubst %.ad,%.html,$(wildcard *.ad)): \ $(tool/asciidoc)/conf/latexmath.conf \ $(tool/asciidoc)/conf/vim.conf