-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (32 loc) · 1.26 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
.PHONY: all clean
default: all
CODE = $(shell find src -type f -name '*.js' | sort)
MARKDOWN = $(shell find docs -type f -name '*.md' | sort)
JSON = $(MARKDOWN:docs/%.md=dist/%.json)
HTML = $(MARKDOWN:docs/%.md=dist/%.html)
API = $(shell find docs/api -type f -name '*.md' | sort)
API_INTERMEDIATE = $(API:docs/api/%.md=dist/api/%.json)
ASSETS_IN = $(shell find assets -type f | sort)
ASSETS_OUT = $(ASSETS_IN:assets/%=dist/assets/%)
node_modules: package-lock.json
npm install
dist:
@mkdir -p dist/
dist/assets:
@mkdir -p dist/assets/
dist/_api.json: $(API_INTERMEDIATE) dist node_modules
node src/build/json-to-api.js $(API_INTERMEDIATE) > $@
dist/%.json: docs/%.md dist node_modules
@mkdir -p $(@D)
node src/build/article-to-json.js $< $@
dist/%.html: dist/%.json dist/_api.json
node src/build/json-to-html.js src/app.html docs/toc.json dist/_api.json $< $@
dist/client.js: src/client.js dist node_modules $(CODE)
node node_modules/browserify/bin/cmd.js --exclude domino -e $< -o $@ --im
dist/styles.css: src/styles.sass dist node_modules
node node_modules/node-sass/bin/node-sass --output-style compressed $< > $@
dist/assets/%: assets/% dist/assets
cp $< $@
all: $(JSON) dist/_api.json $(HTML) dist/client.js dist/styles.css $(ASSETS_OUT)
clean:
rm -rf dist/*