Makefile 1005 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. .PHONY: all compile run test doc clean
  2. REBAR=$(shell which rebar3 || echo ./rebar3)
  3. MINIMAL_COVERAGE=80
  4. all: compile
  5. compile: $(REBAR)
  6. $(REBAR) compile
  7. run: $(REBAR)
  8. @$(REBAR) as test shell --apps pooler --config config/demo.config
  9. test: $(REBAR)
  10. $(REBAR) eunit --verbose --cover
  11. $(REBAR) cover --verbose --min_coverage $(MINIMAL_COVERAGE)
  12. xref: $(REBAR)
  13. $(REBAR) xref
  14. format: $(REBAR)
  15. $(REBAR) fmt
  16. format_check: $(REBAR)
  17. $(REBAR) fmt --check
  18. doc: $(REBAR)
  19. $(REBAR) edoc
  20. clean: $(REBAR)
  21. $(REBAR) clean
  22. $(REBAR) as test clean
  23. @rm -rf ./erl_crash.dump
  24. dialyzer: $(REBAR)
  25. $(REBAR) dialyzer
  26. # Get rebar3 if it doesn't exist. If rebar3 was found on PATH, the
  27. # $(REBAR) dep will be satisfied since the file will exist.
  28. REBAR_URL = https://s3.amazonaws.com/rebar3/rebar3
  29. ./rebar3:
  30. @echo "Fetching rebar3 from $(REBAR_URL)"
  31. @erl -noinput -noshell -s inets -s ssl -eval '{ok, _} = httpc:request(get, {"${REBAR_URL}", []}, [], [{stream, "${REBAR}"}])' -s init stop
  32. chmod +x ${REBAR}