forked from avtobiff/erlang-uuid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
44 lines (31 loc) · 1.12 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
#!/usr/bin/make -f
APPFILE := uuid.app
VERSION := $(shell sed -n -e '/vsn/ {s/.*,\s*"\([0-9][0-9.]*\)".*/\1/' \
-e 'p' -e '}' src/$(APPFILE).src)
PREFIX ?= /usr
ERL_ROOT := $(PREFIX)/lib/erlang
LIBDIR := /lib
DISTDIR := uuid-$(VERSION)
BEAMFILES := $(wildcard ebin/*.beam) $(wildcard test/*.beam)
DIALYZER_PLT := erlang-uuid.plt
all: build
build: ebin/$(APPFILE)
erl -make
ebin/$(APPFILE): src/$(APPFILE).src
cp $< $@
clean:
-rm -rf ebin/$(APPFILE) $(BEAMFILES) $(DIALYZER_PLT)
$(DIALYZER_PLT): build
dialyzer --add_to_plt -r ebin --output_plt $(DIALYZER_PLT)
dialyzer: $(DIALYZER_PLT)
dialyzer --plt $(DIALYZER_PLT) ebin/uuid.beam
test: build
erlc -W +debug_info +compressed +strip -o test/ test/*.erl
erl -noshell -pa ebin -pa test -eval "uuid_tests:test()" -eval "init:stop()"
install: build
# create dist directory and install files
mkdir -p $(DESTDIR)$(ERL_ROOT)$(LIBDIR)/$(DISTDIR)/ebin
install -m0644 ebin/* $(DESTDIR)$(ERL_ROOT)$(LIBDIR)/$(DISTDIR)/ebin
uninstall:
-rm -rf $(DESTDIR)$(ERL_ROOT)$(LIBDIR)/uuid-[0-9][0-9.]*
.PHONY: all build clean dialyzer test install uninstall