-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
99 lines (73 loc) · 1.87 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
.PHONY: dist clean test docs
.SECONDARY:
dist: \
dist/flottplot-min.js \
dist/flottplot-scan-min.js \
dist/flottplot.css
clean:
rm -rf dist
rm -rf docs/*.html
rm -rf docs/*.css
rm -rf docs/dist
rm -rf docs/plot
rm -rf test/flottplot.js
rm -rf test/format_cases.json
%/:
mkdir -p $@
# Flottplot modules
dist/%.css: src/%.less | dist/
npx lessc $< > $@
dist/%-min.js: src/bundles/%.ts | dist/
npx webpack build \
--entry-reset \
--entry "./$<" \
--output-filename "$(notdir $@)"
# TODO: ts file dependencies
# Unit tests
TESTS := $(wildcard test/test_*.js)
test: test/flottplot.js test/format_cases.json $(TESTS)
npx mocha $(TESTS)
test/format_cases.json: util/generate_format_cases.py | test/
python3 $< > $@
test/flottplot.js: src/bundles/flottplot-test.ts
npx webpack build \
--entry-reset \
--entry "./$<" \
--output-library-type "commonjs2" \
--output-path "test" \
--output-filename "flottplot.js"
# Documentation
DOCS := \
docs/ \
docs/index.html \
docs/tutorial.html \
docs/elements.html \
docs/values.html \
docs/python.html \
docs/docs.css \
docs/convert.js \
docs/dist/flottplot-min.js \
docs/dist/flottplot.css \
docs/dist/flottplot-scan-min.js \
docs/plot/sin-1x.png \
docs/plot/sin-2x.png \
docs/plot/sin-3x.png \
docs/plot/cos-3x.png \
docs/plot/cos-2x.png \
docs/plot/cos-3x.png \
docs/plot/adv_fwd_000.png \
docs/plot/adv_bwd_000.png \
docs/plot/adv_lag_000.png
docs: $(DOCS)
docs/%.css: docs/src/%.less
npx lessc $< $@
docs/%.html: docs/util/build.py docs/src/template.html docs/src/%.html
python3 $+ > $@
docs/dist/%: dist/% | docs/dist/
cp $^ $@
docs/plot/sin-%x.png: docs/util/plot-trigonometric.py | docs/plot/
python3 $< "sin" $* $@
docs/plot/cos-%x.png: docs/util/plot-trigonometric.py | docs/plot/
python3 $< "cos" $* $@
docs/plot/adv_%_000.png: docs/util/plot-advection.py | docs/plot/
python3 $< $* $(dir $@)