-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
76 lines (60 loc) · 1.65 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
## -*- makefile -*-
SHELL := /bin/bash
include vsn.mk
.PHONY: all test edoc plt dialyzer tags clean dist install uninstall
PLT=".dialyzer_plt"
ERL_LIB := $(shell erl -noshell -eval 'io:format("~s",[code:lib_dir()]),erlang:halt()' \
2> /dev/null)
APP_FULLNAME := $(APP_NAME)-$(APP_VSN)
ifdef LOG
MAKE_ARGS =
else
MAKE_ARGS ='NOLOG=true'
endif
all: compile
compile:
(mkdir -p ./ebin)
(cd src;$(MAKE) $(MAKE_ARGS))
test_compile:
(mkdir -p ./ebin)
(cd src;$(MAKE) TEST=true $(MAKE_ARGS))
test: clean unit_test comm_test
@#(make clean)
unit_test: test_compile
(erl -noinput -pa ./ebin -eval "eunit:test(\"./ebin\", []), init:stop()")
comm_test: test_compile
(mkdir -p ./test/log)
@echo "pwd is `pwd`"
(erl -s ct_run script_start -logdir `pwd`/test/log -include `pwd`/include -pa `pwd`/ebin -pa `pwd`/test-dir . -spec ./test/test.spec -s erlang halt)
edoc:
(mkdir -p ./edoc)
(cd src; $(MAKE) edoc)
plt :
(./scripts/gen_plt.sh -a sasl -a compiler)
dialyzer: clean
(cd src;$(MAKE) DEBUG=true)
(dialyzer --plt $(PLT) -Werror_handling -Wrace_conditions -r .)
tags :
(ctags -R .)
clean:
(rm -rf ./ebin/*; rm -rf ./edoc/*)
(rm -rf ./test/log)
(rm -rf ./test/*.beam)
(cd src;$(MAKE) clean)
dist: clean
(cd .. \
&& tar czf $(APP_FULLNAME).tar.gz \
$(APP_NAME)/src $(APP_NAME)/include \
$(APP_NAME)/Makefile $(APP_NAME)/vsn.mk)
(mv ../$(APP_FULLNAME)-$(APP_VSN).tar.gz .)
install: all
ifeq ($(ERL_LIB), )
@echo "please install Erlang/OTP"
else
@echo "install..."
(mkdir -p $(ERL_LIB)/$(APP_FULLNAME) && \
cp -rf ./ebin ./include ./src $(ERL_LIB)/$(APP_FULLNAME))
endif
uninstall:
@echo "uninstall the lib..."
(rm -rf $(ERL_LIB)/$(APP_FULLNAME))