forked from whatwg/webidl
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
47 lines (42 loc) · 1.47 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
SHELL=/bin/bash
bs_installed := $(shell command -v bikeshed 2> /dev/null)
npm_installed := $(shell command -v npm 2> /dev/null)
pp_webidl_installed := $(shell npm ls webidl-grammar-post-processor --parseable --depth=0 2> /dev/null)
all : index.html
index.html : index.bs
ifdef bs_installed
bikeshed spec --die-on=warning index.bs
else
@echo Can\'t find a local version of Bikeshed. To install it, visit:
@echo
@echo https://github.com/tabatkins/bikeshed/blob/master/docs/install.md
@echo
@echo Trying to build the spec using the online API at: https://api.csswg.org/bikeshed/
@echo This will fail if you are not connected to the network.
@ (HTTP_STATUS=$$(curl https://api.csswg.org/bikeshed/ \
--output index.html \
--write-out "%{http_code}" \
--header "Accept: text/plain, text/html" \
-F die-on=warning \
-F [email protected]) && \
[[ "$$HTTP_STATUS" -eq "200" ]]) || ( \
echo ""; cat index.html; echo ""; \
rm -f index.html; \
exit 22 \
);
endif
ifdef pp_webidl_installed
npm run pp-webidl -- --input index.html
else ifdef npm_installed
npm install
npm run pp-webidl -- --input index.html
else
@echo You need node.js and npm to apply post-processing. To install it, visit:
@echo
@echo https://nodejs.org/en/download/
@echo
@echo Until then, post-processing will be done dynamically, in JS, on page load.
endif
clean :
rm -f index.html
.PHONY : all clean