Makefile 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 public_tests.txt
  43. for f in `cat public_tests.txt`; do \
  44. mkdir -p _tmp/test/`dirname $$f`; \
  45. cp test/$$f _tmp/test/$$f; \
  46. done
  47. cp $< _tmp
  48. cd _tmp && tar -czf ../$@ *
  49. rm -rf _tmp
  50. clean:: myclean
  51. myclean:
  52. rm -f a.out $(DIST_TGT) $(TESTSUITE_TGT) $(TOOLCHAIN_TGT)
  53. cleaner: clean
  54. rm -rf doc/$(RESULT) $(CIVAS) $(CIVVM)
  55. toolchain: $(TOOLCHAIN_TGT)
  56. $(TOOLCHAIN_TGT): all $(CIVAS) $(CIVVM)
  57. tar -czf $@ $(BIN_DIR)
  58. $(CIVAS): civic/as/civas
  59. cp $< $@
  60. $(CIVVM): civic/vm/civvm
  61. cp $< $@
  62. civic/as/civas civic/vm/civvm:
  63. make -C $(@D)
  64. doc/assembler.pdf: civic/docs/manual.pdf
  65. make -C $(<D)
  66. cp $< $@
  67. include OCamlMakefile