aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/relx.mk
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2015-05-09 22:08:47 +0300
committerLoïc Hoguin <[email protected]>2015-05-09 22:08:47 +0300
commit5c5179dba66f55974c81e945ff4cf970a01c3d40 (patch)
treebfba53598005aaeeeee0ff9d5cbabc9775b8bc2a /plugins/relx.mk
parent9bfc6ec0be7157115d07da8fafaeba8d1aa4f346 (diff)
downloaderlang.mk-5c5179dba66f55974c81e945ff4cf970a01c3d40.tar.gz
erlang.mk-5c5179dba66f55974c81e945ff4cf970a01c3d40.tar.bz2
erlang.mk-5c5179dba66f55974c81e945ff4cf970a01c3d40.zip
Add a 'run' command to run the relx release
Should only be used during development. Stolen idea from Tristan Sloughter who stole it from Ahmad Sherif. This commit also introduces the 'erlang' function for executing Erlang code written directly in the Makefile. The rest of the project will eventually move to using it as it's much cleaner than the previous solution.
Diffstat (limited to 'plugins/relx.mk')
-rw-r--r--plugins/relx.mk19
1 files changed, 18 insertions, 1 deletions
diff --git a/plugins/relx.mk b/plugins/relx.mk
index 43f3d69..177e5a7 100644
--- a/plugins/relx.mk
+++ b/plugins/relx.mk
@@ -1,7 +1,7 @@
# Copyright (c) 2013-2015, Loïc Hoguin <[email protected]>
# This file is part of erlang.mk and subject to the terms of the ISC License.
-.PHONY: relx-rel distclean-relx-rel distclean-relx
+.PHONY: relx-rel distclean-relx-rel distclean-relx run
# Configuration.
@@ -46,3 +46,20 @@ distclean-relx-rel:
distclean-relx:
$(gen_verbose) rm -rf $(RELX)
+
+ifeq ($(wildcard $(RELX_CONFIG)),)
+run:
+else
+
+define get_relx_release.erl
+{ok, Config} = file:consult("$(RELX_CONFIG)"),
+{release, {Name, _}, _} = lists:keyfind(release, 1, Config),
+io:format("~s", [Name]),
+halt(0).
+endef
+
+RELX_RELEASE = `$(call erlang,$(get_relx_release.erl))`
+
+run: all
+ @$(RELX_OUTPUT_DIR)/$(RELX_RELEASE)/bin/$(RELX_RELEASE) console
+endif