-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathMakefile
67 lines (51 loc) · 1.96 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
MANPAGE := ledger.1
TEXINFO := $(addsuffix .texi,ledger3 ledger-mode)
SOURCES := version.texi $(MANPAGE) $(TEXINFO)
PDF := $(addsuffix .pdf,$(basename $(TEXINFO)))
HTML := $(addsuffix .html,$(basename $(TEXINFO)) $(MANPAGE))
BUILD := build
OUTPUT := $(BUILD)/doc
CURL := curl --silent --location
OWNER := ledger
REPO := ledger
LATEST := $(shell curl -sqI -w '%{redirect_url}\n' -o /dev/null https://github.com/$(OWNER)/$(REPO)/releases/latest | awk -F/ '{print $$NF}' )
HOST := https://raw.githubusercontent.com
ledger3.texi_repopath := $(OWNER)/$(REPO)/$(LATEST)/doc
ledger.1_repopath := $(OWNER)/$(REPO)/$(LATEST)/doc
ledger-mode.texi_repopath := $(OWNER)/ledger-mode/master/doc
install: source/css
mkdocs build
docs: init sources pdf html
pdf: $(PDF)
html: $(HTML)
sources: $(SOURCES)
.PHONY: source/css
source/css: custom_theme/sass
python -c 'import sass; sass.compile(dirname=("$<", "$@"))'
.PHONY: init
init:
mkdir -p $(OUTPUT)
.PHONY: clean
clean:
rm -rf $(BUILD) $(addsuffix *,$(basename $(SOURCES)))
$(TEXINFO) $(MANPAGE):
$(CURL) --remote-name $(HOST)/$($(@)_repopath)/$@
# TODO: Remove the line after this comment once the next release after 3.3.2
# is published as it will include the necessary changes for version.texi and
# related files to be fetched from the tag instead of the master branch.
version.texi: LATEST := master
version.texi:
$(CURL) --parallel --create-dirs \
--output-dir doc --remote-name $(HOST)/$(OWNER)/$(REPO)/$(LATEST)/doc/[email protected] \
--remote-name $(HOST)/$(OWNER)/$(REPO)/$(LATEST)/doc/CMakeLists.txt \
--next --silent --location --create-dirs \
--output-dir cmake --remote-name $(HOST)/$(OWNER)/$(REPO)/$(LATEST)/cmake/LedgerVersion.cmake \
# curl
cmake -Wno-dev -S doc
mv doc/$@ $@
%.pdf : %.texi
texi2pdf --batch --verbose --output=$(OUTPUT)/$@ $<
%.html : %.texi
makeinfo --force --html --no-split --output=$(OUTPUT)/$@ $<
%.1.html : %.1
groff -mandoc -Thtml $< > $(OUTPUT)/$@