Create a gist now

Instantly share code, notes, and snippets.

@joedevivo /Makefile
Last active Apr 27, 2016

Embed
What would you like to do?
rebar3.mk

An easy Makefile for rebar3

Here's an easy makefile for rebar3. All it does is download rebar3 into your project's './rebar3' if you don't have it already on your path. make all just tells rebar to do everything. So even people with no exposure to rebar3 can build your project.

The End.

REBAR3_URL=https://s3.amazonaws.com/rebar3/rebar3
# If there is a rebar in the current directory, use it
ifeq ($(wildcard rebar3),rebar3)
REBAR3 = $(CURDIR)/rebar3
endif
# Fallback to rebar on PATH
REBAR3 ?= $(shell test -e `which rebar3` 2>/dev/null && which rebar3 || echo "./rebar3")
# And finally, prep to download rebar if all else fails
ifeq ($(REBAR3),)
REBAR3 = $(CURDIR)/rebar3
endif
all: $(REBAR3)
@$(REBAR3) do clean, compile, eunit, ct, dialyzer
rel: all
@$(REBAR3) release
$(REBAR3):
curl -Lo rebar3 $(REBAR3_URL) || wget $(REBAR3_URL)
chmod a+x rebar3
@etrepum

This comment has been minimized.

Show comment
Hide comment
@etrepum

etrepum Jun 13, 2015

👍 Might be cool to do that curl/wget atomically, curl -Lo (or -LO) will definitely write a partial file if the transfer gets truncated, not sure how wget behaves.

etrepum commented Jun 13, 2015

👍 Might be cool to do that curl/wget atomically, curl -Lo (or -LO) will definitely write a partial file if the transfer gets truncated, not sure how wget behaves.

@jaredmorrow

This comment has been minimized.

Show comment
Hide comment
@jaredmorrow

jaredmorrow Jun 13, 2015

Here's how you'd fix it for solaris (just replace rebar3 for rebar)

msantos/procket@cc55bb9

Here's how you'd fix it for solaris (just replace rebar3 for rebar)

msantos/procket@cc55bb9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment