aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--erlang.mk33
-rw-r--r--examples/chunked_hello_world/Makefile8
-rw-r--r--examples/compress_response/Makefile8
-rw-r--r--examples/cookie/Makefile8
-rw-r--r--examples/echo_get/Makefile8
-rw-r--r--examples/echo_post/Makefile8
-rw-r--r--examples/error_hook/Makefile8
-rw-r--r--examples/eventsource/Makefile8
-rw-r--r--examples/hello_world/Makefile8
-rw-r--r--examples/rest_basic_auth/Makefile8
-rw-r--r--examples/rest_hello_world/Makefile8
-rw-r--r--examples/rest_pastebin/Makefile8
-rw-r--r--examples/rest_stream_response/Makefile8
-rw-r--r--examples/ssl_hello_world/Makefile8
-rw-r--r--examples/static_world/Makefile8
-rw-r--r--examples/web_server/Makefile8
-rw-r--r--examples/websocket/Makefile8
-rw-r--r--guide/getting_started.md16
18 files changed, 37 insertions, 140 deletions
diff --git a/erlang.mk b/erlang.mk
index 2c09cf8..6fc011e 100644
--- a/erlang.mk
+++ b/erlang.mk
@@ -24,7 +24,7 @@ export PKG_FILE
PKG_FILE_URL ?= https://raw.github.com/extend/erlang.mk/master/packages.v1.tsv
define get_pkg_file
- wget -O $(PKG_FILE) $(PKG_FILE_URL)
+ wget -O $(PKG_FILE) $(PKG_FILE_URL) || rm $(PKG_FILE)
endef
# Verbosity and tweaks.
@@ -46,8 +46,35 @@ dtl_verbose = $(dtl_verbose_$(V))
gen_verbose_0 = @echo " GEN " $@;
gen_verbose = $(gen_verbose_$(V))
-.PHONY: all clean-all app clean deps clean-deps docs clean-docs \
- build-tests tests build-plt dialyze
+.PHONY: rel clean-rel all clean-all app clean deps clean-deps \
+ docs clean-docs build-tests tests build-plt dialyze
+
+# Release.
+
+RELX_CONFIG ?= $(CURDIR)/relx.config
+
+ifneq ($(wildcard $(RELX_CONFIG)),)
+
+RELX ?= $(CURDIR)/relx
+export RELX
+
+RELX_URL ?= https://github.com/erlware/relx/releases/download/0.4.0/relx
+
+define get_relx
+ wget -O $(RELX) $(RELX_URL) || rm $(RELX)
+ chmod +x $(RELX)
+endef
+
+rel: clean-rel all $(RELX)
+ @$(RELX)
+
+$(RELX):
+ @$(call get_relx)
+
+clean-rel:
+ @rm -rf _rel
+
+endif
# Deps directory.
diff --git a/examples/chunked_hello_world/Makefile b/examples/chunked_hello_world/Makefile
index e50baa8..7939941 100644
--- a/examples/chunked_hello_world/Makefile
+++ b/examples/chunked_hello_world/Makefile
@@ -3,12 +3,4 @@ PROJECT = chunked_hello_world
DEPS = cowboy
dep_cowboy = pkg://cowboy master
-.PHONY: release clean-release
-
-release: clean-release all
- relx
-
-clean-release:
- rm -rf _rel
-
include ../../erlang.mk
diff --git a/examples/compress_response/Makefile b/examples/compress_response/Makefile
index 4841147..785ba6d 100644
--- a/examples/compress_response/Makefile
+++ b/examples/compress_response/Makefile
@@ -3,12 +3,4 @@ PROJECT = compress_response
DEPS = cowboy
dep_cowboy = pkg://cowboy master
-.PHONY: release clean-release
-
-release: clean-release all
- relx
-
-clean-release:
- rm -rf _rel
-
include ../../erlang.mk
diff --git a/examples/cookie/Makefile b/examples/cookie/Makefile
index fe61f29..d07e9b5 100644
--- a/examples/cookie/Makefile
+++ b/examples/cookie/Makefile
@@ -4,12 +4,4 @@ DEPS = cowboy erlydtl
dep_cowboy = pkg://cowboy master
dep_erlydtl = pkg://erlydtl master
-.PHONY: release clean-release
-
-release: clean-release all
- relx
-
-clean-release:
- rm -rf _rel
-
include ../../erlang.mk
diff --git a/examples/echo_get/Makefile b/examples/echo_get/Makefile
index 76c9f7b..30ab5f4 100644
--- a/examples/echo_get/Makefile
+++ b/examples/echo_get/Makefile
@@ -3,12 +3,4 @@ PROJECT = echo_get
DEPS = cowboy
dep_cowboy = pkg://cowboy master
-.PHONY: release clean-release
-
-release: clean-release all
- relx
-
-clean-release:
- rm -rf _rel
-
include ../../erlang.mk
diff --git a/examples/echo_post/Makefile b/examples/echo_post/Makefile
index 10ce980..85cf181 100644
--- a/examples/echo_post/Makefile
+++ b/examples/echo_post/Makefile
@@ -3,12 +3,4 @@ PROJECT = echo_post
DEPS = cowboy
dep_cowboy = pkg://cowboy master
-.PHONY: release clean-release
-
-release: clean-release all
- relx
-
-clean-release:
- rm -rf _rel
-
include ../../erlang.mk
diff --git a/examples/error_hook/Makefile b/examples/error_hook/Makefile
index a4313ef..5ddb343 100644
--- a/examples/error_hook/Makefile
+++ b/examples/error_hook/Makefile
@@ -3,12 +3,4 @@ PROJECT = error_hook
DEPS = cowboy
dep_cowboy = pkg://cowboy master
-.PHONY: release clean-release
-
-release: clean-release all
- relx
-
-clean-release:
- rm -rf _rel
-
include ../../erlang.mk
diff --git a/examples/eventsource/Makefile b/examples/eventsource/Makefile
index 176c9e0..991cf8a 100644
--- a/examples/eventsource/Makefile
+++ b/examples/eventsource/Makefile
@@ -3,12 +3,4 @@ PROJECT = eventsource
DEPS = cowboy
dep_cowboy = pkg://cowboy master
-.PHONY: release clean-release
-
-release: clean-release all
- relx
-
-clean-release:
- rm -rf _rel
-
include ../../erlang.mk
diff --git a/examples/hello_world/Makefile b/examples/hello_world/Makefile
index 1e6ef79..d63349e 100644
--- a/examples/hello_world/Makefile
+++ b/examples/hello_world/Makefile
@@ -3,12 +3,4 @@ PROJECT = hello_world
DEPS = cowboy
dep_cowboy = pkg://cowboy master
-.PHONY: release clean-release
-
-release: clean-release all
- relx
-
-clean-release:
- rm -rf _rel
-
include ../../erlang.mk
diff --git a/examples/rest_basic_auth/Makefile b/examples/rest_basic_auth/Makefile
index aa73c91..65c0ad8 100644
--- a/examples/rest_basic_auth/Makefile
+++ b/examples/rest_basic_auth/Makefile
@@ -3,12 +3,4 @@ PROJECT = rest_basic_auth
DEPS = cowboy
dep_cowboy = pkg://cowboy master
-.PHONY: release clean-release
-
-release: clean-release all
- relx
-
-clean-release:
- rm -rf _rel
-
include ../../erlang.mk
diff --git a/examples/rest_hello_world/Makefile b/examples/rest_hello_world/Makefile
index 031d26e..f72c8af 100644
--- a/examples/rest_hello_world/Makefile
+++ b/examples/rest_hello_world/Makefile
@@ -3,12 +3,4 @@ PROJECT = rest_hello_world
DEPS = cowboy
dep_cowboy = pkg://cowboy master
-.PHONY: release clean-release
-
-release: clean-release all
- relx
-
-clean-release:
- rm -rf _rel
-
include ../../erlang.mk
diff --git a/examples/rest_pastebin/Makefile b/examples/rest_pastebin/Makefile
index ba6b378..ea7764a 100644
--- a/examples/rest_pastebin/Makefile
+++ b/examples/rest_pastebin/Makefile
@@ -3,12 +3,4 @@ PROJECT = rest_pastebin
DEPS = cowboy
dep_cowboy = pkg://cowboy master
-.PHONY: release clean-release
-
-release: clean-release all
- relx
-
-clean-release:
- rm -rf _rel
-
include ../../erlang.mk
diff --git a/examples/rest_stream_response/Makefile b/examples/rest_stream_response/Makefile
index dfea603..576a0d2 100644
--- a/examples/rest_stream_response/Makefile
+++ b/examples/rest_stream_response/Makefile
@@ -3,12 +3,4 @@ PROJECT = rest_stream_response
DEPS = cowboy
dep_cowboy = pkg://cowboy master
-.PHONY: release clean-release
-
-release: clean-release all
- relx
-
-clean-release:
- rm -rf _rel
-
include ../../erlang.mk
diff --git a/examples/ssl_hello_world/Makefile b/examples/ssl_hello_world/Makefile
index 412b2b3..2817800 100644
--- a/examples/ssl_hello_world/Makefile
+++ b/examples/ssl_hello_world/Makefile
@@ -3,12 +3,4 @@ PROJECT = ssl_hello_world
DEPS = cowboy
dep_cowboy = pkg://cowboy master
-.PHONY: release clean-release
-
-release: clean-release all
- relx
-
-clean-release:
- rm -rf _rel
-
include ../../erlang.mk
diff --git a/examples/static_world/Makefile b/examples/static_world/Makefile
index 4c7b600..f52c0cf 100644
--- a/examples/static_world/Makefile
+++ b/examples/static_world/Makefile
@@ -3,12 +3,4 @@ PROJECT = static_world
DEPS = cowboy
dep_cowboy = pkg://cowboy master
-.PHONY: release clean-release
-
-release: clean-release all
- relx
-
-clean-release:
- rm -rf _rel
-
include ../../erlang.mk
diff --git a/examples/web_server/Makefile b/examples/web_server/Makefile
index 57cd131..c515c4b 100644
--- a/examples/web_server/Makefile
+++ b/examples/web_server/Makefile
@@ -3,12 +3,4 @@ PROJECT = web_server
DEPS = cowboy
dep_cowboy = pkg://cowboy master
-.PHONY: release clean-release
-
-release: clean-release all
- relx
-
-clean-release:
- rm -rf _rel
-
include ../../erlang.mk
diff --git a/examples/websocket/Makefile b/examples/websocket/Makefile
index 0c6826c..b9fcbff 100644
--- a/examples/websocket/Makefile
+++ b/examples/websocket/Makefile
@@ -3,12 +3,4 @@ PROJECT = websocket
DEPS = cowboy
dep_cowboy = pkg://cowboy master
-.PHONY: release clean-release
-
-release: clean-release all
- relx
-
-clean-release:
- rm -rf _rel
-
include ../../erlang.mk
diff --git a/guide/getting_started.md b/guide/getting_started.md
index 3143a7f..4d3e7ab 100644
--- a/guide/getting_started.md
+++ b/guide/getting_started.md
@@ -44,6 +44,7 @@ hello_erlang/
hello_erlang_sup.beam
hello_handler.beam
_rel/
+ relx
```
As you can probably guess, the `.app.src` file end up becoming
@@ -271,14 +272,11 @@ $ make
```
That's not all however, as we want to create a working release.
-For that purpose we will need `relx`. You can download it directly
-[from Github](https://github.com/erlware/relx). After downloading
-it, you will need to build it using `make`, which should give
-you a `relx` executable that you can then put in your `$PATH`.
-You only need to do this once.
-
-We are almost ready to build the release. All that's left is
-the `relx.config` file! In it, we only need to tell `relx` that
+For that purpose, we need to create a `relx.config` file. When
+this file exists, `erlang.mk` will automatically download `relx`
+and build the release when you type `make`.
+
+In the `relx.config` file, we only need to tell `relx` that
we want the release to include the `hello_erlang` application,
and that we want an extended start script for convenience.
`relx` will figure out which other applications are required
@@ -295,7 +293,7 @@ version, and the applications to be included.
We can now build and start the release.
``` bash
-$ relx
+$ make
$ ./_rel/bin/hello_erlang console
```