-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·49 lines (34 loc) · 1.15 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
NAME := epgsql
VERSION := $(shell git describe --always --tags)
ERL := erl
ERLC := erlc
# ------------------------------------------------------------------------
ERLC_FLAGS := -Wall -I include +debug_info
SRC := $(wildcard src/*.erl)
TESTS := $(wildcard test_src/*.erl)
RELEASE := $(NAME)-$(VERSION).tar.gz
APPDIR := $(NAME)-$(VERSION)
BEAMS := $(SRC:src/%.erl=ebin/%.beam)
compile: $(BEAMS) ebin/$(NAME).app
app: compile
@mkdir -p $(APPDIR)/ebin
@cp -r ebin/* $(APPDIR)/ebin/
@cp -r include $(APPDIR)
release: app
@tar czvf $(RELEASE) $(APPDIR)
clean:
@rm -f ebin/*.beam
@rm -f ebin/$(NAME).app
@rm -rf $(NAME)-$(VERSION) $(NAME)-*.tar.gz
test: $(TESTS:test_src/%.erl=test_ebin/%.beam) compile
@dialyzer -n --src -c src
$(ERL) -pa ebin/ -pa test_ebin/ -noshell -s pgsql_tests run_tests -s init stop
# ------------------------------------------------------------------------
.SUFFIXES: .erl .beam
.PHONY: app compile clean test
ebin/%.beam : src/%.erl
$(ERLC) $(ERLC_FLAGS) -o $(dir $@) $<
ebin/%.app : src/%.app.src Makefile
sed -e s/git/\"$(VERSION)\"/g $< > $@
test_ebin/%.beam : test_src/%.erl
$(ERLC) $(ERLC_FLAGS) -o $(dir $@) $<