-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·126 lines (96 loc) · 3.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
REBAR:=rebar
## If rebar.config file doesn't exist, just default to mochiweb backend
all:
ifeq ("$(wildcard rebar.config)","")
@(echo "No backend specified. Defaulting to mochiweb")
@($(MAKE) mochiweb)
else
@($(MAKE) get-deps compile copy-static)
endif
help:
@(echo)
@(echo "Build NitrogenProject.com with a custom backend")
@(echo)
@(echo " make [cowboy|inets|mochiweb|webmachine|yaws]")
@(echo)
@(echo "Execute NitrogenProject.com")
@(echo)
@(echo " make run")
@(echo)
get-deps:
$(REBAR) get-deps
update-deps:
$(REBAR) update-deps
compile:
$(REBAR) compile
link-static:
(cd static; rm -fr nitrogen; ln -s ../deps/nitrogen_core/www nitrogen)
(cd static; rm -fr doc; ln -s ../deps/nitrogen_core/doc/html doc)
copy-static:
(cd static; rm -rf nitrogen; mkdir nitrogen; cp -r ../deps/nitrogen_core/www/* nitrogen)
(cd static; rm -rf doc; mkdir doc; cp -r ../deps/nitrogen_core/doc/html/* doc)
clean:
$(REBAR) clean
cowboy:
@($(MAKE) platform PLATFORM=cowboy)
inets:
@($(MAKE) platform PLATFORM=inets)
mochiweb:
@($(MAKE) platform PLATFORM=mochiweb)
webmachine:
@($(MAKE) platform PLATFORM=webmachine)
yaws:
@($(MAKE) platform PLATFORM=yaws)
platform:
@(echo "Fetching initial dependencies...")
($(REBAR) --config rebar.base.config get-deps)
@(deps/simple_bridge/rebar_deps/merge_deps.escript rebar.base.config deps/simple_bridge/rebar_deps/$(PLATFORM).deps rebar.config)
@(echo "Updating app.config...")
@(sed 's/{backend, [a-z]*}/{backend, $(PLATFORM)}/' < app.config > app.config.temp)
@(mv app.config.temp app.config)
@($(MAKE) get-deps compile copy-static)
upgrade: update-deps compile copy-static
DEPS_PLT=$(CURDIR)/.deps_plt
DEPS=erts kernel stdlib sasl crypto compiler syntax_tools
$(DEPS_PLT):
@echo Building local plt at $(DEPS_PLT)
@echo
@(dialyzer --output_plt $(DEPS_PLT) --build_plt --apps $(DEPS) -r ./deps/)
dialyzer: mochiweb $(DEPS_PLT)
@(dialyzer --fullpath --plt $(DEPS_PLT) -Wrace_conditions -r ./ebin)
travis: dialyzer
TESTLOG:=testlog.log
run:
erl -pa ebin ./deps/*/ebin ./deps/*/include \
-config "app.config" \
-name [email protected] \
-testlog "$(TESTLOG)" \
-env ERL_FULLSWEEP_AFTER 0 \
-eval "inets:start()" \
-eval "application:start(nitrogen_website)."
test:
erl -pa ebin ./deps/*/ebin ./deps/*/include \
-config "app.config" \
-name [email protected] \
-env ERL_FULLSWEEP_AFTER 0 \
-testlog "$(TESTLOG)" \
-eval "inets:start()" \
-eval "application:start(nitrogen_website)." \
-eval "wf_test:start_all(nitrogen_website)."
TESTLOGDIR:=testlogs/$(shell date +"%Y-%m-%d.%H%M%S")
test_inets:
$(MAKE) inets test TESTLOG="$(TESTLOGDIR)/inets.log"
test_cowboy:
$(MAKE) cowboy test TESTLOG="$(TESTLOGDIR)/cowboy.log"
test_mochiweb:
rm -fr deps/mochiweb
$(MAKE) mochiweb test TESTLOG="$(TESTLOGDIR)/mochiweb.log"
test_webmachine:
rm -fr deps/mochiweb deps/ibrowse
$(MAKE) webmachine test TESTLOG="$(TESTLOGDIR)/webmachine.log"
test_yaws:
$(MAKE) yaws test TESTLOG="$(TESTLOGDIR)/yaws.log"
test_all:
$(MAKE) test_cowboy test_inets test_mochiweb test_webmachine test_yaws TESTLOGDIR=$(TESTLOGDIR)
@(grep SUMMARY $(TESTLOGDIR)/*.log)
@(echo "All tests summarized in $(TESTLOGDIR)")