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