-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (37 loc) · 1.19 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
all : calc.out
##############################
#
# HW 2: Question 1
#
# Compilation:
# Option 1: Simply type "make" to compile the calculator (recommended, auto-test included)
# Option 2: "ocamlbuild calc.native" will also build the calculator
# For testing, you can run the binary executable and test it with
# standard input via terminal.
# Or use calc.tb (testbench file): you can modify the file directly
# with the exprssion you want to test before make. After compiling
# your executable successfully, the output of test case will be
# generate automatically in a file named calc.out
calc : parser.cmo scanner.cmo calc.cmo
ocamlc -w A -o calc $^
%.cmo : %.ml
ocamlc -w A -c $<
%.cmi : %.mli
ocamlc -w A -c $<
scanner.ml : scanner.mll
ocamllex $^
parser.ml parser.mli : parser.mly
ocamlyacc $^
calc.out : calc calc.tb
./calc < calc.tb > calc.out
# Depedencies from ocamldep
calc.cmo : scanner.cmo parser.cmi ast.cmi
calc.cmx : scanner.cmx parser.cmx ast.cmi
parser.cmo : ast.cmi parser.cmi
parser.cmx : ast.cmi parser.cmi
scanner.cmo : parser.cmi
scanner.cmx : parser.cmx
##############################
.PHONY : clean
clean :
rm -rf *.cmi *.cmo parser.ml parser.mli scanner.ml calc.out calc