aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2014-09-11 17:48:39 +0200
committerLoïc Hoguin <[email protected]>2014-09-11 17:49:38 +0200
commitb8b9fffb39537f44c65b6272e268ea2c88a5be56 (patch)
treea1781e7bd0febf162d2e23aa2bcd9df2002c41f4
parentdac7978f780bd5712d9589cb6fb7d913af84ddb9 (diff)
parent889f959855de39323802791d02d0164df21d0a2c (diff)
downloaderlang.mk-b8b9fffb39537f44c65b6272e268ea2c88a5be56.tar.gz
erlang.mk-b8b9fffb39537f44c65b6272e268ea2c88a5be56.tar.bz2
erlang.mk-b8b9fffb39537f44c65b6272e268ea2c88a5be56.zip
Merge branch 'master' of git://github.com/Version2beta/erlang.mk
-rw-r--r--README.md16
-rw-r--r--build.config1
-rw-r--r--erlang.mk29
-rw-r--r--plugins/shell.mk28
4 files changed, 74 insertions, 0 deletions
diff --git a/README.md b/README.md
index 793b790..6d6452e 100644
--- a/README.md
+++ b/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
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
------------
diff --git a/build.config b/build.config
index 7440d0d..7bc09ff 100644
--- a/build.config
+++ b/build.config
@@ -16,3 +16,4 @@ plugins/dialyzer
plugins/erlydtl
plugins/edoc
plugins/relx
+plugins/shell
diff --git a/erlang.mk b/erlang.mk
index fcd8eaf..05d068d 100644
--- a/erlang.mk
+++ b/erlang.mk
@@ -742,3 +742,32 @@ distclean-relx-rel:
distclean-relx:
$(gen_verbose) rm -rf $(RELX)
+
+# Copyright (c) 2014, M Robert Martin <[email protected]>
+# 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)
diff --git a/plugins/shell.mk b/plugins/shell.mk
new file mode 100644
index 0000000..9cbee2e
--- /dev/null
+++ b/plugins/shell.mk
@@ -0,0 +1,28 @@
+# Copyright (c) 2014, M Robert Martin <[email protected]>
+# 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)