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