-
Notifications
You must be signed in to change notification settings - Fork 25
/
Makefile
55 lines (45 loc) · 1.39 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
REBAR:=$(shell which rebar3 || echo ./rebar3)
REBAR_URL:="https://s3.amazonaws.com/rebar3/rebar3"
gh-pages : TMPDIR := $(shell mktemp -d -t dns_erlang.gh-pages.XXXX)
gh-pages : BRANCH := $(shell git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1 /')
gh-pages : STASH := $(shell (test -z "`git status --porcelain`" && echo false) || echo true)
gh-pages : VERSION := $(shell sed -n 's/.*{vsn,.*"\(.*\)"}.*/\1/p' src/dns_erlang.app.src)
all: build
$(REBAR):
wget $(REBAR_URL) && chmod +x rebar3
.PHONY: build
build: $(REBAR)
@$(REBAR) compile
.PHONY: doc
doc: $(REBAR)
@$(REBAR) edoc
.PHONY: clean
clean: $(REBAR)
@$(REBAR) clean
@rm -fr doc/*
.PHONY: fresh
fresh: clean
rm -fr _build/*
.PHONY: gh-pages
gh-pages: $(REBAR) test doc
@echo "Building gh-pages for ${VERSION} in ${TMPDIR} from branch ${BRANCH}. Branch dirty: ${STASH}."
sed 's/{{VERSION}}/${VERSION}/g' priv/index.html > ${TMPDIR}/index.html
rsync -a --remove-source-files doc/ ${TMPDIR}/doc
rsync -a --remove-source-files .eunit/ ${TMPDIR}/coverage
@$(REBAR) clean
(${STASH} && git stash save) || true
git checkout gh-pages
rsync -a --delete ${TMPDIR}/* .
git add .
git commit -a -m "update auto-generated docs"
git checkout ${BRANCH}
(${STASH} && git stash pop) || true
rm -fr ${TMPDIR}
.PHONY: test
test: $(REBAR) all
@$(REBAR) eunit
@$(REBAR) fmt --check
@$(REBAR) dialyzer
.PHONY: format
format: build
@$(REBAR) fmt