-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (39 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
47
48
49
50
51
PKGS=opal llvm llvm.bitwriter
SRCS=graph.ml flow_network.ml ast.ml def_use_generator.ml \
vm_types.ml eval.ml util.ml blade.ml parser.ml do_blade.ml \
run_interp.ml run_vm.ml gen_llvm.ml
TEST_SOURCES = test/test_fetch.ml test/test_exec.ml test/test_retire.ml
TEST_RESULT = test/test_fetch.native test/test_exec.native test/test_retire.native
TESTS = test1 test2 test3 testarr testfence testslh testif testinlineif testfail
LINK?=llvm-link
LLC?=llc
AS?=llvm-as
CLANG?=clang
.PHONY: docs clean all battery_test compilation_tests
all: do_blade.native run_interp.native run_vm.native gen_llvm.native battery_test $(TESTS)
%.native: $(SRCS) $(TEST_SOURCES)
ocamlbuild -pkgs '${PKGS}' -tag 'debug' $@
battery_test: $(TEST_RESULT)
compilation_tests: $(TESTS)
for test in $(TESTS); do \
echo "$$test:" ; \
./$$test ; \
done
rt-support.bc: rt-support.c
$(CLANG) -c $^ -emit-llvm -o $@
test%.bc: test%.txt gen_llvm.native
./gen_llvm.native -o $@ < $<
linked_test%.bc: test%.bc rt-support.bc
$(LINK) $^ -o $@
test%.o: linked_test%.bc
$(LLC) -filetype=obj $^ -o $@
test%: test%.o
$(CLANG) $^ -o $@
docs: $(SRCS)
mkdir -p docs
ocamlfind ocamlc -linkpkg -package opal $^
ocamlfind ocamldoc -html -d docs -package opal $^
make clean
clean:
-rm *.cmi *.cmo *.cma *.native a.out *.bc *.o *.ll $(TESTS)
rm -r _build