otp.mk 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. empty :=
  2. ROOTS := apps deps
  3. space := $(empty) $(empty)
  4. comma := $(empty),$(empty)
  5. VSN := $(shell git rev-parse HEAD | cut -c 1-6)
  6. DATE := $(shell git show -s --format="%ci" HEAD | sed -e 's/\+/Z/g' -e 's/-/./g' -e 's/ /-/g' -e 's/:/./g')
  7. ERL_LIBS := $(subst $(space),:,$(ROOTS))
  8. relx := "{release,{$(RELEASE),\"$(VER)\"},[$(subst $(space),$(comma),$(APPS))]}.\\n{include_erts,true}.\
  9. \\n{extended_start_script,true}.\\n{generate_start_script,true}.\\n{sys_config,\"$(SYS)\"}.\
  10. \\n{vm_args,\"$(VM)\"}.\\n{overlay,[{mkdir,\"log/sasl\"}]}."
  11. test: eunit ct
  12. compile: get-deps static-link
  13. delete-deps get-deps compile clean update-deps:
  14. rebar $@
  15. .applist:
  16. ./depman.erl $(APPS) > $@
  17. $(RUN_DIR) $(LOG_DIR):
  18. mkdir -p $(RUN_DIR) & mkdir -p $(LOG_DIR)
  19. console: .applist
  20. ERL_LIBS=$(ERL_LIBS) erl $(ERL_ARGS) -eval \
  21. '[ok = application:ensure_started(A, permanent) || A <- $(shell cat .applist)]'
  22. start: $(RUN_DIR) $(LOG_DIR) .applist
  23. ERL_LIBS=$(ERL_LIBS) run_erl -daemon $(RUN_DIR)/ $(LOG_DIR)/ "exec $(MAKE) console"
  24. attach:
  25. to_erl $(RUN_DIR)/
  26. release:
  27. echo $(shell echo $(relx) > relx.config) & relx
  28. stop:
  29. kill -9 `ps ax -o pid= -o command=|grep $(RELEASE)|grep $(COOKIE)|awk '{print $$1}'`
  30. $(PLT_NAME):
  31. ERL_LIBS=deps dialyzer --build_plt --output_plt $(PLT_NAME) --apps $(APPS) || true
  32. dialyze: $(PLT_NAME) compile
  33. dialyzer deps/*/ebin --plt $(PLT_NAME) --no_native -Werror_handling -Wunderspecs -Wrace_conditions
  34. tar:
  35. tar zcvf $(RELEASE)-$(VSN)-$(DATE).tar.gz _rel/lib/*/ebin _rel/lib/*/priv _rel/bin _rel/releases
  36. eunit:
  37. rebar eunit skip_deps=true
  38. ct:
  39. rebar ct skip_deps=true verbose=1
  40. .PHONY: delete-deps get-deps compile clean console start attach release update-deps dialyze ct eunit tar