-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
46 lines (41 loc) · 1.3 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: build
build: prerequisite jsaf test262
@echo "Bootstrapping build..."
rm -f js-config.k
touch js-config.k
$(kbuild)
@echo "Self-hosted standard built-in objects..."
cat $(wildcard stdlib/*.js) >stdlib.js
@echo "Hard-wiring standard built-in objects..."
krun stdlib.js >stdlib.out 2>&1
test "`sed -n '/<k>/,/<\/k>/{ p }' stdlib.out | tr -d ' \n'`" = "<k>@Normal</k>"
{ echo "<objs> ( _ =>"; \
cat stdlib.out | awk '/<objs>/ {p=1; next} /<\/objs>/ {p=0} p' | sed 's/@o/@oo/g'; \
echo ") </objs>"; \
echo "syntax Oid ::= \"@oo\" \"(\" Int \")\""; \
} >js-config.k
@echo "Final build..."
$(kbuild)
define kbuild
rm -rf js-kompiled
echo "rule #@PWD => \"`pwd`\"" >js-pwd.k
./kpp.py js-main.k >js.k
kompile --no-prelude --backend java js.k
endef
.PHONY: prerequisite
prerequisite:
ifeq ($(shell which kompile),)
$(error Install K (http://kframework.org) and set PATH accordingly)
endif
ifeq ($(shell which node),)
$(error Install Node.js (e.g., sudo apt-get install nodejs))
endif
jsaf:
git clone https://github.com/daejunpark/jsaf-bin.git jsaf
( cd jsaf/jsaf/bin && \
wget http://cs.nyu.edu/rgrimm/xtc/xtc.jar )
test262:
git clone https://github.com/tc39/test262.git
( cd test262 && \
git reset --hard 9b669da66c78bd583bc130a7ca3151258e4681a1 )
include Makefile.test262