| 1 | MAKEFLAGS := --no-builtin-rules |
| 2 | |
| 3 | EXE_TYPE := byte # byte | native |
| 4 | EXECUTABLES := tigerc tigert |
| 5 | OCAMLBUILD_FLAGS_DIRS := -I src/exe -I src/lib/tiger |
| 6 | OCAMLBUILD_FLAGS_COMP := -cflags '-w A' |
| 7 | OCAMLBUILD_FLAGS_YACC := -yaccflag '-v' |
| 8 | OCAMLBUILD := \ |
| 9 | ocamlbuild \ |
| 10 | -classic-display \ |
| 11 | $(OCAMLBUILD_FLAGS_COMP) \ |
| 12 | $(OCAMLBUILD_FLAGS_DIRS) \ |
| 13 | $(OCAMLBUILD_FLAGS_YACC) |
| 14 | |
| 15 | .PHONY: \ |
| 16 | all \ |
| 17 | build \ |
| 18 | clean \ |
| 19 | test |
| 20 | |
| 21 | all: clean |
| 22 | @$(MAKE) -s test |
| 23 | |
| 24 | build: |
| 25 | @$(OCAMLBUILD) $(addsuffix .$(EXE_TYPE),$(EXECUTABLES)) |
| 26 | @mkdir -p bin/exe |
| 27 | $(foreach exe,$(EXECUTABLES),cp _build/src/exe/$(exe).$(EXE_TYPE) bin/exe/$(exe); ) |
| 28 | @rm $(addsuffix .$(EXE_TYPE),$(EXECUTABLES)) |
| 29 | |
| 30 | clean: |
| 31 | @$(OCAMLBUILD) -clean |
| 32 | @rm -rf ./bin |
| 33 | |
| 34 | test: build |
| 35 | @./bin/exe/tigert |