Makefile 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # Config for OCamlMakefile
  2. BIN_DIR := bin
  3. RESULT := $(BIN_DIR)/civcc
  4. GLOBALS := types globals stringify util
  5. PHASES := load parse print context desug typecheck dimreduce boolop constprop \
  6. unroll index assemble peephole output
  7. SOURCES := $(addsuffix .mli,$(GLOBALS)) $(addsuffix .ml,$(GLOBALS)) \
  8. lexer.mll parser.mly main.mli \
  9. $(patsubst %,phases/%.mli,$(PHASES)) $(patsubst %,phases/%.ml,$(PHASES)) \
  10. main.ml
  11. PRE_TARGETS := types.ml $(addsuffix .cmi,$(GLOBALS))
  12. LIBS := str unix
  13. # Other config
  14. CIVAS := $(BIN_DIR)/civas
  15. CIVVM := $(BIN_DIR)/civvm
  16. DIST_TGT := civicaml.tar.gz
  17. DIST_FILES := $(BIN_DIR) $(SOURCES) Makefile OCamlMakefile README.md test \
  18. .gitignore
  19. TESTSUITE_TGT := testsuite.tar.gz
  20. TOOLCHAIN_TGT := toolchain.tar.gz
  21. # Set debugging flag to enable exception backtraces for OCAMLRUNPARAM=b
  22. OCAMLFLAGS := -g
  23. OCAMLYACC := menhir
  24. YFLAGS := --infer --explain
  25. .PHONY: all check dist testsuite myclean cleaner toolchain
  26. all: native-code
  27. # The Types module needs an implementation file to stop ocamlc from complaining
  28. types.ml: types.mli
  29. cp $< $@
  30. check: all $(CIVAS) $(CIVVM)
  31. @cd test; \
  32. CIVAS=../$(CIVAS) \
  33. CIVVM=../$(CIVVM) \
  34. CIVCC=../$(RESULT) \
  35. CFLAGS="-v 1" \
  36. RUN_FUNCTIONAL=1 \
  37. bash run.bash basic preprocess nested_funs arrays
  38. dist: $(DIST_TGT)
  39. $(DIST_TGT): $(DIST_FILES)
  40. tar -czf $@ $^ --exclude=types.ml
  41. testsuite: $(TESTSUITE_TGT)
  42. $(TESTSUITE_TGT): TESTSUITE_README test
  43. tar -czf $@ $^
  44. clean:: myclean
  45. myclean:
  46. rm -f a.out $(DIST_TGT) $(TESTSUITE_TGT) $(TOOLCHAIN_TGT)
  47. cleaner: clean
  48. rm -rf doc/$(RESULT) $(CIVAS) $(CIVVM)
  49. toolchain: $(TOOLCHAIN_TGT)
  50. $(TOOLCHAIN_TGT): all $(CIVAS) $(CIVVM)
  51. tar -czf $@ $(BIN_DIR)
  52. $(CIVAS): civic/as/civas
  53. make -C civic
  54. cp $< $@
  55. $(CIVVM): civic/vm/civvm
  56. cp $< $@
  57. doc/assembler.pdf: civic/docs/manual.pdf
  58. make -C $(<D)
  59. cp $< $@
  60. include OCamlMakefile