-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathMakefile
executable file
·152 lines (115 loc) · 3.73 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
## If rebar.config file doesn't exist, just default to cowboy backend
all: cowboy
# Check if rebar3.mk exists, and if not, download it
ifeq ("$(wildcard rebar3.mk)","")
$(shell curl -O https://raw.githubusercontent.com/choptastic/rebar3.mk/master/rebar3.mk)
endif
# rebar3.mk adds a new rebar3 rule to your Makefile
# (see https://github.com/choptastic/rebar3.mk) for full info
include rebar3.mk
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_dev|run_release]"
@(echo)
@(echo "Upgrade a Running Production Release")
@(echo)
@(echo " make upgrade_release"
@(echo)
compile: rebar3
$(REBAR) compile
link-static:
@(./copy_static.escript link static)
@(./copy_static.escript copy doc)
copy-static:
@(./copy_static.escript copy static)
@(./copy_static.escript copy doc)
dash-docs: _checkouts/nitrogen_core
cd _checkouts/nitrogen_core; make dash-docs
mv _checkouts/nitrogen_core/Nitrogen.tgz priv/static/docsets
_checkouts/nitrogen_core:
mkdir -p _checkouts
cd _checkouts; git clone http://github.com/nitrogen/nitrogen_core -b rebar3
deps:
$(REBAR) deps
clean:
$(REBAR) clean
unlock:
$(REBAR) unlock --all
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: rebar3 unlock
@(echo $(PLATFORM) > last_platform)
@(echo "Updating app.config...")
@(sed 's/{backend, [a-z]*}/{backend, $(PLATFORM)}/' < etc/app.config > etc/app.config.temp)
@(mv etc/app.config.temp etc/app.config)
$(REBAR) as $(PLATFORM) deps
make link-static
$(REBAR) as $(PLATFORM) compile
dialyzer: rebar3
$(REBAR) dialyzer
travis: test
TESTLOG:=testlog.log
## remember, this is a Makefile. IF the last_platform file exists, this won't be run.
## This rule is only here to ensure that if there is no last_platform file, that the system
## will default to cowboy.
last_platform: cowboy
release: last_platform
./make_version_file.escript go && \
$(REBAR) as `cat last_platform` release && \
make finish_version
run_release: last_platform
$(REBAR) as `cat last_platform` run
run_dev: last_platform
$(REBAR) as `cat last_platform` shell --name [email protected] --eval "sync:go()."
run_test: last_platform
$(REBAR) as `cat last_platform` shell --name [email protected] --eval "wf_test:start_all(nitrogen_core)."
upgrade_running:
./make_version_file.escript go && \
./upgrade_release.sh && \
make finish_version
finish_version:
./make_version_file.escript finish
revert_version:
./make_version_file.escript revert
test: run_test
#test:
#
# make run_dev -name [email protected] EXTRA_ARGS="-eval \"wf_test:start_all(nitrogen_core).\""
# 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_core)."
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:
$(MAKE) mochiweb test TESTLOG="$(TESTLOGDIR)/mochiweb.log"
test_webmachine:
$(MAKE) webmachine test TESTLOG="$(TESTLOGDIR)/webmachine.log"
test_yaws:
rm -fr deps/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)")