REBAR = $(shell which rebar3 || echo ./rebar3)
ENABLE_STATIC = no

all:
	ENABLE_STATIC=$(ENABLE_STATIC) $(REBAR) compile

clean:
	$(REBAR) clean

run:
	$(REBAR) shell --config app.config

release:
	$(REBAR) release

test.spec: test.spec.in cover.spec.in
	cat test.spec.in | sed -e "s,@PATH@,$(PWD)," > $(PWD)/test.spec
	cat cover.spec.in | sed -e "s,@PATH@,$(PWD)," > $(PWD)/cover.spec


test: test.spec all
	$(REBAR) ct --cover --readable=true --allow_user_terms
