forked from plasma-umass/doppio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
118 lines (98 loc) · 3.6 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
114
115
116
117
118
COFFEEC = coffee # path to coffeescript compiler
UGLIFYJS = node_modules/uglify-js/bin/uglifyjs
SOURCES = $(wildcard test/*.java)
DISASMS = $(SOURCES:.java=.disasm)
RUNOUTS = $(SOURCES:.java=.runout)
CLASSES = $(SOURCES:.java=.class)
RESULTS = $(SOURCES:.java=.result)
DEMO_SRCS = $(wildcard test/special/*.java) test/FileRead.java
DEMO_CLASSES = $(DEMO_SRCS:.java=.class)
BROWSER_HTML = $(wildcard browser/[^_]*.html)
BUILD_HTML = $(addprefix build/, $(notdir $(BROWSER_HTML)))
# the order here is important: must match the order of includes
# in the browser frontend html.
BROWSER_SRCS = third_party/underscore-min.js \
third_party/gLong.js \
browser/util.coffee \
browser/node.coffee \
src/util.coffee \
src/types.coffee \
src/opcodes.coffee \
src/attributes.coffee \
src/constant_pool.coffee \
src/disassembler.coffee \
src/natives.coffee \
src/methods.coffee \
src/class_file.coffee \
src/runtime.coffee \
src/jvm.coffee \
third_party/jquery.console.js \
browser/untar.coffee \
browser/frontend.coffee
# they don't survive uglifyjs and are already minified, so include them
# separately. also, this allows us to put them at the end of the document to
# reduce load time.
ACE_SRCS = third_party/ace/build/src/ace.js \
third_party/ace/build/src/mode-java.js \
third_party/ace/build/src/theme-twilight.js
test: $(RESULTS)
cat $(RESULTS)
@rm -f $(RESULTS)
java: $(CLASSES) $(DISASMS) $(RUNOUTS) $(DEMO_CLASSES)
test/%.result: test/%.class test/%.disasm test/%.runout
tools/run_one_test.rb test/$* >test/$*.result
test/%.disasm: test/%.class
javap -c -verbose -private test/$* >test/$*.disasm
test/%.class: test/%.java
javac test/$*.java
# some tests may throw exceptions. The '-' flag tells make to carry on anyway.
test/%.runout: test/%.class
-java test/$* &>test/$*.runout
clean:
@rm -f *.class $(DISASMS) $(RUNOUTS) $(RESULTS)
@rm -rf build/* browser/mini-rt.jar $(DEMO_CLASSES)
release: $(BUILD_HTML) build/compressed.js browser/mini-rt.tar build/ace.js \
build/browser/style.css $(DEMO_CLASSES)
git submodule update --init --recursive
mkdir -p build/browser
rsync -R $(DEMO_SRCS) $(DEMO_CLASSES) test/special/foo test/special/bar build/
rsync -a test/special build/test
rsync browser/mini-rt.tar build/browser/mini-rt.tar
rsync browser/*.svg build/browser/
rsync browser/*.png build/browser/
# docs need to be generated in one shot so docco can create the full jumplist.
# This is slow, so we have it as a separate target (even though it is needed
# for a full release build).
docs:
docco $(filter %.coffee, $(BROWSER_SRCS))
rm -rf build/docs
mv docs build/
test/special/%.class: test/special/%.java
javac build/test/special/*.java
browser/_about.html: browser/_about.md
rdiscount $? > $@
build/about.html: browser/_about.html
build/%.html: $(BROWSER_HTML) $(wildcard browser/_*.html)
cpp -P -traditional-cpp -DRELEASE browser/$*.html build/$*.html
build/compressed.js: $(BROWSER_SRCS)
for src in $(BROWSER_SRCS); do \
if [ "$${src##*.}" == "coffee" ]; then \
cat $${src} | gsed -r "s/^ *(debug|trace).*$$//" | $(COFFEEC) --stdio --print; \
else \
cat $${src}; \
fi; \
echo ";"; \
done | $(UGLIFYJS) --define RELEASE --no-mangle --unsafe > build/compressed.js
build/ace.js: $(ACE_SRCS)
for src in $(ACE_SRCS); do \
cat $${src}; \
echo ";"; \
done > build/ace.js
build/browser/style.css: third_party/bootstrap/css/bootstrap.min.css browser/style.css
cat $^ > $@
browser/mini-rt.tar: tools/preload
tools/make-rt.sh
$(UGLIFYJS):
npm install https://github.com/downloads/int3/UglifyJS/uglify.tar.gz
.SECONDARY: $(CLASSES) $(DISASMS) $(RUNOUTS) $(DEMO_CLASSES)
.INTERMEDIATE: browser/_about.html