forked from oscarh/lhttpc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
69 lines (51 loc) · 1.64 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
APPLICATION := lhttpc
APP_FILE := ebin/$(APPLICATION).app
SOURCES := $(wildcard src/*.erl)
HEADERS := $(wildcard src/*.hrl)
MODULES := $(patsubst src/%.erl,%,$(SOURCES))
BEAMS := $(patsubst %,ebin/%.beam,$(MODULES))
comma := ,
e :=
space := $(e) $(e)
MODULELIST := $(subst $(space),$(comma),$(MODULES))
TEST_SOURCES := $(wildcard test/*.erl)
TEST_BEAMS := $(patsubst %.erl,%.beam, $(TEST_SOURCES))
include vsn.mk
.PHONY: all clean dialyzer
all: $(APPLICATION) doc
$(APPLICATION): $(BEAMS) $(APP_FILE)
test: $(APPLICATION) $(TEST_BEAMS) util/run_test.beam
@echo Running tests
@erl -pa util/ -pa ebin/ -pa test/ -noinput -s run_test run
test_shell: $(APPLICATION) $(TEST_BEAMS)
@echo Starting a shell with test paths included
@erl -pa ebin/ -pa test/
test/%.beam: test/%.erl
@echo Compiling $<
@erlc +debug_info -o test/ $<
$(APP_FILE): src/$(APPLICATION).app.src vsn.mk
@echo Generating $@
@sed -e 's/@MODULES@/$(MODULELIST)/' -e 's/@VSN@/$(VSN)/' $< > $@
ebin/%.beam: src/%.erl $(HEADERS) $(filter-out $(wildcard ebin), ebin)
@echo Compiling $<
@erlc +debug_info +warn_missing_spec -o ebin/ $<
ebin:
@echo Creating ebin/
@mkdir ebin/
doc: doc/edoc-info
dialyzer:
@echo Running dialyzer on sources
@dialyzer --src -r src/
doc/edoc-info: doc/overview.edoc $(SOURCES)
@erlc -o util/ util/make_doc.erl
@echo Generating documentation from edoc
@erl -pa util/ -noinput -s make_doc edoc
util/%.beam: util/%.erl
@erlc -o util/ util/run_test.erl
clean:
@echo Cleaning
@rm -f ebin/*.{beam,app} test/*.beam doc/*.{html,css,png} doc/edoc-info
@rm -rf cover_report
@rm -f util/*.beam
release: clean all test dialyzer
@util/releaser $(APPLICATION) $(VSN)