-
Notifications
You must be signed in to change notification settings - Fork 42
/
Makefile.linux
159 lines (111 loc) · 6.1 KB
/
Makefile.linux
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
# Primary Linux makefile for ka9q-radio package
# Copyright 2017-2024, Phil Karn, KA9Q
# for production
DOPTS = -DNDEBUG=1 -O3
# for debugging
#DOPTS=-g
# do NOT set -ffast-math or -ffinite-math-only; NANs are widely used as 'variable not set' sentinels
COPTS=-march=native -std=gnu11 -pthread -Wall -funsafe-math-optimizations -fno-math-errno -fcx-limited-range -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 avahi_browse.c ax25.c bandplan.c config.c control.c cwd.c decimate.c decode_status.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 monitor-data.c monitor-display.c monitor-repeater.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 monitor.h morse.h multicast.h osc.h radio.h rx888.h status.h
all: $(DAEMONS) $(EXECS)
# NB: no longer copies files to /etc/radio. Must be installed manually.
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
sysctl --quiet -p /etc/sysctl.d/98-sockbuf.conf
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/*;chmod go-w /etc/logrotate.d/*)
(cd aux;rsync -pt ka9q-cleanups /etc/cron.d/;chown root:root /etc/cron.d/ka9q-cleanups;chmod go-w /etc/cron.d/ka9q-cleanups)
touch -a /var/log/ft8.log /var/log/ft4.log /var/log/wspr.log
chown radio:radio /var/log/ft8.log /var/log/ft4.log /var/log/wspr.log
mkdir -p /etc/fftw /etc/radio $(VARDIR) $(VARDIR)/ft8 $(VARDIR)/ft4 $(VARDIR)/wspr
chgrp radio /etc/radio /etc/fftw $(VARDIR) $(VARDIR)/ft8 $(VARDIR)/ft4 $(VARDIR)/wspr
chmod g+ws /etc/radio /etc/fftw $(VARDIR) $(VARDIR)/ft8 $(VARDIR)/ft4 $(VARDIR)/wspr
systemctl daemon-reload
clean:
-rm -f *.o *.a .depend $(EXECS) $(DAEMONS)
.PHONY: clean all install
ifeq (,$(findstring $(MAKECMDGOALS),clean))
-include .depend
endif
.depend: $(CFILES) $(HFILES)
rm -f .depend
$(CC) $(CFLAGS) -MM $(CFILES) > .depend
# Executables
set_xcvr: set_xcvr.o
$(CC) $(LDOPTS) -o $@ $^ -lpigpio -liniparser -lrt -lbsd -lm -lpthread
aprs: aprs.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lbsd -lm -lpthread
aprsfeed: aprsfeed.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lbsd -lm -lpthread
control: control.o bandplan.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lncursesw -liniparser -lbsd -lm -lpthread
cwd: cwd.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 libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lbsd -lm -lpthread
monitor: monitor.o monitor-data.o monitor-display.o monitor-repeater.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 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 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 radio_status.o rtcp.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 -lopus -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: morse.o dump.o modes.o ax25.o avahi.o avahi_browse.o attr.o filter.o iir.o decode_status.o status.o misc.o multicast.o osc.o config.o
ar rv $@ $?
ranlib $@