Browse Source

Merge branch 'master' of git://github.com/Version2beta/erlang.mk

Loïc Hoguin 10 years ago
parent
commit
b8b9fffb39
4 changed files with 74 additions and 0 deletions
  1. 16 0
      README.md
  2. 1 0
      build.config
  3. 29 0
      erlang.mk
  4. 28 0
      plugins/shell.mk

+ 16 - 0
README.md

@@ -328,6 +328,22 @@ If `RELX_OPTS` includes the `-o` option (instead of using
 the list, otherwise erlang.mk will fail to find it and
 the list, otherwise erlang.mk will fail to find it and
 will not be able to clean up the release directory.
 will not be able to clean up the release directory.
 
 
+Shell plugin
+------------
+
+This plugin is available by default.
+
+`SHELL_DEPS` adds the specified modules only when `make shell`
+or `make build-shell-deps` is run. For example, to include a module
+reloader and TDD test runner, one might add `SHELL_DEPS = tddreloader`
+to the Makefile.
+
+You can add extra `erl` options by defining the `SHELL_OPTS` variable.
+For more information please see `erl -man erl`.
+
+`SHELL_PATH` adds paths to the shell's library search path. By default
+this option sets the paths to `-pa ../$(PROJECT)/ebin $(DEPS_DIR)/*/ebin`.
+
 Contributing
 Contributing
 ------------
 ------------
 
 

+ 1 - 0
build.config

@@ -16,3 +16,4 @@ plugins/dialyzer
 plugins/erlydtl
 plugins/erlydtl
 plugins/edoc
 plugins/edoc
 plugins/relx
 plugins/relx
+plugins/shell

+ 29 - 0
erlang.mk

@@ -742,3 +742,32 @@ distclean-relx-rel:
 
 
 distclean-relx:
 distclean-relx:
 	$(gen_verbose) rm -rf $(RELX)
 	$(gen_verbose) rm -rf $(RELX)
+
+# Copyright (c) 2014, M Robert Martin <rob@version2beta.com>
+# This file is contributed to erlang.mk and subject to the terms of the ISC License.
+
+.PHONY: shell
+
+# Configuration.
+
+SHELL_PATH ?= -pa ../$(PROJECT)/ebin $(DEPS_DIR)/*/ebin
+SHELL_OPTS ?=
+
+ALL_SHELL_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(SHELL_DEPS))
+
+# Core targets
+
+help::
+	@printf "%s\n" "" \
+		"Shell targets:" \
+		"  shell              Run an erlang shell with SHELL_OPTS or reasonable default"
+
+# Plugin-specific targets.
+
+$(foreach dep,$(SHELL_DEPS),$(eval $(call dep_target,$(dep))))
+
+build-shell-deps: $(ALL_SHELL_DEPS_DIRS)
+	@for dep in $(ALL_SHELL_DEPS_DIRS) ; do $(MAKE) -C $$dep ; done
+
+shell: build-shell-deps
+	$(gen_verbose) erl $(SHELL_PATH) $(SHELL_OPTS)

+ 28 - 0
plugins/shell.mk

@@ -0,0 +1,28 @@
+# Copyright (c) 2014, M Robert Martin <rob@version2beta.com>
+# This file is contributed to erlang.mk and subject to the terms of the ISC License.
+
+.PHONY: shell
+
+# Configuration.
+
+SHELL_PATH ?= -pa ../$(PROJECT)/ebin $(DEPS_DIR)/*/ebin
+SHELL_OPTS ?=
+
+ALL_SHELL_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(SHELL_DEPS))
+
+# Core targets
+
+help::
+	@printf "%s\n" "" \
+		"Shell targets:" \
+		"  shell              Run an erlang shell with SHELL_OPTS or reasonable default"
+
+# Plugin-specific targets.
+
+$(foreach dep,$(SHELL_DEPS),$(eval $(call dep_target,$(dep))))
+
+build-shell-deps: $(ALL_SHELL_DEPS_DIRS)
+	@for dep in $(ALL_SHELL_DEPS_DIRS) ; do $(MAKE) -C $$dep ; done
+
+shell: build-shell-deps
+	$(gen_verbose) erl $(SHELL_PATH) $(SHELL_OPTS)