| 1 | MAKEFLAGS := --no-builtin-rules |
| 2 | |
| 3 | DIR_TEST_CASES := ./testcases |
| 4 | |
| 5 | EXE_TYPE := native # byte | native |
| 6 | EXECUTABLES := tigerc tigert |
| 7 | OCAMLBUILD_FLAGS_PKGS := -pkg unix |
| 8 | OCAMLBUILD_FLAGS_DIRS := -I src/exe -I src/lib/tiger |
| 9 | OCAMLBUILD_FLAGS_COMP := -cflags '-g -w A' |
| 10 | OCAMLBUILD_FLAGS_YACC := -yaccflag '-v' |
| 11 | OCAMLBUILD := \ |
| 12 | ocamlbuild \ |
| 13 | $(OCAMLBUILD_FLAGS_PKGS) \ |
| 14 | $(OCAMLBUILD_FLAGS_COMP) \ |
| 15 | $(OCAMLBUILD_FLAGS_DIRS) \ |
| 16 | $(OCAMLBUILD_FLAGS_YACC) |
| 17 | |
| 18 | .PHONY: \ |
| 19 | all \ |
| 20 | build \ |
| 21 | clean \ |
| 22 | test_all \ |
| 23 | test_book \ |
| 24 | test_micro \ |
| 25 | test |
| 26 | |
| 27 | all: clean |
| 28 | @$(MAKE) -s test |
| 29 | |
| 30 | build: |
| 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)) |
| 35 | |
| 36 | clean: |
| 37 | @$(OCAMLBUILD) -clean |
| 38 | @rm -rf ./bin |
| 39 | |
| 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 |