-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
60 lines (48 loc) · 1.23 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
TYPES=$(wildcard *.d.ts)
DOCS=docs
README=README.md
FOOTER=$(DOCS)/footer.html
HEADER=$(DOCS)/header.html
INDEX=$(DOCS)/index.html
STYLES=$(DOCS)/styles.css
ARTIFACT=quickjs-types.tar.gz
PANDOC=pandoc
ifdef PANDOC_DOCKER
PANDOC=docker run --rm --volume "`pwd`:/data" --user `id -u`:`id -g` pandoc/core:latest
endif
$(DOCS): $(shell mkdir -p $(DOCS))
$(DOCS): $(INDEX)
$(FOOTER):
@echo "<hr /><p style='text-align: center;'>Last update: $(shell date)</p>" \
> $@
$(HEADER):
@echo "\
<p> \
<a href='https://github.com/mgred/quickjs-types' target='_blank'> \
<strong>Github</strong> \
</a> \
</p>" > $@
$(INDEX): $(README) $(HEADER) $(FOOTER) $(STYLES)
@$(PANDOC) \
--css $(notdir $(STYLES)) \
--from gfm \
--include-after-body $(FOOTER) \
--include-before-body $(HEADER) \
--metadata pagetitle="$$(head -1 $(README) | cut -c 3-)" \
--output $@ \
--standalone \
--to html \
$(README)
$(STYLES):
@curl -s -L https://gist.githubusercontent.com/killercup/5917178/raw/40840de5352083adb2693dc742e9f75dbb18650f/pandoc.css \
> $@
.PHONY: test
test:
tsc -p .
.PHONY: release
release: test $(ARTIFACT)
$(ARTIFACT): $(TYPES) $(README) LICENSE package.json
tar cf $@ $?
.PHONY: clean
clean:
rm -rf $(DOCS) *.tgz *.tar.gz