-
Notifications
You must be signed in to change notification settings - Fork 77
/
Makefile
50 lines (36 loc) · 1.3 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
#!/usr/bin/make -f
APPFILE := uuid.app
VERSION := $(shell sed -n -e '/vsn/ {s/.*,[[:blank:]]*"\([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 dist 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()"
dist: build
# create dist tarball
mkdir -p dist/$(DISTDIR)/ebin
install -m0644 ebin/* dist/$(DISTDIR)/ebin
(cd dist ; tar zcf $(DISTDIR).tar.gz $(DISTDIR) )
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