forked from hdima/erlport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
130 lines (103 loc) · 4.21 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# Copyright (c) 2009-2015, Dmitry Vasiliev <dima@hlabs.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of the copyright holders nor the names of its
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
RELDIR = ebin
TESTDIR = .eunit
VERSIONS := $(shell ./get_versions)
HEADERS = $(wildcard src/*.hrl)
SOURCES = $(wildcard src/*.erl)
BEAMS = $(patsubst src/%.erl,$(RELDIR)/%.beam,$(SOURCES))
LANGTESTDIRS = $(patsubst %,test/%,$(VERSIONS))
LANGTESTSOURCES = $(foreach dir,$(LANGTESTDIRS),$(wildcard $(dir)/*.erl))
TESTSOURCES = $(wildcard test/*.erl)
TESTBEAMS = $(patsubst src/%.erl,$(TESTDIR)/%.beam,$(SOURCES)) \
$(patsubst test/%.erl,$(TESTDIR)/%.beam,$(TESTSOURCES)) \
$(patsubst %.erl,$(TESTDIR)/%.beam,$(notdir $(LANGTESTSOURCES)))
ERLC = erlc -Wall +warnings_as_errors -I include -I src
ERL = erl -noinput -pa ../erlport
compile: compile-priv $(BEAMS)
compile-test: compile-priv $(TESTDIR) $(TESTDIR)/erlport.app $(TESTBEAMS)
compile-priv:
@for folder in $$(ls -1 priv); do \
(cd priv/$$folder; $(MAKE)) \
done
$(RELDIR)/%.beam: src/%.erl $(HEADERS)
$(ERLC) +debug_info -o $(RELDIR) $<
$(TESTDIR)/%.beam: test/%.erl
$(ERLC) +debug_info -o $(TESTDIR) $<
$(TESTDIR)/%.beam: test/*/%.erl
$(ERLC) +debug_info -o $(TESTDIR) $<
$(TESTDIR)/%.beam: src/%.erl $(HEADERS)
$(ERLC) +debug_info -o $(TESTDIR) $<
$(TESTDIR):
@mkdir $@
$(TESTDIR)/erlport.app:
@ln ebin/erlport.app $(TESTDIR)
test: erlang-test
@for folder in $(VERSIONS); do \
echo; \
echo "====================== Test $$folder ========================="; \
(cd priv/$$folder; $(MAKE) test) \
done
test-verbose: erlang-test-verbose
@for folder in $(VERSIONS); do \
echo; \
echo "====================== Test $$folder ========================="; \
(cd priv/$$folder; $(MAKE) test-verbose) \
done
erlang-test: compile-test
@./print_versions
@echo
@echo "====================== Test erlang =========================="
@./runtest
erlang-test-verbose: compile-test
@./print_versions
@echo
@echo "====================== Test erlang =========================="
@./runtest verbose
check: $(TESTDIR) $(TESTBEAMS)
@dialyzer $(TESTDIR) | fgrep -v -f dialyzer.ignore
create-ignore-file: $(TESTDIR) $(TESTBEAMS)
@dialyzer $(TESTDIR) | egrep '^[^:]+:[0-9]+: ' > dialyzer.ignore; exit 0
doc:
@$(ERL) -eval 'edoc:application(erlport)' -s init stop
clean: erlang-clean priv-clean doc-clean
priv-clean:
@for folder in $$(ls -1 priv); do \
(cd priv/$$folder; $(MAKE) clean) \
done
doc-clean:
@rm -f doc/*.html doc/*.png doc/*.css doc/edoc-info
erlang-clean:
@rm -rf $(RELDIR)/*.beam $(TESTDIR)
@find test \( -name '*.py[co]' -o -name '__pycache__' \) -delete
release: clean compile
@./release bin
release-src: clean
@./release src
.PHONY: compile compile-test test test-verbose check doc clean compile-priv
.PHONY: create-ignore-file priv-clean erlang-test erlang-test-verbose
.PHONY: erlang-clean release release-src