diff --git a/Makefile b/Makefile index 47c3c5ae..63ce45e1 100644 --- a/Makefile +++ b/Makefile @@ -3,8 +3,8 @@ BUILD_WITHOUT_QUIC ?= true export BUILD_WITHOUT_QUIC -REBAR = $(CURDIR)/rebar3 -REBAR_VERSION = 3.16.1-emqx-1 +REBAR ?= $(or $(shell which rebar3 2>/dev/null),$(CURDIR)/rebar3) +REBAR_VERSION ?= 3.19.0-emqx-1 .PHONY: all all: compile @@ -13,7 +13,8 @@ all: compile get-rebar3: @$(CURDIR)/get-rebar3 $(REBAR_VERSION) -$(REBAR): get-rebar3 +$(REBAR): + $(MAKE) get-rebar3 .PHONY: compile compile: $(REBAR) diff --git a/get-rebar3 b/get-rebar3 index eb7f4724..f18fe9a6 100755 --- a/get-rebar3 +++ b/get-rebar3 @@ -10,7 +10,10 @@ cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")/" DOWNLOAD_URL='https://github.com/emqx/rebar3/releases/download' download() { - curl --silent --show-error -f -L "${DOWNLOAD_URL}/${VERSION}/rebar3" -o ./rebar3 + local url="${DOWNLOAD_URL}/${VERSION}/rebar3" + + echo "Downloading rebar3 from '${url}' ..." + curl --silent --show-error -f -L "${url}" -o ./rebar3 } # get the version number from the second line of the escript