-
Notifications
You must be signed in to change notification settings - Fork 89
/
Makefile
113 lines (84 loc) · 3.29 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
LJC = bin/ljc
ND_FLAGS = -0
SM_FLAGS = -0 -l
srcdir = src
testdir = src/tests
benchdir = benchmarks
build_node = build/node
build_sm = build/sm
js_files = memory.js memcheck.js test-memcheck.js \
access-nbody.js access-nbody-memcheck.js \
linked-list.js linked-list-memcheck.js
mainfiles = $(addprefix $(srcdir)/, memory.js memcheck.js)
nodefiles := $(addprefix $(build_node)/, $(js_files))
smfiles := $(addprefix $(build_sm)/, $(js_files))
.PHONY: all test clean node sm bench main
all: main node sm test bench
test: node sm
@echo "======================"
@echo "Running node tests..."
(export NODE_PATH="$(build_node):$$NODE_PATH" && node --harmony_proxies $(build_node)/test-memcheck.js)
@echo "======================"
@echo "Running spidermonkey tests..."
(cd $(build_sm) && js -n -m test-memcheck.js)
bench: node sm
@echo "======================"
@echo "Running node benchmarks..."
@echo "== nbody =="
(export NODE_PATH="$(build_node):$$NODE_PATH" && node --harmony_proxies $(build_node)/access-nbody.js)
@echo "\n== nbody (memcheck) =="
(export NODE_PATH="$(build_node):$$NODE_PATH" && node --harmony_proxies $(build_node)/access-nbody-memcheck.js)
@echo "\n== linked list =="
(export NODE_PATH="$(build_node):$$NODE_PATH" && node --harmony_proxies $(build_node)/linked-list.js)
@echo "\n== linked list (memcheck) =="
(export NODE_PATH="$(build_node):$$NODE_PATH" && node --harmony_proxies $(build_node)/linked-list-memcheck.js)
@echo "======================"
@echo "Running spdiermonkey benchmarks..."
@echo "== nbody =="
(cd $(build_sm) && js -n -m access-nbody.js)
@echo "\n== nbody (memcheck) =="
(cd $(build_sm) && js -n -m access-nbody-memcheck.js)
@echo "\n== linked list =="
(cd $(build_sm) && js -n -m linked-list.js)
@echo "\n== linked list (memcheck) =="
(cd $(build_sm) && js -n -m linked-list-memcheck.js)
main: $(mainfiles)
node: $(nodefiles)
sm: $(smfiles)
# main
$(srcdir)/memory.js: $(srcdir)/memory.ljs
$(LJC) $(ND_FLAGS) -o $@ $<
$(srcdir)/memcheck.js: $(srcdir)/memcheck.ljs
$(LJC) $(ND_FLAGS) -o $@ $<
# node
$(build_node)/memory.js: $(srcdir)/memory.ljs
$(LJC) $(ND_FLAGS) -o $@ $<
$(build_node)/memcheck.js: $(srcdir)/memcheck.ljs
$(LJC) $(ND_FLAGS) -o $@ $<
$(build_node)/test-memcheck.js: $(testdir)/test-memcheck.ljs
$(LJC) $(ND_FLAGS) -m -o $@ $<
# benchmarks
$(build_node)/access-nbody.js: $(benchdir)/access-nbody.ljs
$(LJC) $(ND_FLAGS) -o $@ $<
$(build_node)/linked-list.js: $(benchdir)/linked-list.ljs
$(LJC) $(ND_FLAGS) -o $@ $<
$(build_node)/access-nbody-memcheck.js: $(benchdir)/access-nbody.ljs
$(LJC) $(ND_FLAGS) -m -o $@ $<
$(build_node)/linked-list-memcheck.js: $(benchdir)/linked-list.ljs
$(LJC) $(ND_FLAGS) -m -o $@ $<
# spidermonkey
$(build_sm)/memory.js: $(srcdir)/memory.ljs
$(LJC) $(SM_FLAGS) -o $@ $<
$(build_sm)/memcheck.js: $(srcdir)/memcheck.ljs
$(LJC) $(SM_FLAGS) -o $@ $<
$(build_sm)/test-memcheck.js: $(testdir)/test-memcheck.ljs
$(LJC) $(SM_FLAGS) -m -o $@ $<
# benchmarks
$(build_sm)/access-nbody.js: $(benchdir)/access-nbody.ljs
$(LJC) $(SM_FLAGS) -o $@ $<
$(build_sm)/linked-list.js: $(benchdir)/linked-list.ljs
$(LJC) $(SM_FLAGS) -o $@ $<
$(build_sm)/access-nbody-memcheck.js: $(benchdir)/access-nbody.ljs
$(LJC) $(SM_FLAGS) -m -o $@ $<
$(build_sm)/linked-list-memcheck.js: $(benchdir)/linked-list.ljs
$(LJC) $(SM_FLAGS) -m -o $@ $<