| 1 |
# |
| 2 |
# Pure OCaml, package from Opam, two directories |
| 3 |
# |
| 4 |
|
| 5 |
# - The -I flag introduces sub-directories |
| 6 |
# - -use-ocamlfind is required to find packages (from Opam) |
| 7 |
# - _tags file introduces packages, bin_annot flag for tool chain |
| 8 |
# - using *.mll and *.mly are handled automatically |
| 9 |
|
| 10 |
# - we are using menhir, the modern replacement for OCamlYacc |
| 11 |
# OCB_FLAGS = -use-ocamlfind -I src -I lib # uses ocamlyacc |
| 12 |
.PHONY: all clean byte native profile debug sanity test |
| 13 |
|
| 14 |
OCB_FLAGS = -use-ocamlfind -use-menhir -I src -I lib # uses menhir |
| 15 |
OCB = ocamlbuild $(OCB_FLAGS) |
| 16 |
|
| 17 |
all: native byte # profile debug |
| 18 |
|
| 19 |
clean: |
| 20 |
$(OCB) -clean |
| 21 |
|
| 22 |
native: sanity |
| 23 |
$(OCB) main.native |
| 24 |
|
| 25 |
byte: sanity |
| 26 |
$(OCB) main.byte |
| 27 |
|
| 28 |
profile: sanity |
| 29 |
$(OCB) -tag profile main.native |
| 30 |
|
| 31 |
debug: sanity |
| 32 |
$(OCB) -tag debug main.byte |
| 33 |
|
| 34 |
# check that menhir is installed, use "opam install menhir" |
| 35 |
sanity: |
| 36 |
which menhir |
| 37 |
|
| 38 |
test: native |
| 39 |
./main.native "2 + 3 * 3" |