Makefile 1.7 KB

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