-
Notifications
You must be signed in to change notification settings - Fork 45
/
Makefile.osx
138 lines (95 loc) · 5.37 KB
/
Makefile.osx
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
# $Id: Makefile.osx,v 1.112 2022/08/17 22:01:58 karn Exp karn $
#CFLAGS=-g -DNDEBUG=1 -O3 -std=gnu11 -pthread -Wall -funsafe-math-optimizations `pkg-config --cflags fftw3`
CFLAGS=-g -O3 -std=gnu11 -pthread -Wall -funsafe-math-optimizations `pkg-config --cflags fftw3`
BINDIR=/usr/local/bin
LIBDIR=/usr/local/share/ka9q-radio
VARDIR=/var/lib/ka9q-radio
LD_FLAGS=-lpthread -lm
EXECS=aprs aprsfeed cwd jt-decoded monitor opusd opussend packetd pcmrecord pcmsend pcmcat radiod control metadump pl show-pkt show-sig stereod rdsd tune powers wd-record pcmspawn setfilt powers
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-display.c monitor-data.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 monitor.h misc.h morse.h multicast.h osc.h radio.h rx888.h status.h
all: $(EXECS)
install: $(EXECS)
install -d $(LIBDIR)
install -d $(BINDIR)
rsync -a $(EXECS) $(BINDIR)
(cd share;rsync --ignore-existing -a . $(LIBDIR))
# 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)
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
clean:
rm -f *.o *.a .depend $(EXECS)
.depend: $(CFILES) $(HFILES)
rm -f .depend
$(CC) $(CFLAGS) -MM $(CFILES) > .depend
ifeq (,$(findstring $(MAKECMDGOALS),clean))
-include .depend
endif
.PHONY: clean all install
# Executables
aprs: aprs.o libradio.a
$(CC) -g -o $@ $^ -lm
aprsfeed: aprsfeed.o libradio.a
$(CC) -g -o $@ $^ -lm -lpthread
control: control.o modes.o bandplan.o decode_status.o libradio.a
$(CC) -g -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lncurses -liniparser -lm -lpthread
cwd: cwd.o libradio.a
$(CC) -g -o $@ $^ -lm
dmr: dmr.o libradio.a
$(CC) -g -o $@ $^ -lfftw3f_threads -lfftw3f -lm -lpthread
metadump: metadump.o dump.o libradio.a
$(CC) -g -o $@ $^ -lm
# should be setuid root to enable renicing to better priority, but this makes me uncomfortable
# macos doesn't have Linux-style capabilities to enable specific root-like privileges
monitor: monitor.o monitor-data.o monitor-display.o monitor-repeater.o libradio.a
$(CC) -g -o $@ $^ -lopus -lportaudio -lfftw3f_threads -lfftw3f -lncurses -liniparser -lm -lpthread
opusd: opusd.o libradio.a
$(CC) -g -o $@ $^ -lavahi-client -lavahi-common -lopus -lm -lpthread
opussend: opussend.o libradio.a
$(CC) -g -o $@ $^ -lopus -lportaudio -lm -lpthread
packetd: packetd.o libradio.a
$(CC) -g -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lm -lpthread
pcmcat: pcmcat.o libradio.a
$(CC) -g -o $@ $^ -lm -lpthread
pcmrecord: pcmrecord.o libradio.a
$(CC) -g -o $@ $^ -lopus -logg -lm -lpthread
pcmsend: pcmsend.o libradio.a
$(CC) -g -o $@ $^ -lportaudio -lm -lpthread
pcmspawn: pcmspawn.o libradio.a
$(CC) -g -o $@ $^ -lm -lpthread
pl: pl.o libradio.a
$(CC) -g -o $@ $^ -lfftw3f_threads -lfftw3f -lm -lpthread
powers: powers.o dump.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lm -lpthread
radiod: main.o radio.o audio.o fm.o wfm.o linear.o spectrum.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) -g -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lncurses -liniparser -lairspy -lairspyhf -lrtlsdr -lopus -lportaudio -liconv -lusb-1.0 -lm -lpthread
rdsd: rdsd.o libradio.a
$(CC) -g -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lncurses -lm -lpthread
setfilt: setfilt.o libradio.a
$(CC) -g -o $@ $^ -lm -lpthread
show-pkt: show-pkt.o libradio.a
$(CC) -g -o $@ $^ -lfftw3f_threads -lfftw3f -lncurses -lm -lpthread
show-sig: show-sig.o libradio.a
$(CC) -g -o $@ $^ -lfftw3f_threads -lfftw3f -lncurses -lm -lpthread
stereod: stereod.o libradio.a
$(CC) -g -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lm -lpthread
tune: tune.o libradio.a
$(CC) -g -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lm -lpthread
jt-decoded: jt-decoded.o libradio.a
$(CC) -g -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lm -lpthread
set_xcvr: set_xcvr.o
$(CC) -g -o $@ $^ -lpigpio -lpthread
wd-record: wd-record.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -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 avahi.o avahi_browse.o attr.o ax25.o config.o decimate.o filter.o status.o decode_status.o misc.o multicast.o rtcp.o osc.o iir.o
ar rv $@ $?
ranlib $@