forked from RedPitaya/RedPitaya
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
422 lines (323 loc) · 12.7 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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
# check if download cache directory is available
DL ?= dl
INSTALL_DIR ?= build
################################################################################
#
################################################################################
define GREET_MSG
##############################################################################
# Red Pitaya GNU/Linux Ecosystem
# Version: $(VER)
# Branch: $(GIT_BRANCH_LOCAL)
# Build: $(BUILD_NUMBER)
# Commit: $(GIT_COMMIT)
##############################################################################
endef
export GREET_MSG
all: api libredpitaya nginx scpi examples rp_communication apps-tools apps-pro
$(DL):
mkdir -p $@
$(INSTALL_DIR):
mkdir -p $@
################################################################################
# API libraries
################################################################################
LIBRP_DIR = api/rpbase
LIBRPLCR_DIR = Applications/api/rpApplications/lcr_meter
LIBRPAPP_DIR = Applications/api/rpApplications
ECOSYSTEM_DIR = Applications/ecosystem
LIBRP2_DIR = api2
.PHONY: api2 api librp libredpitaya
.PHONY: librpapp liblcr_meter
libredpitaya:
$(MAKE) -C shared clean
$(MAKE) -C shared
$(MAKE) -C shared install INSTALL_DIR=$(abspath $(INSTALL_DIR))
librp:
$(MAKE) -C $(LIBRP_DIR) clean
$(MAKE) -C $(LIBRP_DIR)
$(MAKE) -C $(LIBRP_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
librp2:
$(MAKE) -C $(LIBRP2_DIR) clean
$(MAKE) -C $(LIBRP2_DIR)
$(MAKE) -C $(LIBRP2_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
ifdef ENABLE_LICENSING
api: librp librpapp liblcr_meter
librpapp:
$(MAKE) -C $(LIBRPAPP_DIR) clean
$(MAKE) -C $(LIBRPAPP_DIR)
$(MAKE) -C $(LIBRPAPP_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
liblcr_meter:
$(MAKE) -C $(LIBRPLCR_DIR) clean
$(MAKE) -C $(LIBRPLCR_DIR)
$(MAKE) -C $(LIBRPLCR_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
else
api: librp
endif
api2: librp2
################################################################################
# Red Pitaya ecosystem
################################################################################
# directories
NGINX_DIR = Bazaar/nginx
# targets
NGINX = $(INSTALL_DIR)/sbin/nginx
IDGEN = $(INSTALL_DIR)/sbin/idgen
SOCKPROC = $(INSTALL_DIR)/sbin/sockproc
WEBSOCKETPP_TAG = 0.7.0
LUANGINX_TAG = v0.10.6
NGINX_TAG = 1.10.1
SOCKPROC_TAG = master
WEBSOCKETPP_URL = https://github.com/zaphoyd/websocketpp/archive/$(WEBSOCKETPP_TAG).tar.gz
LIBJSON_URL = http://sourceforge.net/projects/libjson/files/libjson_7.6.1.zip
LUANGINX_URL = https://codeload.github.com/openresty/lua-nginx-module/tar.gz/$(LUANGINX_TAG)
NGINX_URL = http://nginx.org/download/nginx-$(NGINX_TAG).tar.gz
SOCKPROC_URL = https://github.com/juce/sockproc/archive/$(SOCKPROC_TAG).tar.gz
WEBSOCKETPP_TAR = $(DL)/websocketpp-$(WEBSOCKETPP_TAG).tar.gz
LIBJSON_TAR = $(DL)/libjson_7.6.1.zip
LUANGINX_TAR = $(DL)/lua-nginx-module-$(LUANGINX_TAG).tr.gz
NGINX_TAR = $(DL)/nginx-$(NGINX_TAG).tar.gz
SOCKPROC_TAR = $(DL)/sockproc-$(SOCKPROC_TAG).tar.gz
WEBSOCKETPP_DIR = Bazaar/nginx/ngx_ext_modules/ws_server/websocketpp
LIBJSON_DIR = Bazaar/tools/libjson
LUANGINX_DIR = Bazaar/nginx/ngx_ext_modules/lua-nginx-module
NGINX_SRC_DIR = Bazaar/nginx/nginx
SOCKPROC_DIR = Bazaar/tools/sockproc
.PHONY: ecosystem nginx
$(WEBSOCKETPP_TAR): | $(DL)
curl -L $(WEBSOCKETPP_URL) -o $@
$(WEBSOCKETPP_DIR): $(WEBSOCKETPP_TAR)
mkdir -p $@
tar -xzf $< --strip-components=1 --directory=$@
patch -d $@ -p1 < patches/websocketpp-$(WEBSOCKETPP_TAG).patch
$(SOCKPROC_TAR): | $(DL)
curl -L $(SOCKPROC_URL) -o $@
$(SOCKPROC_DIR): $(SOCKPROC_TAR)
mkdir -p $@
tar -xzf $< --strip-components=1 --directory=$@
$(LIBJSON_TAR): | $(DL)
curl -L $(LIBJSON_URL) -o $@
$(LIBJSON_DIR): $(LIBJSON_TAR)
mkdir -p $@
unzip $< -d $(@D)
patch -d $@ -p1 < patches/libjson.patch
$(LUANGINX_TAR): | $(DL)
curl -L $(LUANGINX_URL) -o $@
$(LUANGINX_DIR): $(LUANGINX_TAR)
mkdir -p $@
tar -xzf $< --strip-components=1 --directory=$@
$(NGINX_TAR): | $(DL)
curl -L $(NGINX_URL) -o $@
$(NGINX_SRC_DIR): $(NGINX_TAR)
mkdir -p $@
tar -xzf $< --strip-components=1 --directory=$@
cp -f apps-tools/nginx.conf $@/conf/
mkdir $@/conf/lua/
cp -fr patches/lua/* $@/conf/lua/
$(NGINX): libredpitaya $(CRYPTOPP_DIR) $(WEBSOCKETPP_DIR) $(LIBJSON_DIR) $(LUANGINX_DIR) $(NGINX_SRC_DIR)
$(MAKE) -C $(NGINX_DIR) clean
$(MAKE) -C $(NGINX_DIR)
$(MAKE) -C $(NGINX_DIR) install DESTDIR=$(abspath $(INSTALL_DIR))
mkdir -p $(INSTALL_DIR)/www/conf/lua
cp -fr $(NGINX_DIR)/nginx/conf/lua/* $(abspath $(INSTALL_DIR))/www/conf/lua
ifdef ENABLE_LICENSING
IDGEN_DIR = Applications/idgen
$(IDGEN):
$(MAKE) -C $(IDGEN_DIR) clean
$(MAKE) -C $(IDGEN_DIR)
$(MAKE) -C $(IDGEN_DIR) install DESTDIR=$(abspath $(INSTALL_DIR))
else
$(IDGEN):
touch $(IDGEN)
endif
$(SOCKPROC): $(SOCKPROC_DIR)
$(MAKE) -C $<
test -d $(INSTALL_DIR)/sbin || mkdir -p $(INSTALL_DIR)/sbin
cp $</sockproc $@
nginx: $(NGINX) $(IDGEN) $(SOCKPROC)
################################################################################
# SCPI server
################################################################################
SCPI_PARSER_TAG = fb6979d1926bb6813898012de934eca366d93ff8
#SCPI_PARSER_URL = https://github.com/j123b567/scpi-parser/archive/$(SCPI_PARSER_TAG).tar.gz
SCPI_PARSER_URL = https://github.com/RedPitaya/scpi-parser/archive/$(SCPI_PARSER_TAG).tar.gz
SCPI_PARSER_TAR = $(DL)/scpi-parser-$(SCPI_PARSER_TAG).tar.gz
SCPI_SERVER_DIR = scpi-server
SCPI_PARSER_DIR = $(SCPI_SERVER_DIR)/scpi-parser
.PHONY: scpi
$(SCPI_PARSER_TAR): | $(DL)
curl -L $(SCPI_PARSER_URL) -o $@
$(SCPI_PARSER_DIR): $(SCPI_PARSER_TAR)
mkdir -p $@
tar -xzf $< --strip-components=1 --directory=$@
# patch -d $@ -p1 < patches/scpi-parser-$(SCPI_PARSER_TAG).patch
scpi: api $(INSTALL_DIR) $(SCPI_PARSER_DIR)
$(MAKE) -C $(SCPI_SERVER_DIR) clean
$(MAKE) -C $(SCPI_SERVER_DIR)
$(MAKE) -C $(SCPI_SERVER_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
################################################################################
# Red Pitaya tools
################################################################################
LCR_DIR = Test/lcr
BODE_DIR = Test/bode
MONITOR_DIR = Test/monitor
MONITOR_OLD_DIR = Test/monitor_old
CALIB_DIR = Test/calib
CALIBRATE_DIR = Test/calibrate
GENERATOR_DIR = Test/generate
COMM_DIR = Examples/Communication/C
XADC_DIR = Test/xadc
DISCOVERY_DIR = Test/discovery
LA_TEST_DIR = api2/test
.PHONY: examples rp_communication
.PHONY: lcr bode monitor monitor_old generator calib calibrate discovery laboardtest
examples: lcr bode monitor monitor_old calib generator discovery
# calibrate laboardtest
lcr:
$(MAKE) -C $(LCR_DIR) clean
$(MAKE) -C $(LCR_DIR)
$(MAKE) -C $(LCR_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
bode:
$(MAKE) -C $(BODE_DIR) clean
$(MAKE) -C $(BODE_DIR)
$(MAKE) -C $(BODE_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
monitor:
$(MAKE) -C $(MONITOR_DIR) clean
$(MAKE) -C $(MONITOR_DIR)
$(MAKE) -C $(MONITOR_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
monitor_old:
$(MAKE) -C $(MONITOR_OLD_DIR) clean
$(MAKE) -C $(MONITOR_OLD_DIR)
$(MAKE) -C $(MONITOR_OLD_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
generator:
$(MAKE) -C $(GENERATOR_DIR) clean
$(MAKE) -C $(GENERATOR_DIR)
$(MAKE) -C $(GENERATOR_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
calib:
$(MAKE) -C $(CALIB_DIR) clean
$(MAKE) -C $(CALIB_DIR)
$(MAKE) -C $(CALIB_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
discovery:
$(MAKE) -C $(DISCOVERY_DIR) clean
$(MAKE) -C $(DISCOVERY_DIR)
$(MAKE) -C $(DISCOVERY_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
calibrate: api
$(MAKE) -C $(CALIBRATE_DIR) clean
$(MAKE) -C $(CALIBRATE_DIR)
$(MAKE) -C $(CALIBRATE_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
laboardtest: api2
$(MAKE) -C $(LA_TEST_DIR) clean
$(MAKE) -C $(LA_TEST_DIR)
cp api2/test/laboardtest build/bin/laboardtest
cp api2/test/install.sh build/install.sh
rp_communication:
make -C $(COMM_DIR)
################################################################################
# Red Pitaya ecosystem and free applications
################################################################################
#LIB_BOOTSTRAP_TAG = 3.3.6
#LIB_BOOTSTRAP_URL = https://github.com/twbs/bootstrap/releases/download/v$(LIB_BOOTSTRAP_TAG)/bootstrap-$(LIB_BOOTSTRAP_TAG)-dist.zip
#LIB_BOOTSTRAP_TAR = $(DL)/bootstrap-$(LIB_BOOTSTRAP_TAG)-dist.zip
#LIB_BOOTSTRAP_DIR = apps-tools/assets/bootstrap
#
#$(LIB_BOOTSTRAP_TAR): | $(DL)
# curl -L $(LIB_BOOTSTRAP_URL) -o $@
#
#$(LIB_BOOTSTRAP_DIR): $(LIB_BOOTSTRAP_TAR)
# unzip $< -d $(@D)
# mv $(@D)/bootstrap-$(LIB_BOOTSTRAP_TAG)-dist $@
#LIB_JQUERY_TAG = 3.0.0
#LIB_JQUERY_URL = https://code.jquery.com/jquery-$(LIB_JQUERY_TAG).min.js
#LIB_JQUERY_TAR = $(DL)/jquery-$(LIB_JQUERY_TAG).min.js
#LIB_JQUERY_FIL = apps-tools/assets/jquery-$(LIB_JQUERY_TAG).min.js
#
#$(LIB_JQUERY_TAR): | $(DL)
# curl -L $(LIB_JQUERY_URL) -o $@
#
#$(LIB_JQUERY_FIL): $(LIB_JQUERY_TAR)
# mkdir -p $@
# cp $< $(@D)
APP_ECOSYSTEM_DIR = apps-tools/ecosystem
APP_SCPIMANAGER_DIR = apps-tools/scpi_manager
APP_WYLIODRINMANAGER_DIR = apps-tools/wyliodrin_manager
APP_NETWORKMANAGER_DIR = apps-tools/network_manager
APP_UPDATER_DIR = apps-tools/updater
.PHONY: apps-tools ecosystem updater scpi_manager wyliodrin_manager network_manager
apps-tools: ecosystem updater scpi_manager wyliodrin_manager network_manager
ecosystem:
$(MAKE) -C $(APP_ECOSYSTEM_DIR) clean
$(MAKE) -C $(APP_ECOSYSTEM_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
updater: ecosystem api $(NGINX)
$(MAKE) -C $(APP_UPDATER_DIR) clean
$(MAKE) -C $(APP_UPDATER_DIR)
$(MAKE) -C $(APP_UPDATER_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
scpi_manager: ecosystem api $(NGINX)
$(MAKE) -C $(APP_SCPIMANAGER_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
wyliodrin_manager: ecosystem
$(MAKE) -C $(APP_WYLIODRINMANAGER_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
network_manager: ecosystem
$(MAKE) -C $(APP_NETWORKMANAGER_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
################################################################################
# Red Pitaya ecosystem and free applications
################################################################################
APPS_FREE_DIR = apps-free
.PHONY: apps-free
apps-free: lcr bode
$(MAKE) -C $(APPS_FREE_DIR) clean
$(MAKE) -C $(APPS_FREE_DIR) all INSTALL_DIR=$(abspath $(INSTALL_DIR))
$(MAKE) -C $(APPS_FREE_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
apps-free-clean:
$(MAKE) -C $(APPS_FREE_DIR) clean
################################################################################
# Red Pitaya PRO applications
################################################################################
ifdef ENABLE_LICENSING
APP_SCOPEGENPRO_DIR = Applications/scopegenpro
APP_SPECTRUMPRO_DIR = Applications/spectrumpro
APP_LCRMETER_DIR = Applications/lcr_meter
APP_LA_PRO_DIR = Applications/la_pro
APP_BA_PRO_DIR = Applications/ba_pro
.PHONY: apps-pro scopegenpro spectrumpro lcr_meter la_pro ba_pro
apps-pro: scopegenpro spectrumpro lcr_meter la_pro ba_pro
scopegenpro: api $(NGINX)
$(MAKE) -C $(APP_SCOPEGENPRO_DIR) clean
$(MAKE) -C $(APP_SCOPEGENPRO_DIR) INSTALL_DIR=$(abspath $(INSTALL_DIR))
$(MAKE) -C $(APP_SCOPEGENPRO_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
spectrumpro: api $(NGINX)
$(MAKE) -C $(APP_SPECTRUMPRO_DIR) clean
$(MAKE) -C $(APP_SPECTRUMPRO_DIR) INSTALL_DIR=$(abspath $(INSTALL_DIR))
$(MAKE) -C $(APP_SPECTRUMPRO_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
lcr_meter: api $(NGINX)
$(MAKE) -C $(APP_LCRMETER_DIR) clean
$(MAKE) -C $(APP_LCRMETER_DIR) INSTALL_DIR=$(abspath $(INSTALL_DIR))
$(MAKE) -C $(APP_LCRMETER_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
la_pro: api api2 $(NGINX)
$(MAKE) -C $(APP_LA_PRO_DIR) clean
$(MAKE) -C $(APP_LA_PRO_DIR) INSTALL_DIR=$(abspath $(INSTALL_DIR))
$(MAKE) -C $(APP_LA_PRO_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
ba_pro: api $(NGINX)
$(MAKE) -C $(APP_BA_PRO_DIR) clean
$(MAKE) -C $(APP_BA_PRO_DIR) INSTALL_DIR=$(abspath $(INSTALL_DIR))
$(MAKE) -C $(APP_BA_PRO_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
else
apps-pro:
endif
################################################################################
#
################################################################################
clean:
make -C shared clean
# todo, remove downloaded libraries and symlinks
make -C $(NGINX_DIR) clean
make -C $(MONITOR_DIR) clean
make -C $(MONITOR_OLD_DIR) clean
make -C $(GENERATE_DIR) clean
make -C $(ACQUIRE_DIR) clean
make -C $(CALIB_DIR) clean
-make -C $(SCPI_SERVER_DIR) clean
make -C $(LIBRP2_DIR) clean
make -C $(LIBRP_DIR) clean
make -C $(LIBRPAPP_DIR) clean
make -C $(LIBRPLCR_DIR) clean
make -C $(COMM_DIR) clean
apps-free-clean