shell.mk 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # Copyright (c) 2015-2016, Loïc Hoguin <essen@ninenines.eu>
  2. # Copyright (c) 2014, M Robert Martin <rob@version2beta.com>
  3. # This file is contributed to erlang.mk and subject to the terms of the ISC License.
  4. .PHONY: shell
  5. # Configuration.
  6. SHELL_ERL ?= erl
  7. SHELL_PATHS ?= $(CURDIR)/ebin $(TEST_DIR)
  8. SHELL_OPTS ?=
  9. ALL_SHELL_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(SHELL_DEPS))
  10. # Core targets
  11. help::
  12. $(verbose) printf "%s\n" "" \
  13. "Shell targets:" \
  14. " shell Run an erlang shell with SHELL_OPTS or reasonable default"
  15. # Plugin-specific targets.
  16. $(foreach dep,$(SHELL_DEPS),$(eval $(call dep_target,$(dep))))
  17. build-shell-deps: $(ALL_SHELL_DEPS_DIRS)
  18. $(verbose) set -e; for dep in $(ALL_SHELL_DEPS_DIRS) ; do \
  19. if [ -z "$(strip $(FULL))" ] && [ ! -L $$dep ] && [ -f $$dep/ebin/dep_built ]; then \
  20. :; \
  21. else \
  22. $(MAKE) -C $$dep IS_DEP=1; \
  23. if [ ! -L $$dep ] && [ -d $$dep/ebin ]; then touch $$dep/ebin/dep_built; fi; \
  24. fi \
  25. done
  26. shell:: build-shell-deps
  27. $(gen_verbose) $(SHELL_ERL) -pa $(SHELL_PATHS) $(SHELL_OPTS)