forked from projectcs13/sensor-cloud
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Makefile
275 lines (240 loc) · 9.14 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
################################################################################
### Makefile for IoTFramework-engine ###
################################################################################
################################################################################
################################################################################
### Variable assignment
################################################################################
ERL := erl
REBAR := ./rebar
ERL_CONFIG := -config config/engine.config -config config/sasl.config
ERL_BOOT := -boot start_sasl -s reloader -s engine
ERL_PA_FOLDERS := -pa ebin/ lib/*/ebin/ lib/*/bin/
TEST_RESULT_FOLDER := test-results
################################################################################
################################################################################
################################################################################
### Dependency rules
### Do NOT touch this section!
### The commands in this sections should not be used in general, but can be used
### if there is need for it
################################################################################
compile:
@$(REBAR) compile skip_deps=true
### get_libs will download and install all project libraries
conf: compile_libs
$(ERL) $(ERL_PA_FOLDERS) $(ERL_CONFIG) -s engine -s config
make compile_libs
get_libs:
@@$(REBAR) get-deps
wget "https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.1.2.zip"
unzip elasticsearch-1.1.2.zip -d lib
rm elasticsearch-1.1.2.zip
cp -r es_config/* lib/elasticsearch-1.1.2/config/
-git apply --directory=lib/erlson --whitespace=fix erlsonPatch.txt
compile_libs:
@$(REBAR) compile
$(MAKE) -C lib/rabbitmq-server
$(MAKE) -C lib/rabbitmq-erlang-client
$(MAKE) -C lib/rErlang
clean_emacs_vsn_files:
rm -rf *~
rm -rf doc/*~
rm -rf include/*~
rm -rf priv/*~
rm -rf scripts/*~
rm -rf src/*~
rm -rf test/*~
################################################################################
################################################################################
################################################################################
### Command rules
### This section contains commands that can be used.
### This section can be edited if needed
################################################################################
### Command: make
### Builds the entire project, excluding the dependencies.
all: compile
### Command: make install
### Downloads all dependencies and builds the entire project
install: get_libs conf
(cd javascripts; npm install socket.io; npm install rabbit.js)
install_linux_deps:
sudo scripts/install.sh
### Command: make run
### Downloads all depenedencies, bulds entire project and runs the project.
run: compile
curl -XPUT localhost:9200/sensorcloud
$(ERL) $(ERL_PA_FOLDERS) $(ERL_CONFIG) $(ERL_BOOT) -sname engine
### Command: make run_all
### Starts all parts of the system in one command.
run_all: compile
sudo scripts/sensec.sh start
### Command: make test_setup
### Runs all parts of the system except the erlang part. To be used prior to 'make test' for easy test setup
test_setup: compile
sudo scripts/sensec.sh test_setup
### Command: make stop_all
### Stops all parts of the system in one command.
stop_all:
sudo scripts/sensec.sh stop
### Command: make run_semantic_adapter
run_semantic_adapter:
sudo python semantic-adapter/web_run.py
### Command: make run_es
### Runs elastic search
run_es:
lib/elasticsearch-1.1.2/bin/elasticsearch
### Command: make run_nodejs
### Runs NodeJS
run_nodejs:
nodejs javascripts/receive.js
### Command: make run_fake_resource
### Runs the fake resources for polling
run_fake_resource:
(cd scripts/python/ && python -m CGIHTTPServer 8001 &)
(cd scripts/python/ && python -m CGIHTTPServer 8002)
### Command: make run_rabbit
### Runs rabbitMQ server
run_rabbit:
sudo lib/rabbitmq-server/scripts/rabbitmq-server
### Command: make test
### Compile project resources (not libraries) and runs all eunit tests.
test: compile
-@mkdir $(TEST_RESULT_FOLDER)
curl -XDELETE localhost:9200/sensorcloud
curl -XPUT localhost:9200/sensorcloud
$(ERL) $(ERL_PA_FOLDERS) $(ERL_CONFIG) $(ERL_BOOT) -sname engine -s test run
test_travis: compile
-@mkdir $(TEST_RESULT_FOLDER)
curl -XPUT localhost:9200/sensorcloud
$(ERL) $(ERL_PA_FOLDERS) $(ERL_CONFIG) $(ERL_BOOT) -sname engine -s test run
test_datapoints: compile
-@mkdir $(TEST_RESULT_FOLDER)
curl -XDELETE localhost:9200/sensorcloud
curl -XPUT localhost:9200/sensorcloud
$(ERL) $(ERL_PA_FOLDERS) $(ERL_CONFIG) $(ERL_BOOT) -sname engine -eval 'test:run(datapoints)'
test_json: compile
-@mkdir $(TEST_RESULT_FOLDER)
$(ERL) $(ERL_PA_FOLDERS) $(ERL_CONFIG) $(ERL_BOOT) -sname engine -eval 'test:run(lib_json)'
test_resources: compile
-@mkdir $(TEST_RESULT_FOLDER)
curl -XDELETE localhost:9200/sensorcloud
curl -XPUT localhost:9200/sensorcloud
$(ERL) $(ERL_PA_FOLDERS) $(ERL_CONFIG) $(ERL_BOOT) -sname engine -eval 'test:run(resources)'
test_streams: compile
-@mkdir $(TEST_RESULT_FOLDER)
curl -XDELETE localhost:9200/sensorcloud
curl -XPUT localhost:9200/sensorcloud
$(ERL) $(ERL_PA_FOLDERS) $(ERL_CONFIG) $(ERL_BOOT) -sname engine -eval 'test:run(streams)'
test_users: compile
-@mkdir $(TEST_RESULT_FOLDER)
curl -XDELETE localhost:9200/sensorcloud
curl -XPUT localhost:9200/sensorcloud
$(ERL) $(ERL_PA_FOLDERS) $(ERL_CONFIG) $(ERL_BOOT) -sname engine -eval 'test:run(users)'
test_poll: compile
-@mkdir $(TEST_RESULT_FOLDER)
curl -XDELETE localhost:9200/sensorcloud
curl -XPUT localhost:9200/sensorcloud
$(ERL) $(ERL_PA_FOLDERS) $(ERL_CONFIG) $(ERL_BOOT) -sname engine -eval 'test:run(poll_help)'
test_poll_system: compile
-@mkdir $(TEST_RESULT_FOLDER)
curl -XDELETE localhost:9200/sensorcloud
curl -XPUT localhost:9200/sensorcloud
$(ERL) $(ERL_PA_FOLDERS) $(ERL_CONFIG) $(ERL_BOOT) -sname engine -eval 'test:run(polling_system)'
test_search: compile
-@mkdir $(TEST_RESULT_FOLDER)
curl -XDELETE localhost:9200/sensorcloud
curl -XPUT localhost:9200/sensorcloud
$(ERL) $(ERL_PA_FOLDERS) $(ERL_CONFIG) $(ERL_BOOT) -sname engine -eval 'test:run(search)'
test_triggers: compile
-@mkdir $(TEST_RESULT_FOLDER)
curl -XDELETE localhost:9200/sensorcloud
curl -XPUT localhost:9200/sensorcloud
$(ERL) $(ERL_PA_FOLDERS) $(ERL_CONFIG) $(ERL_BOOT) -sname engine -eval 'test:run(triggers)'
test_vstreams: compile
-@mkdir $(TEST_RESULT_FOLDER)
curl -XDELETE localhost:9200/sensorcloud
curl -XPUT localhost:9200/sensorcloud
$(ERL) $(ERL_PA_FOLDERS) $(ERL_CONFIG) $(ERL_BOOT) -sname engine -eval 'test:run(gen_virtual_stream_process)'
### Command: make docs
### Genereats all of the documentation files
docs: all
./rebar doc skip_deps=true
### Command: make clean
### Cleans the directory of the following things:
### * Emacs versioning files.
### * All erlang .beam files, including 'ebin' folder
clean: clean_emacs_vsn_files
@./rebar clean skip_deps=true
rm -f erl_crash.dump
rm -rf ebin/
rm -rf test-results/
### Command: make clean_libs
### Cleans the directory of the following things:
### * All the downloaded libraries
clean_libs:
@./rebar delete-deps
rm -rf lib/
### Command: make clean_docs
### Cleans the directory of the following things:
### * All the documentation files except 'overview.edoc'
clean_docs:
find doc/ -type f -not -name 'overview.edoc' | xargs rm
### Command: make help
### Prints an explanation of the commands in this Makefile
help:
@echo "###################################################################"
@echo "Commands:"
@echo ""
@echo "'make'"
@echo "Compiles all the project sources. Does NOT compile libraries"
@echo ""
@echo "'make install'"
@echo "Downloads and compiles all libraries"
@echo ""
@echo "'make install_linux_deps'"
@echo "Installs all linux dependencies needed. Should only be necessary to do once on a system."
@echo ""
@echo "'make run'"
@echo "Compiles and runs the otp app. Does NOT compile libraries"
@echo ""
@echo "'make run_all'"
@echo "Compiles the system (not libraries) and runs ALL parts of the system."
@echo ""
@echo "'make stop_all'"
@echo "Stops all parts of the system started with 'make run_all'"
@echo ""
@echo "'make run_all'"
@echo "Compiles and runs all parts of the project. Does NOT compile libraries"
@echo ""
@echo "'make test_setup'"
@echo "Easy setup of environment prior to running 'make test''"
@echo ""
@echo "'make stop_all'"
@echo "Stops all parts of the project which was started with 'make run_all'"
@echo ""
@echo "'make run_es'"
@echo "Runs the elastic search server"
@echo ""
@echo "'make run_nodejs'"
@echo "Runs the elastic nodejs"
@echo ""
@echo "make run_rabbit"
@echo "Runs the rabbitMQ server"
@echo ""
@echo "'make docs'"
@echo "Generates documentation for the project"
@echo ""
@echo "'make clean'"
@echo "Cleans all the project, including dependencies"
@echo ""
@echo "'make clean_libs'"
@echo "Cleans all of the libraries"
@echo ""
@echo "'make clean_docs'"
@echo "Cleans all of the documentation files, except for 'overview.edoc'"
@echo ""
@echo "'make help'"
@echo "Prints an explanation of the commands in this Makefile"
@echo "###################################################################"