aboutsummaryrefslogtreecommitdiffstats
path: root/erlang.mk
diff options
context:
space:
mode:
authorcrownedgrouse <[email protected]>2014-08-05 23:38:17 +0200
committercrownedgrouse <[email protected]>2014-09-11 21:57:22 +0200
commit5c89ea7f6b13bdf1124b4d95909e1932356595ae (patch)
tree13827a8d82592eadfa6d98407292c6530959a8ad /erlang.mk
parent4283f9d3fd13f21bcfa9463e8e43d33fe54e8b70 (diff)
downloaderlang.mk-5c89ea7f6b13bdf1124b4d95909e1932356595ae.tar.gz
erlang.mk-5c89ea7f6b13bdf1124b4d95909e1932356595ae.tar.bz2
erlang.mk-5c89ea7f6b13bdf1124b4d95909e1932356595ae.zip
Add wget fallback
Diffstat (limited to 'erlang.mk')
-rw-r--r--erlang.mk6
1 files changed, 6 insertions, 0 deletions
diff --git a/erlang.mk b/erlang.mk
index f37307d..acdcb70 100644
--- a/erlang.mk
+++ b/erlang.mk
@@ -62,9 +62,15 @@ help::
# Core functions.
+ifeq ($(shell which wget 2>/dev/null | wc -l), 1)
define core_http_get
wget --no-check-certificate -O $(1) $(2)|| rm $(1)
endef
+else
+define core_http_get
+ erl -noshell -eval ' ssl:start(), inets:start(), case httpc:request(get, {"$(2)", []}, [{autoredirect, true}], []) of {ok, {{_V, 200, _R}, _H, Body}} -> case file:write_file("$(1)", Body) of ok -> ok ; {error, R1} -> halt(R1) end ; {error, R2} -> halt(R2) end, halt(0). '
+endef
+endif
# Copyright (c) 2013-2014, Loïc Hoguin <[email protected]>
# This file is part of erlang.mk and subject to the terms of the ISC License.