Makefile 1.6 KB

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