Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
624 lines (547 loc) · 14.9 KB
/
Copy pathMakefile
File metadata and controls
624 lines (547 loc) · 14.9 KB
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
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
SELF_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
-include $(SELF_DIR)/local/common.mk
-include $(SELF_DIR)/Make/python.mk
#Apps to build for any basic system
apps_basic = \
sshDigger \
xindiserver \
magAOXMaths \
timeSeriesSimulator \
mzmqClient
pythonapps_basic = \
dbIngest
# Apps commmon to all MagAO-X control machines
apps_common = \
sysMonitor \
mzmqServer \
streamWriter \
dmMode \
shmimIntegrator \
closedLoopIndi
apps_aoc = \
virtualPDU \
trippLitePDU \
xt1121Ctrl \
xt1121DCDU \
tcsInterface \
adcTracker \
hwpSequencer \
hwpTracker \
qwpPupilTracker \
kTracker \
koolanceCtrl \
observerCtrl \
qwpTracker \
stateRuleEngine \
xInstGraph
pythonapps_aoc = \
virtualPDU \
audibleAlerts
# Apps common to RTC and ICC on MagAO-X
apps_rtcicc = \
alignLoop \
acronameUsbHub \
baslerCtrl \
bmcCtrl \
flipperCtrl \
flowRPM \
hsfwCtrl \
rhusbMon \
cacaoInterface \
modalGainOpt \
modalPSDs \
userGainCtrl \
refRMS \
streamCircBuff \
zaberCtrl \
zaberLowLevel \
picoMotorCtrl \
psfFit \
dbIngest
# Apps needed on RTC
apps_rtc = \
alpaoCtrl \
ocam2KCtrl \
andorCtrl \
cred2Ctrl \
siglentSDG \
ttmModulator \
pi335Ctrl \
pupilFit \
t2wOffloader \
dmSpeckle \
dmSyncopation \
loopTimingMonitor \
w2tcsOffloader \
pwfsSlopeCalc \
kcubeCtrl \
dmPokeXCorr \
psfAcq \
strehlEstimator \
modalFilter \
dmRecon
pythonapps_rtc = \
efcControl \
po4aoTrainer
# Apps needed on ICC
apps_icc = \
dmPokeCenter \
elliptecCtrl \
elliptecLowLevel \
filterWheelCtrl \
smc100ccCtrl \
usbtempMon \
flowRPM \
koolanceCtrl \
corAlign \
adcCtrl \
picamCtrl \
pvcamCtrl \
zaberLowLevelBinary
pythonapps_icc = \
adcCtrl \
visxCtrl
# Apps only needed on accelerometers ACC*
apps_acc = \
mcp3008Ctrl
# Apps needed on TIC
apps_tic = \
acronameUsbHub \
baslerCtrl \
bmcCtrl \
trippLitePDU \
rhusbMon \
dmSpeckle
# Apps with simulator mode
apps_sim = \
virtualPDU \
trippLitePDU
all_buildable_apps = \
virtualPDU \
acronameUsbHub \
adcTracker \
alignLoop \
cacaoInterface \
closedLoopIndi \
dmMode \
dmPokeCenter \
dmPokeXCorr \
dmSpeckle \
dmSyncopation \
elliptecCtrl \
elliptecLowLevel \
loopTimingMonitor \
filterWheelCtrl \
flipperCtrl \
flowRPM \
hwpTracker \
indiTSAccumulator \
koolanceCtrl \
kTracker \
loPredCtrl \
magAOXMaths \
modalFilter \
modalGainOpt \
modalPSDs \
mzmqClient \
mzmqServer \
observerCtrl \
pi335Ctrl \
picoMotorCtrl \
psfAcq \
psfFit \
pupilFit \
pwfsSlopeCalc \
qwpPupilTracker \
refRMS \
rhusbMon \
shmimIntegrator \
siglentSDG \
smc100ccCtrl \
sparkleClock \
sshDigger \
stateRuleEngine \
streamCircBuff \
streamWriter \
strehlEstimator \
sysMonitor \
t2wOffloader \
tcsInterface \
timeSeriesSimulator \
trippLitePDU \
ttmModulator \
usbtempMon \
w2tcsOffloader \
xindiserver \
xt1121Ctrl \
xt1121DCDU \
zaberCtrl \
zaberLowLevel
# EDT-backed camera controllers remain in the generic ALL_APPS coverage build
# only when the SDK headers are present locally. Otherwise they are covered
# through their unit-test harnesses instead of direct app-binary builds.
ifneq ($(wildcard /opt/EDTpdv/edtinc.h),)
all_buildable_apps += \
cred2Ctrl
endif
libs_to_build = libtelnet
apps_to_build = $(apps_basic)
pythonapps_to_install = $(pythonapps_basic)
has_cacao = 0
ifeq ($(MAGAOX_ROLE),AOC)
apps_to_build += $(apps_common)
apps_to_build += $(apps_aoc)
pythonapps_to_install += $(pythonapps_aoc)
else ifeq ($(MAGAOX_ROLE),ICC)
apps_to_build += $(apps_common)
apps_to_build += $(apps_rtcicc)
apps_to_build += $(apps_icc)
pythonapps_to_install += $(pythonapps_icc)
has_cacao = 1
else ifeq ($(MAGAOX_ROLE),RTC)
apps_to_build += $(apps_common)
apps_to_build += $(apps_rtcicc)
apps_to_build += $(apps_rtc)
pythonapps_to_install += $(pythonapps_rtc)
has_cacao = 1
else ifeq ($(findstring ACC,$(MAGAOX_ROLE)),ACC)
apps_to_build += $(apps_common)
apps_to_build += $(apps_acc)
else ifeq ($(MAGAOX_ROLE),TIC)
apps_to_build += $(apps_common)
apps_to_build += $(apps_tic)
has_cacao = 1
else ifeq ($(MAGAOX_ROLE),SS)
apps_to_build += $(apps_sim)
endif
# If building for coverage, build everything that you can.
ifeq ($(ALL_APPS),1)
apps_to_build := ${all_buildable_apps}
endif
all_guis = \
po4aoGUI \
dmCtrlGUI \
dmModeGUI \
offloadCtrlGUI \
pupilGuideGUI \
pwr \
coronAlignGUI \
loopCtrlGUI \
timingGUI \
roiGUI \
cameraGUI \
stageGUI \
polarimetryGUI \
# If building for coverage, don't build guis for now
ifeq ($(NO_GUIS),1)
all_guis :=
endif
ifeq ($(MAGAOX_ROLE),RTC)
guis_to_build =
else ifeq ($(MAGAOX_ROLE),ICC)
guis_to_build =
else ifeq ($(findstring ACC,$(MAGAOX_ROLE)),ACC)
guis_to_build =
else ifeq ($(MAGAOX_ROLE),TIC)
guis_to_build =
else ifeq ($(MAGAOX_ROLE),headless)
guis_to_build =
else
guis_to_build = $(all_guis)
endif
all_rtimv_plugins = \
cameraStatus \
indiDictionary \
pwfsAlignment \
dmStatus \
warnings \
acquisition \
valueDisplay
ifeq ($(MAGAOX_ROLE),RTC)
rtimv_plugins_to_build =
else ifeq ($(MAGAOX_ROLE),ICC)
rtimv_plugins_to_build =
else ifeq ($(findstring ACC,$(MAGAOX_ROLE)),ACC)
rtimv_plugins_to_build =
else ifeq ($(MAGAOX_ROLE),TIC)
rtimv_plugins_to_build =
else ifeq ($(MAGAOX_ROLE),headless)
rtimv_plugins_to_build =
else
rtimv_plugins_to_build = $(all_rtimv_plugins)
endif
utils_to_build = \
logdump \
logsurgeon \
cursesINDI \
shmimDelta \
xrif2fits \
xrif2shmim
scripts_to_install = \
query_seeing \
sync_cacao \
xctrl \
netconsole_logger \
dmdispbridge \
shmimTCPreceive \
shmimTCPtransmit \
obs_to_movie \
instrument_backup_sync \
cacao_startup_if_present \
git_check_all \
collect_camera_configs_for_darks \
shot_in_the_dark \
write_magaox_pidfile \
mount_cgroups1_cpuset \
killIndiZombies \
xlog \
inventory_files \
list_xfiles_by_semester \
loop_instrument_backup_sync \
cyverse_replicate \
xnormconfig \
xnormcalib
ifeq ($(MAGAOX_ROLE),AOC)
scripts_to_install += xlabmode
scripts_to_install += xskymode
scripts_to_install += xhomezabers
scripts_to_install += xtransportmode
else ifeq ($(MAGAOX_ROLE),RTC)
scripts_to_install += cacao/RTC/cacao-startup
scripts_to_install += cacao/RTC/cacao-shutdown
scripts_to_install += cacao/RTC/tweeter-vispyr-rootdir-scripts/tweeter-pre-calib-apply
scripts_to_install += cacao/RTC/tweeter-vispyr-rootdir-scripts/tweeter-post-calib-apply
scripts_to_install += cacao/RTC/woofer-vispyr-rootdir-scripts/woofer-pre-calib-apply
scripts_to_install += cacao/RTC/woofer-vispyr-rootdir-scripts/woofer-post-calib-apply
scripts_to_install += cacao/hoblockleaks
else ifeq ($(MAGAOX_ROLE),ICC)
scripts_to_install += cacao/ICC/cacao-startup
scripts_to_install += cacao/ICC/cacao-shutdown
scripts_to_install += cacao/ICC/ncpc-rootdir-scripts/pre-calib-apply
scripts_to_install += cacao/ICC/ncpc-rootdir-scripts/post-calib-apply
scripts_to_install += cacao/hoblockleaks
scripts_to_install += cacao/ICC/lowfs_switch
scripts_to_install += shift_ncpc
else ifeq ($(MAGAOX_ROLE),TIC)
scripts_to_install += cacao/TIC/cacao-startup
scripts_to_install += cacao/TIC/cacao-shutdown
scripts_to_install += cacao/TIC/kilo-rootdir-scripts/pre-calib-apply
scripts_to_install += cacao/TIC/kilo-rootdir-scripts/post-calib-apply
scripts_to_install += cacao/hoblockleaks
endif
.PHONY: all
all: indi_all libs_all flatlogs/bin/flatlogcodes apps_all guis_all rtimv_plugins_all utils_all
.PHONY: basic
basic: indi_all libs_all flatlogs/bin/flatlogcodes
.PHONY: install
install: indi_install libs_install pythonlibs_install apps_install pythonapps_install guis_install rtimv_plugins_install utils_install scripts_install rtscripts_install
#We clean just libMagAOX, and the apps, guis, and utils for normal devel work.
.PHONY: clean
clean: libs_clean apps_clean pythonapps_clean guis_clean utils_clean tests_clean
#Clean everything.
.PHONY: all_clean
all_clean: indi_clean libs_clean flatlogs_clean libs_clean apps_clean guis_clean rtimv_plugins_clean utils_clean doc_clean tests_clean
flatlogs/bin/flatlogcodes: flatlogs/src/flatlogcodes.cpp
cd flatlogs/src/ && ${MAKE} install
.PHONY: flatlogs_all
flatlogs_all: flatlogs/bin/flatlogcodes
.PHONY: flatlogs_clean
flatlogs_clean:
cd flatlogs/src/ && ${MAKE} clean
rm -rf flatlogs/bin
.PHONY: indi_all
indi_all:
cd INDI && ${MAKE} all
.PHONY: indi_install
indi_install: indi_all
cd INDI && ${MAKE} install
.PHONY: indi_clean
indi_clean:
cd INDI && ${MAKE} clean
libMagAOX/libMagAOX.a: flatlogs/bin/flatlogcodes libMagAOX/app/*.hpp \
libMagAOX/app/dev/*.hpp libMagAOX/common/*.hpp \
libMagAOX/file/*.hpp \
libMagAOX/ImageStreamIO/*.hpp \
libMagAOX/logger/*.hpp \
libMagAOX/logger/types/*.hpp \
libMagAOX/sys/*.hpp \
libMagAOX/tty/*.hpp \
libMagAOX/modbus/*.hpp
cd libMagAOX/ && ${MAKE} all
.PHONY: libs_all
libs_all: flatlogs/bin/flatlogcodes libMagAOX/libMagAOX.a
for lib in ${libs_to_build}; do \
(cd libs/$$lib && ${MAKE} )|| exit 1; \
done
.PHONY: libs_install
libs_install: libs_all
for lib in ${libs_to_build}; do \
(cd libs/$$lib && ${MAKE} install) || exit 1; \
done
sudo -H bash -c "echo $(LIB_PATH) > /etc/ld.so.conf.d/magaox.conf"
sudo -H ldconfig
.PHONY: libs_clean
libs_clean:
cd libMagAOX && ${MAKE} clean
for lib in ${libs_to_build}; do \
(cd libs/$$lib && ${MAKE} clean) || exit 1; \
done
.PHONY: pythonlibs_install
pythonlibs_install: installed_python_interface_timestamp.txt
# Installing the Python interface makes a file so we're not "phony"
# and it should only re-run if the Python source is changed
PY_SOURCES := magaox-python/pyproject.toml \
$(shell find magaox-python/magaox -name '*.py')
installed_python_interface_timestamp.txt: $(PY_SOURCES)
sudo $(PYTHON) -m pip install ./magaox-python
date -u -Iseconds > ./installed_python_interface_timestamp.txt
.PHONY: apps_all
apps_all: libs_all indi_all
for app in ${apps_to_build}; do \
(cd apps/$$app && ${MAKE} )|| exit 1; \
done
.PHONY: apps_install
apps_install: libs_install indi_install
for app in ${apps_to_build}; do \
(cd apps/$$app && ${MAKE} install) || exit 1; \
done
.PHONY: pythonapps_install
pythonapps_install: installed_python_interface_timestamp.txt
for app in ${pythonapps_to_install}; do \
(cd apps/$$app && ${MAKE} install) || exit 1; \
done
.PHONY: apps_clean
apps_clean:
for app in ${apps_to_build}; do \
(cd apps/$$app && ${MAKE} clean) || exit 1; \
done
.PHONY: guis_all
guis_all: libs_all indi_all rtimv_plugins_all libMagAOX/libMagAOX.hpp.gch libMagAOX/libMagAOX.a
for gui in ${guis_to_build}; do \
(cd gui/apps/$$gui && ${MAKE} )|| exit 1; \
done
.PHONY: guis_install
guis_install: libs_install indi_install rtimv_plugins_install
for gui in ${guis_to_build}; do \
(cd gui/apps/$$gui && ${MAKE} install) || exit 1; \
done
.PHONY: guis_clean
guis_clean: rtimv_plugins_clean
for gui in ${all_guis}; do \
(cd gui/apps/$$gui && ${MAKE} clean) || exit 1; \
done
.PHONY: rtimv_plugins_all
rtimv_plugins_all: indi_all libs_all
for plg in ${rtimv_plugins_to_build}; do \
(cd gui/rtimv/plugins/$$plg && ${MAKE} )|| exit 1; \
done
.PHONY: rtimv_plugins_install
rtimv_plugins_install: indi_install libs_install
for plg in ${rtimv_plugins_to_build}; do \
(cd gui/rtimv/plugins/$$plg && ${MAKE} install) || exit 1; \
done
.PHONY: rtimv_plugins_clean
rtimv_plugins_clean:
for plg in ${rtimv_plugins_to_build}; do \
(cd gui/rtimv/plugins/$$plg && ${MAKE} clean) || exit 1; \
done
.PHONY: scripts_install
scripts_install:
for script in ${scripts_to_install}; do \
sudo -H install -d /opt/MagAOX/bin && \
sudo -H install scripts/$$script /opt/MagAOX/bin ; \
done
for script in $(notdir ${scripts_to_install}); do \
sudo -H ln -fs /opt/MagAOX/bin/$$script /usr/local/bin/$$script; \
done
.PHONY: rtscripts_install
rtscripts_install:
for scriptname in make_cpusets move_irqs remove_cpusets; do \
sudo -H install -d /opt/MagAOX/bin && \
if [ -e rtSetup/$(MAGAOX_ROLE)/$$scriptname ]; then \
sudo -H install rtSetup/$(MAGAOX_ROLE)/$$scriptname /opt/MagAOX/bin/$$scriptname && \
sudo -H ln -fs /opt/MagAOX/bin/$$scriptname /usr/local/bin/$$scriptname; \
else \
echo "echo 'No $$scriptname for $$MAGAOX_ROLE'\nexit 0" | sudo -H tee /opt/MagAOX/bin/$$scriptname && \
sudo -H chmod +x /opt/MagAOX/bin/$$scriptname && \
sudo -H ln -fs /opt/MagAOX/bin/$$scriptname /usr/local/bin/$$scriptname; \
fi \
; done
.PHONY: utils_all
utils_all: flatlogs/bin/flatlogcodes indi_all libMagAOX/libMagAOX.hpp.gch libMagAOX/libMagAOX.a
for app in ${utils_to_build}; do \
(cd utils/$$app && ${MAKE}) || exit 1; \
done
.PHONY: utils_install
utils_install: flatlogs/bin/flatlogcodes indi_install utils_all
for app in ${utils_to_build}; do \
(cd utils/$$app && ${MAKE} install) || exit 1; \
done
.PHONY: utils_clean
utils_clean:
for app in ${utils_to_build}; do \
(cd utils/$$app && ${MAKE} clean) || exit 1; \
done
# INDI-client-only machines: INDI tools (getINDI, setINDI, etc.), cursesINDI,
# rtimv plugins, and GUIs. None of these link libMagAOX, so no apps, libs,
# or log utilities are built.
# If mxlib and rtimv have successfully been installed the only additional
# dependencies will be qwt and maybe svg:
# On Ubuntu 24/26: sudo apt install -y libqt5svg5-dev libqwtmathml-qt5-dev
client_utils = cursesINDI
# Run make (with optional goal $(3)) in each directory $(2) under $(1)
make_each = for d in $(2); do (cd $(1)/$$d && ${MAKE} $(3)) || exit 1; done
.PHONY: client
client: indi_all
$(call make_each,gui/rtimv/plugins,${rtimv_plugins_to_build})
$(call make_each,gui/apps,${guis_to_build})
$(call make_each,utils,${client_utils})
.PHONY: client_install
client_install: indi_install
$(call make_each,gui/rtimv/plugins,${rtimv_plugins_to_build},install)
$(call make_each,gui/apps,${guis_to_build},install)
$(call make_each,utils,${client_utils},install)
.PHONY: client_clean
client_clean: indi_clean guis_clean
$(call make_each,utils,${client_utils},clean)
.PHONY: test
test: tests_clean
cd tests && ${MAKE} test || exit 1;
.PHONY: tests_clean
tests_clean:
cd tests && ${MAKE} clean || exit 1;
cd libMagAOX/logger/tests && ${MAKE} clean || exit 1;
.PHONY: doc
doc:
doxygen doc/config/Doxyfile.libMagAOX
.PHONY: doc_clean
doc_clean:
rm -rf doc/output
.PHONY: setup
setup:
@for file in ./local/*.example.mk; do \
dest=$$(echo $$file | sed 's/.example//'); \
if [ ! -e $$dest ]; then cp -v $$file $$dest; fi \
done
@echo "*** Build settings available in local/common.mk ***"
@grep "?=" Make/common.mk || true
@echo "*** Build settings available in local/config.mk ***"
@grep "?=" Make/config.mk || true
@echo "***"
.PHONY: print_role
print_role:
@echo "MAGAOX_ROLE=$(MAGAOX_ROLE)"
.PHONY: coverage
coverage: coverage_clean
${MAKE} all COVERAGE=1 ALL_APPS=1 NO_GUIS=1
.PHONY: coverage_clean
coverage_clean:
find . -name '*.gcno' -delete
find . -name '*.gcda' -delete
find . -name '*.gcov' -delete
${MAKE} all_clean COVERAGE=1 ALL_APPS=1
cd tests && ${MAKE} realclean COVERAGE=1 || exit 1;
cd libMagAOX/logger/tests && ${MAKE} really_clean COVERAGE=1 || exit 1;
.PHONY: valgrind
valgrind:
${MAKE} all ALL_APPS=1 DEBUG=1