Commit | Line | Data |
---|---|---|
1c975d08 SK |
1 | MAKEFLAGS := --no-builtin-rules |
2 | ||
fca49f4f SK |
3 | DIR_TEST_CASES := ./testcases |
4 | ||
b53d50d3 | 5 | EXE_TYPE := native # byte | native |
d3bdde4b | 6 | EXECUTABLES := tigerc tigert |
38ffcb1f | 7 | OCAMLBUILD_FLAGS_PKGS := -pkg unix |
129abbe9 | 8 | OCAMLBUILD_FLAGS_DIRS := -I src/exe -I src/lib/tiger |
b53d50d3 | 9 | OCAMLBUILD_FLAGS_COMP := -cflags '-g -w A' |
4309a757 | 10 | OCAMLBUILD_FLAGS_YACC := -yaccflag '-v' |
a9002dfe SK |
11 | OCAMLBUILD := \ |
12 | ocamlbuild \ | |
38ffcb1f | 13 | $(OCAMLBUILD_FLAGS_PKGS) \ |
a9002dfe | 14 | $(OCAMLBUILD_FLAGS_COMP) \ |
4309a757 SK |
15 | $(OCAMLBUILD_FLAGS_DIRS) \ |
16 | $(OCAMLBUILD_FLAGS_YACC) | |
1c975d08 SK |
17 | |
18 | .PHONY: \ | |
a9002dfe SK |
19 | all \ |
20 | build \ | |
21 | clean \ | |
fca49f4f SK |
22 | test_all \ |
23 | test_book \ | |
24 | test_micro \ | |
a9002dfe | 25 | test |
1c975d08 | 26 | |
a4905b7a | 27 | all: clean |
78c9eca5 | 28 | @$(MAKE) -s test |
1c975d08 SK |
29 | |
30 | build: | |
78c9eca5 SK |
31 | @$(OCAMLBUILD) $(addsuffix .$(EXE_TYPE),$(EXECUTABLES)) |
32 | @mkdir -p bin/exe | |
33 | $(foreach exe,$(EXECUTABLES),cp _build/src/exe/$(exe).$(EXE_TYPE) bin/exe/$(exe); ) | |
34 | @rm $(addsuffix .$(EXE_TYPE),$(EXECUTABLES)) | |
1c975d08 SK |
35 | |
36 | clean: | |
78c9eca5 SK |
37 | @$(OCAMLBUILD) -clean |
38 | @rm -rf ./bin | |
1c975d08 | 39 | |
fca49f4f SK |
40 | test: test_all |
41 | ||
42 | test_all: build | |
43 | @./bin/exe/tigert all -dir $(DIR_TEST_CASES) | |
44 | ||
45 | test_book: build | |
46 | @./bin/exe/tigert book -dir $(DIR_TEST_CASES) | |
47 | ||
48 | test_micro: build | |
49 | @./bin/exe/tigert micro |