otp.mk 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. ifeq ($(OS),Windows_NT)
  2. SEPARATOR=;
  3. else
  4. SEPARATOR=:
  5. endif
  6. VM := vm.args
  7. SYS := sys.config
  8. ERL_ARGS := -args_file $(VM) -config $(SYS)
  9. RUN_DIR ?= rels/web/devbox
  10. LOG_DIR ?= rels/web/devbox/logs
  11. empty :=
  12. ROOTS := apps deps
  13. space := $(empty) $(empty)
  14. comma := $(empty),$(empty)
  15. ERL_LIBS := $(subst $(space),$(SEPARATOR),$(ROOTS))
  16. #clean:
  17. # rm -f applist
  18. #.applist:
  19. # $(eval APPS := $(subst deps/,,$(subst apps/,,$(shell find apps deps -maxdepth 1 -mindepth 1 -type d))))
  20. compile:
  21. ./mad dep com
  22. $(RUN_DIR) $(LOG_DIR):
  23. mkdir -p $(RUN_DIR) & mkdir -p $(LOG_DIR)
  24. #console: applist
  25. console:
  26. ERL_LIBS="$(ERL_LIBS)" erl +pc unicode $(ERL_ARGS) -eval 'application:ensure_all_started(n4u_sample)'
  27. # ERL_LIBS="$(ERL_LIBS)" erl +pc unicode $(ERL_ARGS) -eval 'application:ensure_all_started($(PROJECT)),n4u_sample:start([],[]),application:start($(PROJECT))'
  28. # ERL_LIBS="$(ERL_LIBS)" erl +pc unicode $(ERL_ARGS) -eval 'n4u_sample:start([],[])'
  29. # ERL_LIBS="$(ERL_LIBS)" erl +pc unicode $(ERL_ARGS) -eval 'application:start($(PROJECT))'
  30. #start: $(RUN_DIR) $(LOG_DIR) .applist
  31. start: $(RUN_DIR) $(LOG_DIR)
  32. RUN_ERL_LOG_GENERATIONS=1000 RUN_ERL_LOG_MAXSIZE=20000000 \
  33. ERL_LIBS=$(ERL_LIBS) run_erl -daemon $(RUN_DIR)/ $(LOG_DIR)/ "exec $(MAKE) console"
  34. attach:
  35. to_erl $(RUN_DIR)/
  36. stop:
  37. @kill -9 $(shell ps ax -o pid= -o command=|grep $(PROJECT)|grep $(COOKIE)|awk '{print $$1}')
  38. .PHONY: console start attach