Rename "tiger" dir to "compiler"
[tiger.ml.git] / compiler / Makefile
diff --git a/compiler/Makefile b/compiler/Makefile
new file mode 100644 (file)
index 0000000..24696cd
--- /dev/null
@@ -0,0 +1,35 @@
+MAKEFLAGS := --no-builtin-rules
+
+EXE_TYPE              := byte  # byte | native
+EXECUTABLES           := tigerc tiger_tests
+OCAMLBUILD_FLAGS_DIRS := -I src/exe -I src/lib/tiger
+OCAMLBUILD_FLAGS_COMP := -cflags '-w A'
+OCAMLBUILD_FLAGS_YACC := -yaccflag '-v'
+OCAMLBUILD            := \
+  ocamlbuild \
+    -classic-display \
+    $(OCAMLBUILD_FLAGS_COMP) \
+    $(OCAMLBUILD_FLAGS_DIRS) \
+    $(OCAMLBUILD_FLAGS_YACC)
+
+.PHONY: \
+  all \
+  build \
+  clean \
+  test
+
+all: clean
+       @$(MAKE) -s test
+
+build:
+       @$(OCAMLBUILD) $(addsuffix .$(EXE_TYPE),$(EXECUTABLES))
+       @mkdir -p bin/exe
+       $(foreach exe,$(EXECUTABLES),cp _build/src/exe/$(exe).$(EXE_TYPE) bin/exe/$(exe); )
+       @rm $(addsuffix .$(EXE_TYPE),$(EXECUTABLES))
+
+clean:
+       @$(OCAMLBUILD) -clean
+       @rm -rf ./bin
+
+test: build
+       @./bin/exe/tiger_tests
This page took 0.03328 seconds and 4 git commands to generate.