forked from smarth/plists
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
45 lines (39 loc) · 1.22 KB
/
Makefile
File metadata and controls
45 lines (39 loc) · 1.22 KB
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
EBIN=ebin
SRC=src
FINISH=-run init stop -noshell
get-version:
@erl -eval 'io:format("~p~n", [ \
proplists:get_value(vsn,element(3,element(2,hd(element(3, \
erl_eval:exprs(element(2, erl_parse:parse_exprs(element(2, \
erl_scan:string("Data = " ++ binary_to_list(element(2, \
file:read_file("src/plists.app.src"))))))), []))))))])' \
$(FINISH)
# Note that this make target expects to be used like so:
# $ ERL_LIBS=some/path make get-installdir
#
# Which would give the following result:
# some/path/plists-1.0.0
get-installdir:
@echo $(ERL_LIBS)/plists-$(shell make get-version)
clean:
rm -rf $(EBIN)
compile: clean
mkdir $(EBIN)
rebar compile
docs:
cd doc && \
erl -eval 'edoc:files(["../src/plists.erl"])' $(FINISH)
# Running 'make install' without setting ERL_LIBS in the env will result in
# an error. You should do a system-wide install like this:
# $ ERL_LIBS=/opt/erlang/r15b03/lib make install
install: INSTALLDIR=$(shell make get-installdir)
install:
if [ "$$ERL_LIBS" != "" ]; \
then mkdir -p $(INSTALLDIR)/$(EBIN); \
mkdir -p $(INSTALLDIR)/$(SRC); \
cp -pPR $(EBIN) $(INSTALLDIR); \
cp -pPR $(SRC) $(INSTALLDIR); \
else \
echo "ERROR: No 'ERL_LIBS' value is set in the env." \
&& exit 1; \
fi