Skip to content

Instantly share code, notes, and snippets.

@joedevivo joedevivo/Makefile
Last active Apr 27, 2016

What would you like to do?

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.

# If there is a rebar in the current directory, use it
ifeq ($(wildcard rebar3),rebar3)
REBAR3 = $(CURDIR)/rebar3
# 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
all: $(REBAR3)
@$(REBAR3) do clean, compile, eunit, ct, dialyzer
rel: all
@$(REBAR3) release
curl -Lo rebar3 $(REBAR3_URL) || wget $(REBAR3_URL)
chmod a+x rebar3

This comment has been minimized.

Copy link

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.


This comment has been minimized.

Copy link

jaredmorrow commented Jun 13, 2015

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


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.