-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
51 lines (44 loc) · 1.76 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
default: out/asmjspack out/asmjsunpack out/asmjsunpack.js out/asmjsunpack-shell.js
out/asmjspack: asmjspack.cpp pack.cpp pack.h unpack.cpp unpack.h shared.h cashew/parser.h cashew/parser.cpp cashew/istring.h
mkdir -p out
c++ -O3 -g -std=c++11 -DCHECKED_OUTPUT_SIZE -Wall -pedantic \
asmjspack.cpp pack.cpp unpack.cpp cashew/parser.cpp \
-o out/asmjspack
out/asmjsunpack: asmjsunpack.cpp unpack.cpp unpack.h shared.h
mkdir -p out
c++ -DNDEBUG -O3 -std=c++11 -Wall -pedantic \
asmjsunpack.cpp unpack.cpp \
-o out/asmjsunpack
obj/unpack.js: unpack.cpp unpack.h shared.h
mkdir -p obj
emcc -DNDEBUG -O3 -std=c++11 -Wall -pedantic \
--memory-init-file 0 --llvm-lto 1 -s TOTAL_MEMORY=67108864 \
unpack.cpp \
-o obj/unpack.js
out/asmjsunpack.js: asmjsunpack.js obj/unpack.js unpack.js asmjsunpack-worker.js
mkdir -p obj
cat obj/unpack.js unpack.js asmjsunpack-worker.js > out/asmjsunpack-worker.js
cp asmjsunpack.js out/asmjsunpack.js
out/asmjsunpack-shell.js: obj/unpack.js asmjsunpack-shell.js
mkdir -p obj
cat obj/unpack.js unpack.js asmjsunpack-shell.js > out/asmjsunpack-shell.js
.PHONY: test
test: out/asmjspack out/asmjsunpack
mkdir -p /tmp/test;
for tjs in test/*.js; do \
t=$${tjs%.js}; \
( out/asmjspack $$t.js /tmp/$$t.asm || \
( echo "Failure running: out/asmjspack $$t.js /tmp/$$t.asm" && false) ) && \
\
( out/asmjsunpack /tmp/$$t.asm /tmp/$$t.js || \
( echo "Failure running: out/asmjsunpack /tmp/$$t.asm /tmp/$$t.js" && false) ) && \
\
( diff $$t.js /tmp/$$t.js || \
( echo "Failure running: diff $$t.js /tmp/$$t.js" && false) ); \
\
true; \
done
.PHONY: clean
clean:
rm -f out/asmjspack out/asmjsunpack out/asmjsunpack.js obj/unpack.js \
out/asmjsunpack-worker.js out/asmjsunpack-shell.js