-
Notifications
You must be signed in to change notification settings - Fork 463
/
Makefile
59 lines (43 loc) · 1.52 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
PROJECT = ecallmgr
ROOT = ..
DIALYZER = dialyzer
LIB_EBINS = $(shell find $(ROOT)/lib -maxdepth 2 -name ebin -print)
PA = $(foreach LIB_EBIN,$(LIB_EBINS),-pa $(LIB_EBIN))
ERLC_OPTS = +debug_info +warn_export_all $(PA) \
-I $(ROOT)/lib # +bin_opt_info
DIRS = . \
$(ROOT)/lib/whistle-1.0.0 \
$(ROOT)/lib/whistle_amqp-1.0.0
.PHONY: all compile clean
all: compile
MODULES = $(shell ls src/*.erl | sed 's/src\///;s/\.erl/,/' | sed '$$s/.$$//')
compile: ebin/$(PROJECT).app
@cat src/$(PROJECT).app.src \
| sed 's/{modules, \[\]}/{modules, \[$(MODULES)\]}/' \
> ebin/$(PROJECT).app
-@$(MAKE) ebin/$(PROJECT).app
ebin/$(PROJECT).app: src/*.erl
@mkdir -p ebin/
erlc -v $(ERLC_OPTS) -o ebin/ -pa ebin/ -pa $(ROOT)/lib $?
compile-test: test/$(PROJECT).app
@cat src/$(PROJECT).app.src \
| sed 's/{modules, \[\]}/{modules, \[$(MODULES)\]}/' \
> test/$(PROJECT).app
-@$(MAKE) test/$(PROJECT).app
test/$(PROJECT).app: src/*.erl
@mkdir -p test/
erlc -v $(ERLC_OPTS) -o test/ -pa test/ $?
clean:
rm -f ebin/*
rm -f test/*.beam
rm -f erl_crash.dump
test: clean compile-test eunit
eunit: compile-test
erl -noshell -pa test $(PA) -eval "eunit:test([$(MODULES)], [verbose])" -s init stop
build-plt:
@$(DIALYZER) --build_plt --output_plt $(ROOT)/.platform_dialyzer.plt \
--apps kernel stdlib sasl inets crypto public_key ssl
dialyze:
@$(DIALYZER) $(foreach DIR,$(DIRS),$(DIR)/ebin) $(PA) \
--plt $(ROOT)/.platform_dialyzer.plt --no_native \
-Werror_handling -Wrace_conditions -Wunmatched_returns # -Wunderspecs