| 1 | MAKEFLAGS := --no-builtin-rules |
| 2 | |
| 3 | EXE_TYPE := byte # byte | native |
| 4 | EXECUTABLES := tigerc tiger_tests |
| 5 | OCAMLBUILD_FLAGS := -I src/exe -I src/lib/tiger |
| 6 | OCAMLBUILD := ocamlbuild $(OCAMLBUILD_FLAGS) |
| 7 | |
| 8 | .PHONY: \ |
| 9 | all \ |
| 10 | build \ |
| 11 | clean \ |
| 12 | test |
| 13 | |
| 14 | all: |
| 15 | @$(MAKE) -s clean |
| 16 | @$(MAKE) -s build |
| 17 | @$(MAKE) -s test |
| 18 | |
| 19 | build: |
| 20 | @$(OCAMLBUILD) $(addsuffix .$(EXE_TYPE),$(EXECUTABLES)) |
| 21 | @mkdir -p bin/exe |
| 22 | $(foreach exe,$(EXECUTABLES),cp _build/src/exe/$(exe).$(EXE_TYPE) bin/exe/$(exe); ) |
| 23 | @rm $(addsuffix .$(EXE_TYPE),$(EXECUTABLES)) |
| 24 | |
| 25 | clean: |
| 26 | @$(OCAMLBUILD) -clean |
| 27 | @rm -rf ./bin |
| 28 | |
| 29 | test: bin/exe/tiger_tests |
| 30 | @./$< |