forked from auser/glitter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
67 lines (50 loc) · 1.86 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
#### TODO PLEASE CHECK RIAKS BUILD FLOW, WOULD LIKE TO INCORPORATE THEIR IDEAS FORM GIT
#### GIT TAGGING ang REVISION ....
REBAR = ./rebar
LIBDIR = `erl -eval 'io:format("~s~n", [code:lib_dir()])' -s init stop -noshell`
VERSION = $(shell cat VERSION | tr -d '\n')
CC = erlc
ERL = erl
EBIN = ebin
INCLUDE_DIRS = include
CFLAGS = +debug_info -W0 -I $(INCLUDE_DIRS) -pa $(EBIN) -I gen-erl/
COMPILE = $(CC) $(CFLAGS) -o $(EBIN)
DEPS_DIR = deps
EBIN_DIRS = $(wildcard $(DEPS_DIR)/*/ebin) $(wildcard include/*/ebin)
APP = glitter
VERBOSE = -v
.PHONY: deps
all: compile
#All files in ebin are generated including the .app resource file
compile: deps
@cd $(PWD); cd ./src; sed -i.bak 's/VERSION/'"$(VERSION)"'/g' $(APP).app.src
@cd $(PWD); $(REBAR) compile
@cd $(PWD); cd ./src; sed -i.bak 's/'"$(VERSION)"'/VERSION/g' $(APP).app.src
deps:
@($(REBAR) get-deps)
#Fresh Release package for now. TODO: take care of upgrade
#All files under rel are generated by rebar, except a few modification on reltool.config
#Hope to autogenerate those minor and routine addition in future; because autogenerated
#file should always stay free of manual steps (Something bound to miss in future)
rel: clean all
@cd $(PWD); cd ./rel; sed -i.bak 's/VERSION/'"$(VERSION)"'/g' reltool.config
@$(REBAR) -v -f generate
@cd $(PWD); cd ./rel; sed -i.bak 's/'"$(VERSION)"'/VERSION/g' reltool.config
edoc:
@$(ERL) -noshell -run edoc_run application '$(APP)' '"."' '[{preprocess, true},{includes, ["."]}]'
test: compile
@rm -rf .eunit
@mkdir -p .eunit
@($(REBAR) skip_deps=true eunit)
build_plt:
@$(REBAR) built-plt
dialyzer:
@$(REBAR) dialyze
get-deps: clean
@($(REBAR) $(VERBOSE) get-deps)
delete-deps:
@($(REBAR) $(VERBOSE) delete-deps)
clean_rel:
@cd $(PWD); cd $(PWD)/rel; rm -rf $(APP)
clean: clean_rel
@($(REBAR) $(VERBOSE) clean)