Makefile 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. ERL=erl
  2. ERLC=erlc
  3. REBAR=./rebar $(REBAR_ARGS)
  4. all: compile
  5. compile: check-slex get-deps
  6. @$(REBAR) compile
  7. check-slex: src/erlydtl_scanner.erl
  8. src/erlydtl_scanner.erl: src/erlydtl_scanner.slex
  9. @echo Notice: $@ is outdated by $<, consider running "'make slex'".
  10. get-deps:
  11. @$(REBAR) get-deps
  12. update-deps:
  13. @$(REBAR) update-deps
  14. .PHONY: tests
  15. tests: export EXTRA_CONFIG=rebar-tests.config
  16. tests: src/erlydtl_parser.erl
  17. @$(REBAR) eunit
  18. check: tests dialyze
  19. ## dialyzer
  20. PLT_FILE = ~/erlydtl.plt
  21. PLT_APPS ?= kernel stdlib compiler erts eunit syntax_tools
  22. DIALYZER_OPTS ?= -Werror_handling -Wrace_conditions -Wunmatched_returns \
  23. -Wunderspecs --verbose --fullpath
  24. .PHONY: dialyze
  25. dialyze: compile
  26. @[ -f $(PLT_FILE) ] || $(MAKE) plt
  27. @dialyzer --plt $(PLT_FILE) $(DIALYZER_OPTS) ebin || [ $$? -eq 2 ];
  28. ## In case you are missing a plt file for dialyzer,
  29. ## you can run/adapt this command
  30. .PHONY: plt
  31. plt: compile
  32. # we need to remove second copy of file
  33. rm -f deps/merl/priv/merl_transform.beam
  34. @echo "Building PLT, may take a few minutes"
  35. @dialyzer --build_plt --output_plt $(PLT_FILE) --apps \
  36. $(PLT_APPS) deps/* || [ $$? -eq 2 ];
  37. clean:
  38. @[ ! -d deps/merl ] || { echo "Clean merl..." ; $(MAKE) -C deps/merl clean ;}
  39. @$(REBAR) -C rebar-slex.config clean
  40. rm -fv erl_crash.dump
  41. really-clean: clean
  42. rm -f $(PLT_FILE)
  43. # rebuild any .slex files as well.. not included by default to avoid
  44. # the slex dependency, which is only needed in case the .slex file has
  45. # been modified locally.
  46. slex: REBAR_DEPS ?= get-deps update-deps
  47. slex: slex-compile
  48. slex-skip-deps: REBAR_DEPS:=
  49. slex-skip-deps: slex-compile
  50. slex-compile:
  51. @$(REBAR) -C rebar-slex.config $(REBAR_DEPS) compile
  52. shell:
  53. @$(ERL) -pz ebin deps/*/ebin
  54. # this file must exist for rebar eunit to work
  55. # but is only built when running rebar compile
  56. src/erlydtl_parser.erl: compile