From 81b0d55be6ee3f57b36a013db2336f1fd29a5aee Mon Sep 17 00:00:00 2001 From: Jordan Wilberding Date: Sun, 29 Sep 2013 12:07:37 -0400 Subject: Add autodownloading of rebar to makefile when it does not exist on system --- Makefile | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index b8a2657..516c2e3 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ endif REBAR=$(shell which rebar) ifeq ($(REBAR),) -$(error "Rebar not available on this system") +REBAR=$(CURDIR)/rebar endif # ============================================================================= @@ -62,15 +62,22 @@ all: deps compile escript # Rules to build the system # ============================================================================= -deps: +REBAR_URL=https://github.com/rebar/rebar/wiki/rebar +$(REBAR): + curl -Lo rebar $(REBAR_URL) || wget $(REBAR_URL) + chmod a+x rebar + +get-rebar: $(REBAR) + +deps: $(REBAR) $(REBAR) get-deps $(REBAR) compile -update-deps: +update-deps: $(REBAR) $(REBAR) update-deps $(REBAR) compile -compile: +compile: $(REBAR) $(REBAR) skip_deps=true compile escript: deps @@ -122,7 +129,7 @@ clean-common-test-data: # data. Without this rebar eunit gets very confused - rm -rf $(CURDIR)/test/*_SUITE_data -clean: clean-common-test-data +clean: clean-common-test-data $(REBAR) - rm -rf $(CURDIR)/test/*.beam - rm -rf $(CURDIR)/logs - rm -rf $(CURDIR)/ebin -- cgit v1.2.3