Better support for OpenBSD and FreeBSD.

Combination of pull requests 92 & 192.
This commit is contained in:
wb2osz 2019-07-07 21:58:22 -04:00
parent c59053536e
commit e219426a37
4 changed files with 200 additions and 330 deletions

View File

@ -1,11 +1,21 @@
# #
# Makefile for Linux version of Dire Wolf. # Makefile for Linux/Unix version of Dire Wolf.
# #
# Expecting Linux, FreeBSD, or OpenBSD here.
# Would it be feasible to merge Mac OSX back in or has it diverged too much?
OS = $(shell uname)
# Default for Linux. BSD does things differently.
# See https://github.com/wb2osz/direwolf/pull/92 for FreeBSD considerations.
PREFIX ?= /usr
APPS := direwolf decode_aprs text2tt tt2text ll2utm utm2ll aclients atest log2gpx gen_packets ttcalc kissutil cm108 APPS := direwolf decode_aprs text2tt tt2text ll2utm utm2ll aclients atest log2gpx gen_packets ttcalc kissutil cm108
all : $(APPS) direwolf.desktop direwolf.conf all : $(APPS) direwolf.desktop direwolf.conf
@echo " " @echo " "
@echo "Next step - install with:" @echo "Next step - install with:"
@ -13,14 +23,10 @@ all : $(APPS) direwolf.desktop direwolf.conf
@echo " sudo make install" @echo " sudo make install"
@echo " " @echo " "
CC := gcc # Default to gcc if something else not specified, e.g. clang.
CC ?= gcc
# Just for fun, let's see how clang compares to gcc. First install like this:
# sudo apt-get update
# apt-cache search clang
# sudo apt-get install clang-3.5
#
# CC := clang-3.5
# _XOPEN_SOURCE=600 and _DEFAULT_SOURCE=1 are needed for glibc >= 2.24. # _XOPEN_SOURCE=600 and _DEFAULT_SOURCE=1 are needed for glibc >= 2.24.
# Explanation here: https://github.com/wb2osz/direwolf/issues/62 # Explanation here: https://github.com/wb2osz/direwolf/issues/62
@ -28,255 +34,110 @@ CC := gcc
# There are a few source files where it had been necessary to define __USE_XOPEN2KXSI, # There are a few source files where it had been necessary to define __USE_XOPEN2KXSI,
# __USE_XOPEN, or _POSIX_C_SOURCE. Doesn't seem to be needed after adding this. # __USE_XOPEN, or _POSIX_C_SOURCE. Doesn't seem to be needed after adding this.
# -D_BSD_SOURCE because Raspbian wheezy was missing declaration for strsep and definition of fd_set.
# That was not necessary (but did not hurt) for more recent Ubuntu and Raspbian Jessie.
# The first assignment to CFLAGS and LDFLAGS uses +=, rather than :=, so # The first assignment to CFLAGS and LDFLAGS uses +=, rather than :=, so
# we will inherit options already set in build environment. # we will inherit options already set in build environment.
# Explanation - https://github.com/wb2osz/direwolf/pull/38 # Explanation - https://github.com/wb2osz/direwolf/pull/38
CFLAGS += -O3 -pthread -Igeotranz -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE=1 -Wall # For BSD, these are supplied externally.
# https://github.com/wb2osz/direwolf/pull/92
# That was fine for a recent Ubuntu and Raspbian Jessie. # Why don't we just set them differently here?
# However, Raspbian wheezy was then missing declaration for strsep and definition of fd_set.
CFLAGS += -D_BSD_SOURCE
ifeq ($(OS),Linux)
CFLAGS += -O3 -pthread -Igeotranz -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE=1 -D_BSD_SOURCE -Wall
LDFLAGS += -lm -lpthread -lrt LDFLAGS += -lm -lpthread -lrt
else
CFLAGS ?= -O3 -pthread -Igeotranz -Wall
LDFLAGS ?= -lm -lpthread -lrt
endif
#
# The DSP filters spend a lot of time spinning around in little
# loops multiplying and adding arrays of numbers. The Intel "SSE"
# instructions, introduced in 1999 with the Pentium III series,
# can speed this up considerably.
#
# SSE2 instructions, added in 2000, don't seem to offer any advantage.
#
#
# Let's take a look at the effect of the compile options.
#
#
# Times are elapsed time to process Track 2 of the TNC test CD.
#
# i.e. "./atest 02_Track_2.wav"
# Default demodulator type is new "E" added for version 1.2.
#
#
# ---------- x86 (32 bit) ----------
#
#
# gcc 4.6.3 running on Ubuntu 12.04.05.
# Intel(R) Celeron(R) CPU 2.53GHz. Appears to have only 32 bit instructions.
# Probably from around 2004 or 2005.
#
# When gcc is generating code for a 32 bit x86 target, it assumes the ancient
# i386 processor. This is good for portability but bad for performance.
#
# The code can run considerably faster by taking advantage of the SSE instructions
# available in the Pentium 3 or later.
#
# seconds options comments
# ------ ------- --------
# 524
# 183 -O2
# 182 -O3
# 183 -O3 -ffast-math (should be same as -Ofast)
# 184 -Ofast
# 189 -O3 -ffast-math -march=pentium
# 122 -O3 -ffast-math -msse
# 122 -O3 -ffast-math -march=pentium -msse
# 121 -O3 -ffast-math -march=pentium3 (this implies -msse)
# 120 -O3 -ffast-math -march=native
#
# Note that "-march=native" is essentially the same as "-march=pentium3."
#
# If the compiler is generating code for the i386 target, we can # If the compiler is generating code for the i386 target, we can
# get much better results by telling it we have at least a Pentium 3. # get much better results by telling it we have at least a Pentium 3,
# which has the SSE instructions.
# For a more detailed description, see Dire-Wolf-Developer-Notes.pdf.
arch := $(shell echo | gcc -E -dM - | grep __i386__) arch := $(shell echo | ${CC} -E -dM - | grep __i386__)
ifneq ($(arch),) ifneq ($(arch),)
CFLAGS += -march=pentium3 CFLAGS += -march=pentium3
endif endif
# # Add -ffast-math option if the compiler recognizes it.
# ---------- x86_64 ---------- # This makes a big difference with x86_64 but has little impact on 32 bit targets.
#
# useffast := $(shell ${CC} --help -v 2>/dev/null | grep ffast-math)
# gcc 4.8.2 running on Ubuntu 14.04.1.
# Intel Core 2 Duo from around 2007 or 2008.
#
# 64 bit target implies that we have SSE and probably even better vector instructions.
#
# seconds options comments
# ------ ------- --------
# 245
# 75 -01
# 72 -02
# 71 -03
# 73 -O3 -march=native
# 42 -O3 -ffast-math
# 42 -Ofast (note below)
# 40 -O3 -ffast-math -march=native
#
#
# Note that "-Ofast" is a newer option roughly equivalent to "-O3 -ffast-math".
# I use the longer form because it is compatible with older compilers.
#
# Why don't I don't have "-march=native?"
# Older compilers don't recognize "native" as one of the valid options.
# One article said it was added with gcc 4.2 but I haven't verified that.
#
# ---------- How does clang compare? - Ubuntu x86_64 ----------
#
# I keep hearing a lot about "clang." Let's see how it compares with gcc.
# Simply use different compiler and keep all options the same.
#
# test case: atest 02_Track_2.wav
#
# gcc 4.8.4: 988 packets decoded in 40.503 seconds. 38.3 x realtime
# 988 packets decoded in 40.403 seconds. 38.4 x realtime
#
# clang 3.8.0-2: 988 packets decoded in 77.454 seconds. 20.0 x realtime
# 988 packets decoded in 77.232 seconds. 20.1 x realtime
#
# I'm not impressed. Almost twice as long. Maybe we need to try some other compiler options.
# -march=native did not help.
# Makefile.macosx, which uses clang, has these:
# -fvectorize -fslp-vectorize -fslp-vectorize-aggressive
# Those did not help.
#
useffast := $(shell gcc --help -v 2>/dev/null | grep ffast-math)
ifneq ($(useffast),) ifneq ($(useffast),)
CFLAGS += -ffast-math CFLAGS += -ffast-math
endif endif
#
# ---------- ARM - Raspberry Pi 1 models ----------
#
# Raspberry Pi (before RPi model 2), ARM11 (ARMv6 + VFP2)
# gcc (Debian 4.6.3-14+rpi1) 4.6.3
#
#
# seconds options comments
# ------ ------- ---------
# 892 -O3
# 887 -O3 -ffast-math
# x -O3 -ffast-math -march=native (error: bad value for -march switch)
# 887 -O3 -ffast-math -mfpu=vfp
# 890 -O3 -ffast-math -march=armv6zk -mcpu=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp
#
#
# The compiler, supplied with Raspbian, is configured with these options which are
# good for the pre version 2 models.
# --with-arch=armv6 --with-fpu=vfp --with-float=hard
#
# Run "gcc --help -v 2" and look near the end.
#
#
# #
# ---------- ARM - Raspberry Pi 2 ---------- # Dire Wolf is known to work with ARM processors on the BeagleBone, CubieBoard2, CHIP, etc.
#
# Besides the higher clock speed, the Raspberry Pi 2 has the NEON instruction set
# which which should make things considerably faster.
#
#
# seconds options comments
# ------ ------- ---------
# 426 -O3 -ffast-math (already more than twice as fast)
# 429 -O3 -mfpu=neon
# 419 -O3 -mfpu=neon -funsafe-math-optimizations
# 412 -O3 -ffast-math -mfpu=neon
# 413 -O3 -ffast-math -mfpu=neon-vfpv4
# 430 -O3 -ffast-math -mfpu=neon-vfpv4 -march=armv7-a
# 412 -O3 -ffast-math -mfpu=neon-vfpv4 -mtune=arm7
# 410 -O3 -ffast-math -mfpu=neon-vfpv4 -funsafe-math-optimizations
#
# gcc -march=armv7-a -mfpu=neon-vfpv4
#
# I expected the -mfpu=neon option to have a much larger impact.
# Adding -march=armv7-a makes it slower!
#
# If you compile with the RPi 2 specific options above and try to run it on the RPi
# model B (pre version 2), it will die with "illegal instruction."
#
# Dire Wolf is known to work on the BeagleBone, CubieBoard2, CHIP, etc.
# The best compiler options will depend on the specific type of processor # The best compiler options will depend on the specific type of processor
# and the compiler target defaults. # and the compiler target defaults. Use the NEON instructions if available.
# #
ifeq ($(OS),Linux)
neon := $(shell cat /proc/cpuinfo | grep neon) neon := $(shell cat /proc/cpuinfo | grep neon)
ifneq ($(neon),) ifneq ($(neon),)
CFLAGS += -mfpu=neon CFLAGS += -mfpu=neon
endif endif
else
neon := $(shell machine | grep armv7)
ifneq ($(neon),)
CFLAGS += -mfloat-abi=hard -mfpu=neon
endif
endif
#
# You would expect "-march=native" to produce the fastest code.
# Why don't I use it here?
#
# 1. In my benchmarks, above, it has a negligible impact if any at all.
# 2. Some older versions of gcc don't recognize "native" as a valid choice.
# 3. Results are less portable. Not a consideration if you are
# building only for your own use but very important for anyone
# redistributing a "binary" version.
#
# If you are planning to distribute the binary version to other
# people (in some ham radio software collection, RPM, or DEB package),
# avoid fine tuning it for your particular computer. It could
# cause compatibility issues for those with older computers.
#
# ---------- How does clang compare? - ARM - Raspberry Pi 2 ----------
#
# I keep hearing a lot about "clang." Let's see how it compares with gcc.
# Simply use different compiler and keep all options the same.
#
# test case: atest 02_Track_2.wav
#
# gcc 4.9.2-10: 988 packets decoded in 353.025 seconds. 4.4 x realtime
# 988 packets decoded in 352.752 seconds. 4.4 x realtime
#
# clang 3.5.0-10: 988 packets decoded in 825.879 seconds. 1.9 x realtime
# 988 packets decoded in 831.469 seconds. 1.9 x realtime
#
# There might be a different set of options which produce faster code
# but the initial test doesn't look good. About 2.3 times as slow.
# If you want to use OSS (for FreeBSD, OpenBSD) instead of # Audio system: We normally want to use ALSA for Linux.
# ALSA (for Linux), comment out (or remove) the line below. # I heard that OSS will also work with Linux but I never tried it.
# TODO: Can we automate this somehow? # ALSA is not an option for FreeBSD or OpenBSD.
ifeq ($(OS),Linux)
alsa = 1 alsa = 1
else
alsa =
endif
ifeq ($(wildcard /usr/include/pthread.h),)
# Make sure pthread.h is available.
# We use ${PREFIX}, rather than simply /usr, because BSD has it in some other place.
ifeq ($(wildcard ${PREFIX}/include/pthread.h),)
$(error /usr/include/pthread.h does not exist. Install it with "sudo apt-get install libc6-dev" or "sudo yum install glibc-headers" ) $(error /usr/include/pthread.h does not exist. Install it with "sudo apt-get install libc6-dev" or "sudo yum install glibc-headers" )
endif endif
# Make sure we have required library for ALSA if that option is being used.
ifneq ($(alsa),) ifneq ($(alsa),)
CFLAGS += -DUSE_ALSA CFLAGS += -DUSE_ALSA
LDFLAGS += -lasound LDFLAGS += -lasound
ifeq ($(wildcard /usr/include/alsa/asoundlib.h),) ifeq ($(wildcard /usr/include/alsa/asoundlib.h),)
$(error /usr/include/alsa/asoundlib.h does not exist. Install it with "sudo apt-get install libasound2-dev" or "sudo yum install alsa-lib-devel" ) $(error /usr/include/alsa/asoundlib.h does not exist. Install it with "sudo apt-get install libasound2-dev" or "sudo yum install alsa-lib-devel" )
endif endif
ifeq ($(OS),OpenBSD)
# Use sndio via PortAudio Library (you can install it by pkg_add portaudio-svn)
LDFLAGS += -lportaudio -L/usr/local/lib
CFLAGS += -DUSE_PORTAUDIO -I/usr/local/include
endif endif
endif
# Enable GPS if header file is present. # Enable GPS if header file is present.
# Finding libgps.so* is more difficult because it # Finding libgps.so* is more difficult because it
# is in different places on different operating systems. # is in different places on different operating systems.
enable_gpsd := $(wildcard /usr/include/gps.h) enable_gpsd := $(wildcard ${PREFIX}/include/gps.h)
ifneq ($(enable_gpsd),) ifneq ($(enable_gpsd),)
CFLAGS += -DENABLE_GPSD CFLAGS += -DENABLE_GPSD
LDFLAGS += -lgps LDFLAGS += -lgps
@ -294,12 +155,14 @@ endif
# Should enabling of this feature be strongly encouraged or # Should enabling of this feature be strongly encouraged or
# is it quite specialized and of interest to a small audience? # is it quite specialized and of interest to a small audience?
# If, for some reason, can obtain the libudev-dev package, or # If, for some reason, can't obtain the libudev-dev package, or
# don't want to install it, comment out the next 3 lines. # don't want to install it, comment out the next 5 lines.
ifeq ($(OS),Linux)
ifeq ($(wildcard /usr/include/libudev.h),) ifeq ($(wildcard /usr/include/libudev.h),)
$(error /usr/include/libudev.h does not exist. Install it with "sudo apt-get install libudev-dev" or "sudo yum install libudev-devel" ) $(error /usr/include/libudev.h does not exist. Install it with "sudo apt-get install libudev-dev" or "sudo yum install libudev-devel" )
endif endif
endif
# Enable cm108 PTT support if libudev header file is present. # Enable cm108 PTT support if libudev header file is present.
@ -320,13 +183,18 @@ z := $(notdir ${CURDIR})
# -------------------------------- Main application ----------------------------------------- # -------------------------------- Main application -----------------------------------------
ifeq ($(OS),OpenBSD)
AUDIO_O := audio_portaudio.o
else
AUDIO_O := audio.o
endif
direwolf : direwolf.o config.o recv.o demod.o dsp.o demod_afsk.o demod_psk.o demod_9600.o hdlc_rec.o \ direwolf : direwolf.o config.o recv.o demod.o dsp.o demod_afsk.o demod_psk.o demod_9600.o hdlc_rec.o \
hdlc_rec2.o multi_modem.o rdq.o rrbb.o dlq.o \ hdlc_rec2.o multi_modem.o rdq.o rrbb.o dlq.o \
fcs_calc.o ax25_pad.o ax25_pad2.o xid.o \ fcs_calc.o ax25_pad.o ax25_pad2.o xid.o \
decode_aprs.o symbols.o server.o kiss.o kissserial.o kissnet.o kiss_frame.o hdlc_send.o fcs_calc.o \ decode_aprs.o symbols.o server.o kiss.o kissserial.o kissnet.o kiss_frame.o hdlc_send.o fcs_calc.o \
gen_tone.o audio.o audio_stats.o digipeater.o cdigipeater.o pfilter.o dedupe.o tq.o xmit.o morse.o \ gen_tone.o $(AUDIO_O) audio_stats.o digipeater.o cdigipeater.o pfilter.o dedupe.o tq.o xmit.o morse.o \
ptt.o beacon.o encode_aprs.o latlong.o encode_aprs.o latlong.o textcolor.o \ ptt.o beacon.o encode_aprs.o latlong.o encode_aprs.o latlong.o textcolor.o \
dtmf.o aprs_tt.o tt_user.o tt_text.o igate.o waypoint.o serial_port.o log.o telemetry.o \ dtmf.o aprs_tt.o tt_user.o tt_text.o igate.o waypoint.o serial_port.o log.o telemetry.o \
dwgps.o dwgpsnmea.o dwgpsd.o dtime_now.o mheard.o ax25_link.o cm108.o \ dwgps.o dwgpsnmea.o dwgpsd.o dtime_now.o mheard.o ax25_link.o cm108.o \
@ -334,19 +202,19 @@ direwolf : direwolf.o config.o recv.o demod.o dsp.o demod_afsk.o demod_psk.o dem
$(CC) -o $@ $^ $(LDFLAGS) $(CC) -o $@ $^ $(LDFLAGS)
@echo " " @echo " "
ifneq ($(enable_gpsd),) ifneq ($(enable_gpsd),)
@echo "\t>\tThis includes support for gpsd." @echo " > This includes support for gpsd."
else else
@echo "\t>\tThis does NOT include support for gpsd." @echo " > This does NOT include support for gpsd."
endif endif
ifneq ($(enable_hamlib),) ifneq ($(enable_hamlib),)
@echo "\t>\tThis includes support for hamlib." @echo " > This includes support for hamlib."
else else
@echo "\t>\tThis does NOT include support for hamlib." @echo " > This does NOT include support for hamlib."
endif endif
ifneq ($(enable_cm108),) ifneq ($(enable_cm108),)
@echo "\t>\tThis includes support for CM108/CM119 PTT." @echo " > This includes support for CM108/CM119 PTT."
else else
@echo "\t>\tThis does NOT include support for CM108/CM119 PTT." @echo " > This does NOT include support for CM108/CM119 PTT."
endif endif
@echo " " @echo " "
@ -366,7 +234,7 @@ gen_fff : demod_afsk.c dsp.c textcolor.c
# #
# The destination field is often used to identify the manufacturer/model. # The APRS AX.25 destination field is often used to identify the manufacturer/model.
# These are not hardcoded into Dire Wolf. Instead they are read from # These are not hardcoded into Dire Wolf. Instead they are read from
# a file called tocalls.txt at application start up time. # a file called tocalls.txt at application start up time.
# #
@ -458,6 +326,10 @@ kissutil : kissutil.c kiss_frame.c ax25_pad.o fcs_calc.o textcolor.o serial_port
# List USB audio adapters than can use GPIO for PTT. # List USB audio adapters than can use GPIO for PTT.
# I don't think this will work on BSD.
# Rather than omitting cm108, I think it would be simpler and less confusing to build
# the application and have it say something like "not supported on this platform."
# The difference in behavior can depend on the -DUSE_CM108 compile option.
cm108 : cm108.c textcolor.o misc.a cm108 : cm108.c textcolor.o misc.a
$(CC) $(CFLAGS) -g -DCM108_MAIN -o $@ $^ $(LDFLAGS) $(CC) $(CFLAGS) -g -DCM108_MAIN -o $@ $^ $(LDFLAGS)
@ -500,7 +372,14 @@ utm.o : geotranz/utm.c
# Provide our own copy of strlcpy and strlcat because they are not included with Linux. # Provide our own copy of strlcpy and strlcat because they are not included with Linux.
# We don't need the others in that same directory. # We don't need the others in that same directory.
# OpenBSD has the strl--- functions so misc.a can be empty.
# I don't want to eliminate use of misc.a because other functions might be added in the future.
ifeq ($(OS),OpenBSD)
misc.a :
ar -cr $@ $^
else
misc.a : strlcpy.o strlcat.o misc.a : strlcpy.o strlcat.o
ar -cr $@ $^ ar -cr $@ $^
@ -510,6 +389,7 @@ strlcpy.o : misc/strlcpy.c
strlcat.o : misc/strlcat.c strlcat.o : misc/strlcat.c
$(CC) $(CFLAGS) -I. -c -o $@ $^ $(CC) $(CFLAGS) -I. -c -o $@ $^
endif
# ------------------------------------- Installation ---------------------------------- # ------------------------------------- Installation ----------------------------------
@ -526,6 +406,8 @@ strlcat.o : misc/strlcat.c
# generic.conf should be checked into source control. # generic.conf should be checked into source control.
# direwolf.conf should NOT. It is generated when compiling on the target platform. # direwolf.conf should NOT. It is generated when compiling on the target platform.
# TODO: Should have BSD variation with OSS device names. Anything else?
direwolf.conf : generic.conf direwolf.conf : generic.conf
egrep '^C|^L' generic.conf | cut -c2-999 > direwolf.conf egrep '^C|^L' generic.conf | cut -c2-999 > direwolf.conf
@ -544,9 +426,15 @@ DESTDIR ?= /usr/local
# Command to "install" to system directories. Use "ginstall" for Mac. # Command to "install" to system directories.
# Do we need to use "-m 999" instead of "--mode=999" for OpenBSD?
INSTALL ?= install
INSTALL_PROGRAM ?= ${INSTALL} -D --mode=755
INSTALL_SCRIPT ?= ${INSTALL} -D --mode=755
INSTALL_DATA ?= ${INSTALL} -D --mode=644
INSTALL_MAN ?= ${INSTALL_DATA}
INSTALL=install
# direwolf.desktop was previously handcrafted for the Raspberry Pi. # direwolf.desktop was previously handcrafted for the Raspberry Pi.
# It was hardcoded with lxterminal, /home/pi, and so on. # It was hardcoded with lxterminal, /home/pi, and so on.
@ -559,9 +447,9 @@ direwolf.desktop :
@echo "Generating customized direwolf.desktop ..." @echo "Generating customized direwolf.desktop ..."
@echo '[Desktop Entry]' > $@ @echo '[Desktop Entry]' > $@
@echo 'Type=Application' >> $@ @echo 'Type=Application' >> $@
ifneq ($(wildcard /usr/bin/lxterminal),) ifneq ($(wildcard ${PREFIX}/bin/lxterminal),)
@echo "Exec=lxterminal -t \"Dire Wolf\" -e \"$(DESTDIR)/bin/direwolf\"" >> $@ @echo "Exec=lxterminal -t \"Dire Wolf\" -e \"$(DESTDIR)/bin/direwolf\"" >> $@
else ifneq ($(wildcard /usr/bin/lxterm),) else ifneq ($(wildcard ${PREFIX}/bin/lxterm),)
@echo "Exec=lxterm -hold -title \"Dire Wolf\" -bg white -e \"$(DESTDIR)/bin/direwolf\"" >> $@ @echo "Exec=lxterm -hold -title \"Dire Wolf\" -bg white -e \"$(DESTDIR)/bin/direwolf\"" >> $@
else else
@echo "Exec=xterm -hold -title \"Dire Wolf\" -bg white -e \"$(DESTDIR)/bin/direwolf\"" >> $@ @echo "Exec=xterm -hold -title \"Dire Wolf\" -bg white -e \"$(DESTDIR)/bin/direwolf\"" >> $@
@ -585,103 +473,106 @@ install : $(APPS) direwolf.conf tocalls.txt symbols-new.txt symbolsX.txt dw-icon
# Applications, not installed with package manager, normally go in /usr/local/bin. # Applications, not installed with package manager, normally go in /usr/local/bin.
# /usr/bin is used instead when installing from .DEB or .RPM package. # /usr/bin is used instead when installing from .DEB or .RPM package.
# #
$(INSTALL) -D --mode=755 direwolf $(DESTDIR)/bin/direwolf $(INSTALL_PROGRAM) direwolf $(DESTDIR)/bin/direwolf
$(INSTALL) -D --mode=755 decode_aprs $(DESTDIR)/bin/decode_aprs $(INSTALL_PROGRAM) decode_aprs $(DESTDIR)/bin/decode_aprs
$(INSTALL) -D --mode=755 text2tt $(DESTDIR)/bin/text2tt $(INSTALL_PROGRAM) text2tt $(DESTDIR)/bin/text2tt
$(INSTALL) -D --mode=755 tt2text $(DESTDIR)/bin/tt2text $(INSTALL_PROGRAM) tt2text $(DESTDIR)/bin/tt2text
$(INSTALL) -D --mode=755 ll2utm $(DESTDIR)/bin/ll2utm $(INSTALL_PROGRAM) ll2utm $(DESTDIR)/bin/ll2utm
$(INSTALL) -D --mode=755 utm2ll $(DESTDIR)/bin/utm2ll $(INSTALL_PROGRAM) utm2ll $(DESTDIR)/bin/utm2ll
$(INSTALL) -D --mode=755 aclients $(DESTDIR)/bin/aclients $(INSTALL_PROGRAM) aclients $(DESTDIR)/bin/aclients
$(INSTALL) -D --mode=755 log2gpx $(DESTDIR)/bin/log2gpx $(INSTALL_PROGRAM) log2gpx $(DESTDIR)/bin/log2gpx
$(INSTALL) -D --mode=755 gen_packets $(DESTDIR)/bin/gen_packets $(INSTALL_PROGRAM) gen_packets $(DESTDIR)/bin/gen_packets
$(INSTALL) -D --mode=755 atest $(DESTDIR)/bin/atest $(INSTALL_PROGRAM) atest $(DESTDIR)/bin/atest
$(INSTALL) -D --mode=755 ttcalc $(DESTDIR)/bin/ttcalc $(INSTALL_PROGRAM) ttcalc $(DESTDIR)/bin/ttcalc
$(INSTALL) -D --mode=755 kissutil $(DESTDIR)/bin/kissutil $(INSTALL_PROGRAM) kissutil $(DESTDIR)/bin/kissutil
$(INSTALL) -D --mode=755 cm108 $(DESTDIR)/bin/cm108 $(INSTALL_PROGRAM) cm108 $(DESTDIR)/bin/cm108
$(INSTALL) -D --mode=755 dwespeak.sh $(DESTDIR)/bin/dwspeak.sh $(INSTALL_PROGRAM) dwespeak.sh $(DESTDIR)/bin/dwspeak.sh
# #
# Telemetry Toolkit executables. Other .conf and .txt files will go into doc directory. # Telemetry Toolkit executables. Other .conf and .txt files will go into doc directory.
# #
$(INSTALL) -D --mode=755 telemetry-toolkit/telem-balloon.pl $(DESTDIR)/bin/telem-balloon.pl $(INSTALL_SCRIPT) telemetry-toolkit/telem-balloon.pl $(DESTDIR)/bin/telem-balloon.pl
$(INSTALL) -D --mode=755 telemetry-toolkit/telem-bits.pl $(DESTDIR)/bin/telem-bits.pl $(INSTALL_SCRIPT) telemetry-toolkit/telem-bits.pl $(DESTDIR)/bin/telem-bits.pl
$(INSTALL) -D --mode=755 telemetry-toolkit/telem-data.pl $(DESTDIR)/bin/telem-data.pl $(INSTALL_SCRIPT) telemetry-toolkit/telem-data.pl $(DESTDIR)/bin/telem-data.pl
$(INSTALL) -D --mode=755 telemetry-toolkit/telem-data91.pl $(DESTDIR)/bin/telem-data91.pl $(INSTALL_SCRIPT) telemetry-toolkit/telem-data91.pl $(DESTDIR)/bin/telem-data91.pl
$(INSTALL) -D --mode=755 telemetry-toolkit/telem-eqns.pl $(DESTDIR)/bin/telem-eqns.pl $(INSTALL_SCRIPT) telemetry-toolkit/telem-eqns.pl $(DESTDIR)/bin/telem-eqns.pl
$(INSTALL) -D --mode=755 telemetry-toolkit/telem-parm.pl $(DESTDIR)/bin/telem-parm.pl $(INSTALL_SCRIPT) telemetry-toolkit/telem-parm.pl $(DESTDIR)/bin/telem-parm.pl
$(INSTALL) -D --mode=755 telemetry-toolkit/telem-seq.sh $(DESTDIR)/bin/telem-seq.sh $(INSTALL_SCRIPT) telemetry-toolkit/telem-seq.sh $(DESTDIR)/bin/telem-seq.sh
$(INSTALL) -D --mode=755 telemetry-toolkit/telem-unit.pl $(DESTDIR)/bin/telem-unit.pl $(INSTALL_SCRIPT) telemetry-toolkit/telem-unit.pl $(DESTDIR)/bin/telem-unit.pl
$(INSTALL) -D --mode=755 telemetry-toolkit/telem-volts.py $(DESTDIR)/bin/telem-volts.py $(INSTALL_SCRIPT) telemetry-toolkit/telem-volts.py $(DESTDIR)/bin/telem-volts.py
# #
# Misc. data such as "tocall" to system mapping. # Misc. data such as "tocall" to system mapping.
# #
$(INSTALL) -D --mode=644 tocalls.txt $(DESTDIR)/share/direwolf/tocalls.txt $(INSTALL_DATA) tocalls.txt $(DESTDIR)/share/direwolf/tocalls.txt
$(INSTALL) -D --mode=644 symbols-new.txt $(DESTDIR)/share/direwolf/symbols-new.txt $(INSTALL_DATA) symbols-new.txt $(DESTDIR)/share/direwolf/symbols-new.txt
$(INSTALL) -D --mode=644 symbolsX.txt $(DESTDIR)/share/direwolf/symbolsX.txt $(INSTALL_DATA) symbolsX.txt $(DESTDIR)/share/direwolf/symbolsX.txt
# #
# For desktop icon. # For desktop icon.
# #
$(INSTALL) -D --mode=644 dw-icon.png $(DESTDIR)/share/direwolf/pixmaps/dw-icon.png $(INSTALL_DATA) dw-icon.png $(DESTDIR)/share/direwolf/pixmaps/dw-icon.png
$(INSTALL) -D --mode=644 direwolf.desktop $(DESTDIR)/share/applications/direwolf.desktop $(INSTALL_DATA) direwolf.desktop $(DESTDIR)/share/applications/direwolf.desktop
# #
# Documentation. Various plain text files and PDF. # Documentation. Various plain text files and PDF.
# #
$(INSTALL) -D --mode=644 CHANGES.md $(DESTDIR)/share/doc/direwolf/CHANGES.md $(INSTALL_DATA) CHANGES.md $(DESTDIR)/share/doc/direwolf/CHANGES.md
$(INSTALL) -D --mode=644 LICENSE-dire-wolf.txt $(DESTDIR)/share/doc/direwolf/LICENSE-dire-wolf.txt $(INSTALL_DATA) LICENSE-dire-wolf.txt $(DESTDIR)/share/doc/direwolf/LICENSE-dire-wolf.txt
$(INSTALL) -D --mode=644 LICENSE-other.txt $(DESTDIR)/share/doc/direwolf/LICENSE-other.txt $(INSTALL_DATA) LICENSE-other.txt $(DESTDIR)/share/doc/direwolf/LICENSE-other.txt
# #
# ./README.md is an overview for the project main page. # ./README.md is an overview for the project main page.
# Maybe we could stick it in some other place. # Maybe we could stick it in some other place.
# doc/README.md contains an overview of the PDF file contents and is more useful here. # doc/README.md contains an overview of the PDF file contents and is more useful here.
# #
$(INSTALL) -D --mode=644 doc/README.md $(DESTDIR)/share/doc/direwolf/README.md $(INSTALL_DATA) doc/README.md $(DESTDIR)/share/doc/direwolf/README.md
$(INSTALL) -D --mode=644 doc/2400-4800-PSK-for-APRS-Packet-Radio.pdf $(DESTDIR)/share/doc/direwolf/2400-4800-PSK-for-APRS-Packet-Radio.pdf $(INSTALL_DATA) doc/2400-4800-PSK-for-APRS-Packet-Radio.pdf $(DESTDIR)/share/doc/direwolf/2400-4800-PSK-for-APRS-Packet-Radio.pdf
$(INSTALL) -D --mode=644 doc/A-Better-APRS-Packet-Demodulator-Part-1-1200-baud.pdf $(DESTDIR)/share/doc/direwolf/A-Better-APRS-Packet-Demodulator-Part-1-1200-baud.pdf $(INSTALL_DATA) doc/A-Better-APRS-Packet-Demodulator-Part-1-1200-baud.pdf $(DESTDIR)/share/doc/direwolf/A-Better-APRS-Packet-Demodulator-Part-1-1200-baud.pdf
$(INSTALL) -D --mode=644 doc/A-Better-APRS-Packet-Demodulator-Part-2-9600-baud.pdf $(DESTDIR)/share/doc/direwolf/A-Better-APRS-Packet-Demodulator-Part-2-9600-baud.pdf $(INSTALL_DATA) doc/A-Better-APRS-Packet-Demodulator-Part-2-9600-baud.pdf $(DESTDIR)/share/doc/direwolf/A-Better-APRS-Packet-Demodulator-Part-2-9600-baud.pdf
$(INSTALL) -D --mode=644 doc/A-Closer-Look-at-the-WA8LMF-TNC-Test-CD.pdf $(DESTDIR)/share/doc/direwolf/A-Closer-Look-at-the-WA8LMF-TNC-Test-CD.pdf $(INSTALL_DATA) doc/A-Closer-Look-at-the-WA8LMF-TNC-Test-CD.pdf $(DESTDIR)/share/doc/direwolf/A-Closer-Look-at-the-WA8LMF-TNC-Test-CD.pdf
$(INSTALL) -D --mode=644 doc/APRS-Telemetry-Toolkit.pdf $(DESTDIR)/share/doc/direwolf/APRS-Telemetry-Toolkit.pdf $(INSTALL_DATA) doc/APRS-Telemetry-Toolkit.pdf $(DESTDIR)/share/doc/direwolf/APRS-Telemetry-Toolkit.pdf
$(INSTALL) -D --mode=644 doc/APRStt-Implementation-Notes.pdf $(DESTDIR)/share/doc/direwolf/APRStt-Implementation-Notes.pdf $(INSTALL_DATA) doc/APRStt-Implementation-Notes.pdf $(DESTDIR)/share/doc/direwolf/APRStt-Implementation-Notes.pdf
$(INSTALL) -D --mode=644 doc/APRStt-interface-for-SARTrack.pdf $(DESTDIR)/share/doc/direwolf/APRStt-interface-for-SARTrack.pdf $(INSTALL_DATA) doc/APRStt-interface-for-SARTrack.pdf $(DESTDIR)/share/doc/direwolf/APRStt-interface-for-SARTrack.pdf
$(INSTALL) -D --mode=644 doc/APRStt-Listening-Example.pdf $(DESTDIR)/share/doc/direwolf/APRStt-Listening-Example.pdf $(INSTALL_DATA) doc/APRStt-Listening-Example.pdf $(DESTDIR)/share/doc/direwolf/APRStt-Listening-Example.pdf
$(INSTALL) -D --mode=644 doc/Bluetooth-KISS-TNC.pdf $(DESTDIR)/share/doc/direwolf/Bluetooth-KISS-TNC.pdf $(INSTALL_DATA) doc/Bluetooth-KISS-TNC.pdf $(DESTDIR)/share/doc/direwolf/Bluetooth-KISS-TNC.pdf
$(INSTALL) -D --mode=644 doc/Going-beyond-9600-baud.pdf $(DESTDIR)/share/doc/direwolf/Going-beyond-9600-baud.pdf $(INSTALL_DATA) doc/Going-beyond-9600-baud.pdf $(DESTDIR)/share/doc/direwolf/Going-beyond-9600-baud.pdf
$(INSTALL) -D --mode=644 doc/Raspberry-Pi-APRS.pdf $(DESTDIR)/share/doc/direwolf/Raspberry-Pi-APRS.pdf $(INSTALL_DATA) doc/Raspberry-Pi-APRS.pdf $(DESTDIR)/share/doc/direwolf/Raspberry-Pi-APRS.pdf
$(INSTALL) -D --mode=644 doc/Raspberry-Pi-APRS-Tracker.pdf $(DESTDIR)/share/doc/direwolf/Raspberry-Pi-APRS-Tracker.pdf $(INSTALL_DATA) doc/Raspberry-Pi-APRS-Tracker.pdf $(DESTDIR)/share/doc/direwolf/Raspberry-Pi-APRS-Tracker.pdf
$(INSTALL) -D --mode=644 doc/Raspberry-Pi-SDR-IGate.pdf $(DESTDIR)/share/doc/direwolf/Raspberry-Pi-SDR-IGate.pdf $(INSTALL_DATA) doc/Raspberry-Pi-SDR-IGate.pdf $(DESTDIR)/share/doc/direwolf/Raspberry-Pi-SDR-IGate.pdf
$(INSTALL) -D --mode=644 doc/Successful-APRS-IGate-Operation.pdf $(DESTDIR)/share/doc/direwolf/Successful-APRS-IGate-Operation.pdf $(INSTALL_DATA) doc/Successful-APRS-IGate-Operation.pdf $(DESTDIR)/share/doc/direwolf/Successful-APRS-IGate-Operation.pdf
$(INSTALL) -D --mode=644 doc/User-Guide.pdf $(DESTDIR)/share/doc/direwolf/User-Guide.pdf $(INSTALL_DATA) doc/User-Guide.pdf $(DESTDIR)/share/doc/direwolf/User-Guide.pdf
$(INSTALL) -D --mode=644 doc/WA8LMF-TNC-Test-CD-Results.pdf $(DESTDIR)/share/doc/direwolf/WA8LMF-TNC-Test-CD-Results.pdf $(INSTALL_DATA) doc/WA8LMF-TNC-Test-CD-Results.pdf $(DESTDIR)/share/doc/direwolf/WA8LMF-TNC-Test-CD-Results.pdf
$(INSTALL) -D --mode=644 doc/Why-is-9600-only-twice-as-fast-as-1200.pdf $(DESTDIR)/share/doc/direwolf/Why-is-9600-only-twice-as-fast-as-1200.pdf $(INSTALL_DATA) doc/Why-is-9600-only-twice-as-fast-as-1200.pdf $(DESTDIR)/share/doc/direwolf/Why-is-9600-only-twice-as-fast-as-1200.pdf
# #
# Various sample config and other files go into examples under the doc directory. # Various sample config and other files go into examples under the doc directory.
# When building from source, these can be put in home directory with "make install-conf". # When building from source, these can be put in home directory with "make install-conf".
# When installed from .DEB or .RPM package, the user will need to copy these to # When installed from .DEB or .RPM package, the user will need to copy these to
# the home directory or other desired location. # the home directory or other desired location.
# #
$(INSTALL) -D --mode=644 direwolf.conf $(DESTDIR)/share/doc/direwolf/examples/direwolf.conf $(INSTALL_DATA) direwolf.conf $(DESTDIR)/share/doc/direwolf/examples/direwolf.conf
$(INSTALL) -D --mode=755 dw-start.sh $(DESTDIR)/share/doc/direwolf/examples/dw-start.sh $(INSTALL_SCRIPT) dw-start.sh $(DESTDIR)/share/doc/direwolf/examples/dw-start.sh
$(INSTALL) -D --mode=644 sdr.conf $(DESTDIR)/share/doc/direwolf/examples/sdr.conf $(INSTALL_DATA) sdr.conf $(DESTDIR)/share/doc/direwolf/examples/sdr.conf
$(INSTALL) -D --mode=644 telemetry-toolkit/telem-m0xer-3.txt $(DESTDIR)/share/doc/direwolf/examples/telem-m0xer-3.txt $(INSTALL_DATA) telemetry-toolkit/telem-m0xer-3.txt $(DESTDIR)/share/doc/direwolf/examples/telem-m0xer-3.txt
$(INSTALL) -D --mode=644 telemetry-toolkit/telem-balloon.conf $(DESTDIR)/share/doc/direwolf/examples/telem-balloon.conf $(INSTALL_DATA) telemetry-toolkit/telem-balloon.conf $(DESTDIR)/share/doc/direwolf/examples/telem-balloon.conf
$(INSTALL) -D --mode=644 telemetry-toolkit/telem-volts.conf $(DESTDIR)/share/doc/direwolf/examples/telem-volts.conf $(INSTALL_DATA) telemetry-toolkit/telem-volts.conf $(DESTDIR)/share/doc/direwolf/examples/telem-volts.conf
# #
# "man" pages # "man" pages
# #
$(INSTALL) -D --mode=644 man1/aclients.1 $(DESTDIR)/share/man/man1/aclients.1 $(INSTALL_MAN) man1/aclients.1 $(DESTDIR)/share/man/man1/aclients.1
$(INSTALL) -D --mode=644 man1/atest.1 $(DESTDIR)/share/man/man1/atest.1 $(INSTALL_MAN) man1/atest.1 $(DESTDIR)/share/man/man1/atest.1
$(INSTALL) -D --mode=644 man1/decode_aprs.1 $(DESTDIR)/share/man/man1/decode_aprs.1 $(INSTALL_MAN) man1/decode_aprs.1 $(DESTDIR)/share/man/man1/decode_aprs.1
$(INSTALL) -D --mode=644 man1/direwolf.1 $(DESTDIR)/share/man/man1/direwolf.1 $(INSTALL_MAN) man1/direwolf.1 $(DESTDIR)/share/man/man1/direwolf.1
$(INSTALL) -D --mode=644 man1/gen_packets.1 $(DESTDIR)/share/man/man1/gen_packets.1 $(INSTALL_MAN) man1/gen_packets.1 $(DESTDIR)/share/man/man1/gen_packets.1
$(INSTALL) -D --mode=644 man1/kissutil.1 $(DESTDIR)/share/man/man1/kissutil.1 $(INSTALL_MAN) man1/kissutil.1 $(DESTDIR)/share/man/man1/kissutil.1
$(INSTALL) -D --mode=644 man1/ll2utm.1 $(DESTDIR)/share/man/man1/ll2utm.1 $(INSTALL_MAN) man1/ll2utm.1 $(DESTDIR)/share/man/man1/ll2utm.1
$(INSTALL) -D --mode=644 man1/log2gpx.1 $(DESTDIR)/share/man/man1/log2gpx.1 $(INSTALL_MAN) man1/log2gpx.1 $(DESTDIR)/share/man/man1/log2gpx.1
$(INSTALL) -D --mode=644 man1/text2tt.1 $(DESTDIR)/share/man/man1/text2tt.1 $(INSTALL_MAN) man1/text2tt.1 $(DESTDIR)/share/man/man1/text2tt.1
$(INSTALL) -D --mode=644 man1/tt2text.1 $(DESTDIR)/share/man/man1/tt2text.1 $(INSTALL_MAN) man1/tt2text.1 $(DESTDIR)/share/man/man1/tt2text.1
$(INSTALL) -D --mode=644 man1/utm2ll.1 $(DESTDIR)/share/man/man1/utm2ll.1 $(INSTALL_MAN) man1/utm2ll.1 $(DESTDIR)/share/man/man1/utm2ll.1
# #
# Set group and mode of HID devices corresponding to C-Media USB Audio adapters. # Set group and mode of HID devices corresponding to C-Media USB Audio adapters.
# This will allow us to use the CM108/CM119 GPIO pins for PTT. # This will allow us to use the CM108/CM119 GPIO pins for PTT.
# I don't think this is applicable to BSD.
# #
$(INSTALL) -D --mode=644 99-direwolf-cmedia.rules /etc/udev/rules.d/99-direwolf-cmedia.rules ifeq ($(OS),Linux)
$(INSTALL_DATA) 99-direwolf-cmedia.rules /etc/udev/rules.d/99-direwolf-cmedia.rules
endif
# #
@echo " " @echo " "
@echo "If this is your first install, not an upgrade, type this to put a copy" @echo "If this is your first install, not an upgrade, type this to put a copy"
@ -724,9 +615,12 @@ endif
.PHONY: install-rpi .PHONY: install-rpi
install-rpi : install-rpi :
ifeq ($(OS),Linux)
ln -f -s $(DESTDIR)/share/applications/direwolf.desktop ~/Desktop/direwolf.desktop ln -f -s $(DESTDIR)/share/applications/direwolf.desktop ~/Desktop/direwolf.desktop
else
ln -f -s ${PREFIX}/share/applications/direwolf.desktop ~/Desktop/direwolf.desktop
endif
# ---------------------------------- Automated Smoke Test -------------------------------- # ---------------------------------- Automated Smoke Test --------------------------------
@ -942,44 +836,6 @@ testagc96 : atest.c fsk_fast_filter.h tune.h demod.c demod_afsk.c demod_psk.c de
echo " " > tune.h echo " " > tune.h
# ------------------------------- Source distribution ---------------------------------
# probably obsolete and can be removed after move to github.
.PHONY: dist-src
dist-src : README.md CHANGES.md
doc/User-Guide.pdf doc/Raspberry-Pi-APRS.pdf \
doc/Raspberry-Pi-APRS-Tracker.pdf doc/APRStt-Implementation-Notes.pdf \
dw-start.sh dwespeak.bat dwespeak.sh \
tocalls.txt symbols-new.txt symbolsX.txt direwolf.spec
rm -f fsk_fast_filter.h
echo " " > tune.h
rm -f ../$z-src.zip
(cd .. ; zip $z-src.zip \
$z/README.md \
$z/CHANGES.md \
$z/LICENSE* \
$z/doc/User-Guide.pdf \
$z/doc/Raspberry-Pi-APRS.pdf \
$z/doc/Raspberry-Pi-APRS-Tracker.pdf \
$z/doc/APRStt-Implementation-Notes.pdf \
$z/doc/APRS-Telemetry-Toolkit.pdf \
$z/Makefile* \
$z/*.c $z/*.h \
$z/regex/* $z/misc/* $z/geotranz/* \
$z/man1/* \
$z/generic.conf \
$z/tocalls.txt $z/symbols-new.txt $z/symbolsX.txt \
$z/dw-icon.png $z/dw-icon.rc $z/dw-icon.ico \
$z/dw-start.sh $z/direwolf.spec \
$z/dwespeak.bat $z/dwespeak.sh \
$z/telemetry-toolkit/* )
# ----------------------------------------------------------------------------------------- # -----------------------------------------------------------------------------------------

13
audio.h
View File

@ -335,15 +335,18 @@ struct audio_s {
}; };
#if __WIN32__ || __APPLE__ #if __WIN32__
#define DEFAULT_ADEVICE "" /* Windows: Empty string = default audio device. */ #define DEFAULT_ADEVICE "" /* Windows: Empty string = default audio device. */
#else #elif __APPLE__
#if USE_ALSA #define DEFAULT_ADEVICE "" /* Mac OSX: Empty string = default audio device. */
#elif USE_ALSA
#define DEFAULT_ADEVICE "default" /* Use default device for ALSA. */ #define DEFAULT_ADEVICE "default" /* Use default device for ALSA. */
#elif __OpenBSD__
#define DEFAULT_ADEVICE "default" /* Use default device for OpenBSD-portaudio. */
#else #else
#define DEFAULT_ADEVICE "/dev/dsp" /* First audio device for OSS. */ #define DEFAULT_ADEVICE "/dev/dsp" /* First audio device for OSS. (FreeBSD) */
#endif #endif
#endif
/* /*

View File

@ -98,10 +98,14 @@
int main (void) int main (void)
{ {
text_color_init (0); // Turn off text color. text_color_init (0); // Turn off text color.
#if defined(__OpenBSD__) || defined(__FreeBSD__)
dw_printf ("CM108 PTT support is not available for BSD.\n");
#else
dw_printf ("CM108 PTT support was disabled in Makefile.linux.\n"); dw_printf ("CM108 PTT support was disabled in Makefile.linux.\n");
dw_printf ("It was excluded because /usr/include/libudev.h was missing.\n"); dw_printf ("It was excluded because /usr/include/libudev.h was missing.\n");
dw_printf ("Install it with \"sudo apt-get install libudev-dev\" or\n"); dw_printf ("Install it with \"sudo apt-get install libudev-dev\" or\n");
dw_printf ("\"sudo yum install libudev-devel\" then rebuild.\n"); dw_printf ("\"sudo yum install libudev-devel\" then rebuild.\n");
#endif
return (0); return (0);
} }

View File

@ -1,4 +1,11 @@
#!/bin/bash #!/usr/bin/env bash
# Why not simply "#!/bin/bash" ?
# For OpenBSD, the bash location is /usr/local/bin/bash.
# By using env here, bash is found based on the user's $PATH.
# I hope this does not break some other operating system.
# Run this from crontab periodically to start up # Run this from crontab periodically to start up
# Dire Wolf automatically. # Dire Wolf automatically.