-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
70 lines (52 loc) · 1.73 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
# Make sure ocamlbuild can find opam-managed packages: first run
#
# eval `opam config env`
# Easiest way to build: using ocamlbuild, which in turn uses ocamlfind
LFLAGS = $(shell sdl2-config --libs)
LFLAGS += -L./runtime/build -lblr_rt
all : clean ballr
ballr.native :
ocamlbuild -use-ocamlfind -pkgs llvm,llvm.analysis -cflags -w,+a-4 \
ballr.native
# "make clean" removes all generated files
.PHONY : clean
clean :
ocamlbuild -clean
rm -rf ballr scanner.ml parser.ml parser.mli
rm -rf *.cmx *.cmi *.cmo *.cmx *.o *.s *.ll *.out *.exe
# More detailed: build using ocamlc/ocamlopt + ocamlfind to locate LLVM
OBJS = ast.cmx codegen.cmx parser.cmx scanner.cmx semant.cmx ballr.cmx
# OBJS = ast.cmo codegen_simple.cmo parser.cmo scanner.cmo ballr.cmo
ballr : clean $(OBJS)
#ocamlc -g -I ~/.opam/system/lib/llvm $(OBJS) -o ballr
ocamlfind ocamlopt -linkpkg -g -package llvm -package llvm.analysis $(OBJS) -o ballr
scanner.ml : scanner.mll
ocamllex scanner.mll
parser.ml parser.mli : parser.mly
ocamlyacc parser.mly
%.cmo : %.ml
ocamlc -g -c -I ~/.opam/system/lib/llvm $<
%.cmi : %.mli
ocamlc -c $<
%.cmx : %.ml
ocamlfind ocamlopt -c -g -package llvm $<
%.game: ballr %.blr
./ballr -c $(*F).blr
clang -c $(*F).ll
clang -g $(*F).o -o $(*F) $(LFLAGS)
%.test:
./ballr -c tests/$(*F).blr
clang -c tests/$(*F).ll
clang -g $(*F).o -o $(*F) $(LFLAGS)
### Generated by "ocamldep *.ml *.mli" after building scanner.ml and parser.ml
ast.cmo :
ast.cmx :
ballr.cmo : semant.cmo scanner.cmo parser.cmi ast.cmo
ballr.cmx : semant.cmx scanner.cmx parser.cmx ast.cmx
parser.cmo : ast.cmo parser.cmi
parser.cmx : ast.cmx parser.cmi
scanner.cmo : parser.cmi
scanner.cmx : parser.cmx
semant.cmo : ast.cmo
semant.cmx : ast.cmx
parser.cmi : ast.cmo