-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathMakefile
77 lines (60 loc) · 1.46 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
SHELL := /bin/bash
ERLC_USE_SERVER ?= true
export ERLC_USE_SERVER
ERLC=erlc
USE_COLORS ?= USE_COLORS
ERLC_FLAGS= +debug_info +compressed -D$(USE_COLORS)
BEAM=$(patsubst %.erl,%.beam,$(wildcard src/*.erl))
TBEAM=$(patsubst %.erl,%.beam,$(wildcard test/*.erl))
# To disable color: env USE_COLORS=false make
# Ugly as hell, but wtf...
ifeq "$(USE_COLORS)" "USE_COLORS"
BEAM_OBJS=$(BEAM)
else
BEAM_OBJS=src/edbg.beam src/edbg_tracer.beam src/edbg_trace_filter.beam
#BEAM_OBJS=$(filter-out *color*, $(BEAM))
endif
REBAR3_URL=https://s3.amazonaws.com/rebar3/rebar3
WGET=$(shell which wget)
CURL=$(shell which curl)
.PHONY: all old test clean
all: rebar3 compile
old: old-get-deps $(BEAM_OBJS)
test: $(TBEAM) unit
unit:
erl -noshell -s edbg_tracer test -s init stop
%.beam: %.erl
$(ERLC) $(ERLC_FLAGS) -o ebin $<
clean:
rm -f ebin/*.beam
rm -rf _build
# -----------------------
# D E P E N D E N C I E S
# -----------------------
.PHONY: compile get-deps old_deps pp_record-dep
compile:
./rebar3 compile
get-deps: rebar3 old_deps pp_record-dep
old-get-deps: old_deps pp_record-dep
ifeq ($(WGET),)
rebar3:
$(CURL) -O $(REBAR3_URL) && chmod +x rebar3
else
rebar3:
$(WGET) $(REBAR3_URL) && chmod +x rebar3
endif
old_deps:
if [ ! -d deps ]; then \
mkdir deps; \
fi
pp_record-dep:
if [ ! -d deps/pp_record ]; then \
cd deps; \
git clone https://github.com/etnt/pp_record.git; \
make -C pp_record old; \
fi
rm-deps:
rm -rf deps rebar3
-PHONY: docs
docs:
rebar3 ex_doc