-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
59 lines (42 loc) · 1.69 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
PWD = $(shell pwd)
ASCIIDOCTOR = asciidoctor -r asciidoctor-kroki
ASCIIDOCTOR_WEB_PDF = asciidoctor-web-pdf -r asciidoctor-kroki
PYTHON = python3
TARGETS += $(TARGETS_WITHOUT_HTML) index.html
TARGETS_WITHOUT_HTML += $(PROCESSED_CHARTS) $(wildcard scripts/*.adoc)
VEGA_CHART_FILES = $(shell find assets -name '*.vl.json')
VEGA_DATA_FILES = $(addprefix assets/,$(shell grep -Poh "[^\"]+.csv" $(VEGA_CHART_FILES) /dev/null | sort | sed 's/^\.\///' | uniq))
PROCESSED_CHARTS = $(addprefix processed-assets/,$(notdir $(VEGA_CHART_FILES)))
# .EXTRA_PREREQS:=Makefile
.PHONY: all pdf preview
all: paper.pdf
preview: paper-preview
SCSS_FILES = $(wildcard styles/*.scss) $(wildcard styles/*/*.scss) $(wildcard styles/*/*/*.scss)
paper.css: $(SCSS_FILES)
cd styles ; sass --update --sourcemap=none paper.scss:../paper.css
%.html: %.adoc paper.css $(TARGETS_WITHOUT_HTML) $(PROCESSED_CHARTS)
$(ASCIIDOCTOR) -S unsafe $< -o $@
%-web-preview: %.html
$(PYTHON) scripts/serve.py $<
%.pdf: %.adoc paper.css $(TARGETS_WITHOUT_HTML) $(PROCESSED_CHARTS)
$(ASCIIDOCTOR_WEB_PDF) $< -o $@
%-preview: %.adoc paper.css $(TARGETS_WITHOUT_HTML) $(PROCESSED_CHARTS)
$(ASCIIDOCTOR_WEB_PDF) --preview $<
# Preprocess vega charts
process-charts: $(PROCESSED_CHARTS)
$(PROCESSED_CHARTS) : processed-assets/%.vl.json : assets/%.vl.json $(VEGA_DATA_FILES)
mkdir -p $(dir $@)
bash scripts/process_chart.sh $< > $@
touch $@
# data:
# cd experiments && make data
# make $(VEGA_DATA_FILES)
# $(ALL_DATA_JSON):
# cd experiments && make data
# $(VEGA_DATA_FILES) &: $(ALL_DATA_JSON) data/make_data.sh
# bash data/make_data.sh $< data
clean:
rm -rf
dist-clean: clean
rm -rf $(TARGETS)
.PHONY: clean all dist-clean process-charts data