forked from ka9q/ka9q-radio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.debug
156 lines (107 loc) · 5.52 KB
/
Makefile.debug
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
# Primary Linux makefile for ka9q-radio package
# Copyright 2017-2023, Phil Karn, KA9Q
# for production
#DOPTS = -DNDEBUG=1 -O3
# for debugging
DOPTS=-g
COPTS=-march=native -std=gnu11 -pthread -Wall -funsafe-math-optimizations -D_GNU_SOURCE=1
CFLAGS=$(DOPTS) $(COPTS) $(INCLUDES)
BINDIR=/usr/local/bin
LIBDIR=/usr/local/share/ka9q-radio
DAEMONDIR=/usr/local/sbin
VARDIR=/var/lib/ka9q-radio
LDLIBS=-lpthread -lbsd -lm
DAEMONS=aprs aprsfeed cwd opusd packetd radiod stereod rdsd
EXECS=control jt-decoded metadump monitor opussend pcmcat pcmrecord pcmsend pcmspawn pl powers setfilt show-pkt show-sig tune wd-record
LOGROTATE_FILES = aprsfeed.rotate ft8.rotate ft4.rotate wspr.rotate
BLACKLIST=airspy-blacklist.conf
CFILES = airspy.c airspyhf.c aprs.c aprsfeed.c attr.c audio.c avahi.c ax25.c bandplan.c config.c control.c cwd.c decimate.c dump.c ezusb.c fcd.c filter.c fm.c funcube.c hid-libusb.c iir.c jt-decoded.c linear.c main.c metadump.c misc.c modes.c monitor.c morse.c multicast.c opusd.c opussend.c osc.c packetd.c pcmcat.c pcmrecord.c pcmsend.c pcmspawn.c pl.c powers.c radio.c radio_status.c rdsd.c rtcp.c rtlsdr.c rx888.c setfilt.c show-pkt.c show-sig.c sig_gen.c spectrum.c status.c stereod.c tune.c wd-record.c wfm.c
HFILES = attr.h ax25.h bandplan.h conf.h config.h decimate.h ezusb.h fcd.h fcdhidcmd.h filter.h hidapi.h iir.h misc.h morse.h multicast.h osc.h radio.h rx888.h status.h
all: depend $(DAEMONS) $(EXECS)
# NB: now overwrites existing .conf files in /etc/radio !
install: $(DAEMONS) $(EXECS)
/usr/sbin/adduser --quiet --system --group radio
/usr/sbin/adduser --quiet --system --ingroup radio recordings
/usr/sbin/adduser --quiet --system --ingroup radio aprsfeed
rsync -a aux/98-sockbuf.conf /etc/sysctl.d
rsync -a $(DAEMONS) $(DAEMONDIR)
rsync -a $(EXECS) start-ka9q-horus.sh $(BINDIR)
setcap cap_sys_nice=ep $(BINDIR)/monitor
(cd share;rsync -a --ignore-existing . $(LIBDIR))
(cd service;rsync -a . /etc/systemd/system)
(cd rules;rsync -a . /etc/udev/rules.d)
(cd aux;rsync -a $(BLACKLIST) /etc/modprobe.d)
(cd aux;rsync -a $(LOGROTATE_FILES) /etc/logrotate.d;chown root:root /etc/logrotate.d/*)
# Don't overwrite existing configs that might have been modified locally. Run this manually without the '--ignore-existing' if you want to overwrite them all
(cd config;rsync --ignore-existing -a . /etc/radio)
mkdir -p /etc/fftw /etc/radio $(VARDIR)
chgrp radio $(VARDIR) /etc/radio /etc/fftw
chmod g+ws $(VARDIR) /etc/radio /etc/fftw
systemctl daemon-reload
clean:
rm -f *.o *.a .depend $(EXECS) $(DAEMONS)
depend: .depend
.depend: $(CFILES) $(HFILES)
rm -f .depend
$(CC) $(CFLAGS) -MM $(CFILES) > .depend
-include .depend
.PHONY: clean all install depend
# Executables
set_xcvr: set_xcvr.o config.o
$(CC) $(LDOPTS) -o $@ $^ -lpigpio -liniparser -lrt -lbsd -lm -lpthread
aprs: aprs.o ax25.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lbsd -lm -lpthread
aprsfeed: aprsfeed.o ax25.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lbsd -lm -lpthread
control: control.o modes.o bandplan.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lfftw3f_threads -lfftw3f -lncursesw -liniparser -lbsd -lm -lpthread
cwd: cwd.o morse.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lbsd -lm -lpthread
tune: tune.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lbsd -lm -lpthread
setfilt: setfilt.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lbsd -lm -lpthread
show-pkt: show-pkt.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lncursesw -lbsd -lm -lpthread
show-sig: show-sig.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lncursesw -lbsd -lm -lpthread
metadump: metadump.o dump.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lbsd -lm -lpthread
monitor: monitor.o morse.o config.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lopus -lportaudio -lasound -lncursesw -liniparser -lbsd -lm -lpthread
opusd: opusd.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lopus -lavahi-client -lavahi-common -lbsd -lm -lpthread
opussend: opussend.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lopus -lportaudio -lbsd -lm -lpthread
packetd: packetd.o ax25.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lbsd -lm -lpthread
pcmcat: pcmcat.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lbsd -lm -lpthread
pcmspawn: pcmspawn.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lbsd -lm -lpthread
pcmrecord: pcmrecord.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lbsd -lm -lpthread
pcmsend: pcmsend.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lportaudio -lbsd -lm -lpthread
powers: powers.o dump.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lbsd -lm -lpthread
pl: pl.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lfftw3f_threads -lfftw3f -lbsd -lm -lpthread
radiod: main.o audio.o fm.o wfm.o linear.o spectrum.o radio.o rtcp.o radio_status.o modes.o rx888.o airspy.o airspyhf.o funcube.o rtlsdr.o sig_gen.o ezusb.o libfcd.a libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -liniparser -lairspy -lairspyhf -lrtlsdr -lportaudio -lusb-1.0 -lbsd -lm -lpthread
rdsd: rdsd.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lbsd -lm -lpthread
stereod: stereod.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lbsd -lm -lpthread
jt-decoded: jt-decoded.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lfftw3f_threads -lfftw3f -lbsd -lm -lpthread
wd-record: wd-record.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lbsd -lm -lpthread
# Binary libraries
libfcd.a: fcd.o hid-libusb.o
ar rv $@ $?
ranlib $@
# subroutines useful in more than one program
libradio.a: avahi.o attr.o filter.o iir.o status.o misc.o multicast.o osc.o config.o
ar rv $@ $?
ranlib $@