This repository has been archived by the owner on Nov 17, 2017. It is now read-only.
forked from esumii/min-caml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (62 loc) · 2.85 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
# Sumii's Makefile for Min-Caml (for GNU Make)
#
# ack.mlなどのテストプログラムをtest/に用意してmake do_testを実行すると、
# min-camlとocamlでコンパイル・実行した結果を自動で比較します。
RESULT = min-caml
NCSUFFIX = .opt
CC = gcc
CFLAGS = -g -O2 -Wall
OCAMLLDFLAGS=-warn-error -31
default: debug-code top $(RESULT) do_test
$(RESULT): debug-code top
## [自分(住井)用の注]
## ・OCamlMakefileや古いGNU Makeのバグ(?)で上のような定義が必要(??)
## ・OCamlMakefileではdebug-codeとnative-codeのそれぞれで
## .mliがコンパイルされてしまうので、両方ともdefault:の右辺に入れると
## 再make時に(.mliが変更されているので).mlも再コンパイルされる
clean:: nobackup
# ↓もし実装を改造したら、それに合わせて変える
SOURCES = float.c type.ml id.ml m.ml s.ml \
syntax.ml parser.mly lexer.mll typing.mli typing.ml kNormal.mli kNormal.ml \
alpha.mli alpha.ml beta.mli beta.ml assoc.mli assoc.ml \
inline.mli inline.ml constFold.mli constFold.ml elim.mli elim.ml \
closure.mli closure.ml asm.mli asm.ml virtual.mli virtual.ml \
simm.mli simm.ml regAlloc.mli regAlloc.ml emit.mli emit.ml \
main.mli main.ml
# ↓テストプログラムが増えたら、これも増やす
TESTS = print sum-tail gcd sum fib ack even-odd \
adder funcomp cls-rec cls-bug cls-bug2 cls-reg-bug \
shuffle spill spill2 spill3 join-stack join-stack2 join-stack3 \
join-reg join-reg2 non-tail-if non-tail-if2 \
inprod inprod-rec inprod-loop matmul matmul-flat
do_test: $(TESTS:%=test/%.cmp)
.PRECIOUS: test/%.s test/% test/%.res test/%.ans test/%.cmp
TRASH = $(TESTS:%=test/%.s) $(TESTS:%=test/%) $(TESTS:%=test/%.res) $(TESTS:%=test/%.ans) $(TESTS:%=test/%.cmp)
test/%.s: $(RESULT) test/%.ml
./$(RESULT) test/$*
test/%: test/%.s libmincaml.S stub.c
$(CC) $(CFLAGS) -m32 $^ -lm -o $@
test/%.res: test/%
$< > $@
test/%.ans: test/%.ml
ocaml $< > $@
test/%.cmp: test/%.res test/%.ans
diff $^ > $@
min-caml.html: main.mli main.ml id.ml m.ml s.ml \
syntax.ml type.ml parser.mly lexer.mll typing.mli typing.ml kNormal.mli kNormal.ml \
alpha.mli alpha.ml beta.mli beta.ml assoc.mli assoc.ml \
inline.mli inline.ml constFold.mli constFold.ml elim.mli elim.ml \
closure.mli closure.ml asm.mli asm.ml virtual.mli virtual.ml \
simm.mli simm.ml regAlloc.mli regAlloc.ml emit.mli emit.ml
./to_sparc
caml2html -o min-caml.html $^
sed 's/.*<\/title>/MinCaml Source Code<\/title>/g' < min-caml.html > min-caml.tmp.html
mv min-caml.tmp.html min-caml.html
sed 's/charset=iso-8859-1/charset=euc-jp/g' < min-caml.html > min-caml.tmp.html
mv min-caml.tmp.html min-caml.html
ocaml str.cma anchor.ml < min-caml.html > min-caml.tmp.html
mv min-caml.tmp.html min-caml.html
release: min-caml.html
rm -fr tmp ; mkdir tmp ; cd tmp ; cvs -d:ext:[email protected]://cvsroot/min-caml export -Dtomorrow min-caml ; tar cvzf ../min-caml.tar.gz min-caml ; cd .. ; rm -fr tmp
cp Makefile stub.c SPARC/libmincaml.S min-caml.html min-caml.tar.gz ../htdocs/
include OCamlMakefile