diff --git a/.gitignore b/.gitignore
index 3f8779da..659c845b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -107,3 +107,7 @@ $RECYCLE.BIN/
 *.lnk
 /use_this_sdk
 *.dSYM
+
+# cmake
+build/
+tmp/
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 00000000..75484c96
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,279 @@
+cmake_minimum_required(VERSION 3.1.0)
+
+project(direwolf)
+
+# configure version
+set(direwolf_VERSION_MAJOR "1")
+set(direwolf_VERSION_MINOR "6")
+set(direwolf_VERSION_PATCH "0")
+set(direwolf_VERSION_SUFFIX "")
+
+# options
+option(FORCE_SSE "Compile with SSE instruction only" OFF)
+option(FORCE_SSSE3 "Compile with SSSE3 instruction only" OFF)
+option(FORCE_SSE41 "Compile with SSE4.1 instruction only" OFF)
+option(OPTIONAL_TEST "Compile optional test (might be broken)" OFF)
+# UNITTEST option must be after CMAKE_BUILT_TYPE
+
+# where cmake find custom modules
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
+
+# fix c standard used on the project
+set(CMAKE_C_STANDARD 99)
+
+# Set additional project information
+set(COMPANY "wb2osz")
+add_definitions("-DCOMPANY=\"${COMPANY}\"")
+set(APPLICATION_NAME "Dire Wolf")
+add_definitions("-DAPPLICATION_NAME=\"${APPLICATION_NAME}\"")
+set(APPLICATION_MAINTAINER="John Langner, WB2OSZ")
+set(COPYRIGHT "Copyright (c) 2019 John Langner, WB2OSZ. All rights reserved.")
+add_definitions("-DCOPYRIGHT=\"${COPYRIGHT}\"")
+set(IDENTIFIER "com.${COMPANY}.${APPLICATION_NAME}")
+add_definitions("-DIDENTIFIER=\"${IDENTIFIER}\"")
+# raspberry as only lxterminal not xterm
+if(NOT (WIN32 OR CYGWIN))
+  find_program(BINARY_TERMINAL_BIN lxterminal)
+  if(BINARY_TERMINAL_BIN)
+    set(APPLICATION_DESKTOP_EXEC "${BINARY_TERMINAL_BIN} -e ${CMAKE_PROJECT_NAME}")
+  else()
+    set(APPLICATION_DESKTOP_EXEC "xterm -e ${CMAKE_PROJECT_NAME}")
+  endif()
+endif()
+
+find_package(Git)
+if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git/")
+  # we can also use `git describe --tags`
+  execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse --short HEAD
+    WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
+    RESULT_VARIABLE res
+    OUTPUT_VARIABLE out
+    ERROR_QUIET
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+  if(NOT res)
+    string(REGEX REPLACE "^v([0-9]+)\.([0-9]+)\.([0-9]+)-" "" git_commit ${out})
+    set(direwolf_VERSION_SUFFIX "-${git_commit}")
+    set(direwolf_VERSION_COMMIT "${git_commit}")
+  endif()
+endif()
+
+# set variables
+set(direwolf_VERSION "${direwolf_VERSION_MAJOR}.${direwolf_VERSION_MINOR}.${direwolf_VERSION_PATCH}${direwolf_VERSION_SUFFIX}")
+message(STATUS "${APPLICATION_NAME} Version: ${direwolf_VERSION}")
+add_definitions("-DIREWOLF_VERSION=\"${direwolf_VERSION}\"")
+add_definitions("-DMAJOR_VERSION=${direwolf_VERSION_MAJOR}")
+add_definitions("-DMINOR_VERSION=${direwolf_VERSION_MINOR}")
+if(direwolf_VERSION_COMMIT)
+  add_definitions("-DEXTRA_VERSION=${direwolf_VERSION_COMMIT}")
+endif()
+
+set(CUSTOM_SRC_DIR "${CMAKE_SOURCE_DIR}/src")
+set(CUSTOM_EXTERNAL_DIR "${CMAKE_SOURCE_DIR}/external")
+set(CUSTOM_MISC_DIR "${CUSTOM_EXTERNAL_DIR}/misc")
+set(CUSTOM_REGEX_DIR "${CUSTOM_EXTERNAL_DIR}/regex")
+set(CUSTOM_GEOTRANZ_DIR "${CUSTOM_EXTERNAL_DIR}/geotranz")
+set(CUSTOM_DATA_DIR "${CMAKE_SOURCE_DIR}/data")
+set(CUSTOM_SCRIPTS_DIR "${CMAKE_SOURCE_DIR}/scripts")
+set(CUSTOM_TELEMETRY_DIR "${CUSTOM_SCRIPTS_DIR}/telemetry-toolkit")
+set(CUSTOM_CONF_DIR "${CMAKE_SOURCE_DIR}/conf")
+set(CUSTOM_DOC_DIR "${CMAKE_SOURCE_DIR}/doc")
+set(CUSTOM_MAN_DIR "${CMAKE_SOURCE_DIR}/man")
+set(CUSTOM_TEST_DIR "${CMAKE_SOURCE_DIR}/test")
+set(CUSTOM_TEST_SCRIPTS_DIR "${CUSTOM_TEST_DIR}/scripts")
+set(CUSTOM_SHELL_SHABANG "#!/bin/sh -e")
+
+# cpack variables
+set(CPACK_GENERATOR "ZIP")
+set(CPACK_STRIP_FILES true)
+set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
+set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${direwolf_VERSION}_${CMAKE_SYSTEM_PROCESSOR}")
+set(CPACK_PACKAGE_CONTACT "https://github.com/wb2osz/direwolf")
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Dire Wolf is a software soundcard AX.25 packet modem/TNC and APRS encoder/decoder")
+set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md")
+set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
+set(CPACK_SOURCE_IGNORE_FILES "${PROJECT_BINARY_DIR};/.git/;.gitignore;menu.yml;.travis.yml;.appveyor.yml;default.nix;.envrc;TODOs.org;/.scripts/")
+
+# if we don't set build_type
+if(NOT DEFINED CMAKE_BUILD_TYPE OR "${CMAKE_BUILD_TYPE}" STREQUAL "")
+  set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
+endif()
+message(STATUS "Build type set to: ${CMAKE_BUILD_TYPE}")
+message("CMake system: ${CMAKE_SYSTEM_NAME}")
+
+# Unittest should be on for dev builds and off for releases.
+if(CMAKE_BUILD_TYPE MATCHES "Release")
+  option(UNITTEST "Build unittest binaries." OFF)
+else()
+  option(UNITTEST "Build unittest binaries." ON)
+endif()
+
+# set compiler
+include(FindCompiler)
+
+# find cpu flags (and set compiler)
+include(FindCPUflags)
+
+# auto include current directory
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+# set OS dependant variables
+if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+  set(LINUX TRUE)
+
+  configure_file("${CMAKE_SOURCE_DIR}/cmake/cpack/${CMAKE_PROJECT_NAME}.desktop.in"
+    "${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.desktop" @ONLY)
+
+elseif(APPLE)
+  if("${CMAKE_OSX_DEPLOYMENT_TARGET}" STREQUAL "")
+    message(STATUS "Build for macOS target: local version")
+  else()
+    message(STATUS "Build for macOS target: ${CMAKE_OSX_DEPLOYMENT_TARGET}")
+  endif()
+
+  # prepend path to find_*()
+  set(CMAKE_FIND_ROOT_PATH "/opt/local")
+
+  set(CMAKE_MACOSX_RPATH ON)
+  message(STATUS "RPATH support: ${CMAKE_MACOSX_RPATH}")
+
+elseif (WIN32)
+  if(NOT VS2015 AND NOT VS2017)
+    message(FATAL_ERROR "You must use Microsoft Visual Studio 2015 or 2017 as compiler")
+  endif()
+
+  # compile with full multicore
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
+
+  set(CUSTOM_SHELL_BIN "")
+endif()
+
+if (C_CLANG OR C_GCC)
+  # _BSD_SOURCE is deprecated we need to use _DEFAULT_SOURCE
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wvla -ffast-math -ftree-vectorize -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE ${EXTRA_FLAGS}")
+  # for math.h
+  link_libraries("-lm")
+elseif (C_MSVC)
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -W3 -MP ${EXTRA_FLAGS}")
+endif()
+
+if (C_CLANG)
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ferror-limit=1")
+elseif (C_GCC)
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmax-errors=1")
+endif()
+
+# set installation directories
+if (WIN32 OR CYGWIN)
+  set(INSTALL_BIN_DIR ".")
+  set(INSTALL_DOC_DIR "doc")
+  set(INSTALL_CONF_DIR ".")
+  set(INSTALL_SCRIPTS_DIR "scripts")
+  set(INSTALL_MAN_DIR "man")
+  set(INSTALL_DATA_DIR "data")
+else()
+  set(INSTALL_BIN_DIR "bin")
+  set(INSTALL_DOC_DIR "share/doc/${CMAKE_PROJECT_NAME}")
+  set(INSTALL_CONF_DIR "${INSTALL_DOC_DIR}/conf")
+  set(INSTALL_SCRIPTS_DIR "${INSTALL_DOC_DIR}/scripts")
+  set(INSTALL_MAN_DIR "share/man/man1")
+  set(INSTALL_DATA_DIR "share/${PROJECT_NAME}")
+endif(WIN32 OR CYGWIN)
+
+# requirements
+set(THREADS_PREFER_PTHREAD_FLAG ON)
+find_package(Threads REQUIRED)
+
+find_package(GPSD)
+if(GPSD_FOUND)
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_GPSD")
+else()
+  set(GPSD_INCLUDE_DIRS "")
+  set(GPSD_LIBRARIES "")
+endif()
+
+find_package(hamlib)
+if(HAMLIB_FOUND)
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_HAMLIB")
+else()
+  set(HAMLIB_INCLUDE_DIRS "")
+  set(HAMLIB_LIBRARIES "")
+endif()
+
+if(LINUX)
+  find_package(ALSA REQUIRED)
+  if(ALSA_FOUND)
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_ALSA")
+  endif()
+
+  find_package(udev)
+  if(UDEV_FOUND)
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_CM108")
+  endif()
+
+elseif (NOT WIN32 AND NOT CYGWIN)
+  find_package(Portaudio REQUIRED)
+  if(PORTAUDIO_FOUND)
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_PORTAUDIO")
+  endif()
+
+else()
+  set(ALSA_INCLUDE_DIRS "")
+  set(ALSA_LIBRARIES "")
+  set(UDEV_INCLUDE_DIRS "")
+  set(UDEV_LIBRARIES "")
+  set(PORTAUDIO_INCLUDE_DIRS "")
+  set(PORTAUDIO_LIBRARIES "")
+endif()
+
+# manage and fetch new data
+add_subdirectory(data)
+
+# external libraries
+add_subdirectory(${CUSTOM_GEOTRANZ_DIR})
+add_subdirectory(${CUSTOM_REGEX_DIR})
+add_subdirectory(${CUSTOM_MISC_DIR})
+
+# direwolf source code and utilities
+add_subdirectory(src)
+
+# ctest
+if(UNITTEST)
+  message(STATUS "Build unit test binaries")
+  include(CTest)
+  enable_testing()
+  add_subdirectory(test)
+endif(UNITTEST)
+
+# manage scripts
+add_subdirectory(scripts)
+
+# manage config
+add_subdirectory(conf)
+
+# install basic docs
+install(FILES ${CMAKE_SOURCE_DIR}/CHANGES.md DESTINATION ${INSTALL_DOC_DIR})
+install(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION ${INSTALL_DOC_DIR})
+install(FILES ${CMAKE_SOURCE_DIR}/external/LICENSE DESTINATION ${INSTALL_DOC_DIR}/external)
+add_subdirectory(doc)
+add_subdirectory(man)
+
+# install desktop link
+if (LINUX)
+  install(FILES ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.desktop DESTINATION share/applications)
+  install(FILES ${CMAKE_SOURCE_DIR}/cmake/cpack/${CMAKE_PROJECT_NAME}_icon.png DESTINATION share/pixmaps)
+endif()
+
+############ uninstall target ################
+configure_file(
+  "${CMAKE_CURRENT_SOURCE_DIR}/cmake/include/uninstall.cmake.in"
+  "${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake"
+  IMMEDIATE @ONLY)
+
+add_custom_target(uninstall
+  COMMAND ${CMAKE_COMMAND} -P
+  ${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake)
+
+############ packaging ################
+add_subdirectory(cmake/cpack)
diff --git a/LICENSE-dire-wolf.txt b/LICENSE
similarity index 100%
rename from LICENSE-dire-wolf.txt
rename to LICENSE
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 87850c44..00000000
--- a/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-# Select proper Makefile for operating system.
-# The Windows version is built with the help of Cygwin. 
-
-# In my case, I see CYGWIN_NT-6.1-WOW so we don't check for 
-# equal to some value.   Your mileage my vary.
-
-win := $(shell uname | grep CYGWIN)
-ifeq ($(win),)
-   win := $(shell uname | grep MINGW)
-endif
-
-dar := $(shell uname | grep Darwin)
-
-ifneq ($(win),)
-   include Makefile.win
-else ifeq ($(dar),Darwin)
-   include Makefile.macosx
-else
-   include Makefile.linux
-endif
diff --git a/Makefile.linux b/Makefile.linux
deleted file mode 100644
index a5a6f742..00000000
--- a/Makefile.linux
+++ /dev/null
@@ -1,856 +0,0 @@
-#
-# 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
-
-
-all :  $(APPS) direwolf.desktop direwolf.conf
-	@echo " "
-	@echo "Next step - install with:"
-	@echo " "
-	@echo "        sudo make install"
-	@echo " "
-
-# Default to gcc if something else not specified, e.g. clang.
-
-CC ?= gcc
-
-
-# _XOPEN_SOURCE=600 and _DEFAULT_SOURCE=1 are needed for glibc >= 2.24.
-# Explanation here:  https://github.com/wb2osz/direwolf/issues/62
-
-# 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.
-
-# -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
-# we will inherit options already set in build environment.
-# Explanation - https://github.com/wb2osz/direwolf/pull/38
-
-# For BSD, these are supplied externally.
-# https://github.com/wb2osz/direwolf/pull/92 
-# Why don't we just set them differently here?
-
-ifeq ($(OS),Linux)
-CFLAGS += -O3 -pthread -Igeotranz -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE=1 -D_BSD_SOURCE -Wall
-LDFLAGS += -lm -lpthread -lrt
-else
-CFLAGS ?= -O3 -pthread -Igeotranz -Wall
-LDFLAGS ?= -lm -lpthread -lrt
-endif
-
-
-
-# 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,
-# which has the SSE instructions.
-# For a more detailed description, see Dire-Wolf-Developer-Notes.pdf.
-
-arch := $(shell echo | ${CC} -E -dM - | grep __i386__)
-ifneq ($(arch),)
-CFLAGS += -march=pentium3
-endif
-
-
-# Add -ffast-math option if the compiler recognizes it.
-# 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)
-ifneq ($(useffast),)
-CFLAGS += -ffast-math
-endif
-
-
-
-#
-# Dire Wolf is known to work with ARM processors on the BeagleBone, CubieBoard2, CHIP, etc.
-# The best compiler options will depend on the specific type of processor
-# and the compiler target defaults.   Use the NEON instructions if available.
-#
-
-ifeq ($(OS),Linux)
-neon := $(shell cat /proc/cpuinfo | grep neon)
-ifneq ($(neon),)
-CFLAGS += -mfpu=neon
-endif
-else
-neon := $(shell machine | grep armv7)
-ifneq ($(neon),)
-CFLAGS += -mfloat-abi=hard -mfpu=neon
-endif
-endif
-
-
-
-
-# Audio system:  We normally want to use ALSA for Linux.
-# I heard that OSS will also work with Linux but I never tried it.
-# ALSA is not an option for FreeBSD or OpenBSD.
-
-ifeq ($(OS),Linux)
-alsa = 1
-else
-alsa =
-endif
-
-
-# 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" )
-endif
-
-
-# Make sure we have required library for ALSA if that option is being used.
-
-ifneq ($(alsa),)
-CFLAGS += -DUSE_ALSA
-LDFLAGS += -lasound
-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" )
-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
-
-
-
-# Enable GPS if header file is present.
-# Finding libgps.so* is more difficult because it
-# is in different places on different operating systems.
-
-enable_gpsd := $(wildcard ${PREFIX}/include/gps.h)
-ifneq ($(enable_gpsd),)
-CFLAGS += -DENABLE_GPSD
-LDFLAGS += -lgps
-endif
-
-
-# Enable hamlib support if header file is present.
-
-enable_hamlib := $(wildcard /usr/include/hamlib/rig.h /usr/local/include/hamlib/rig.h)
-ifneq ($(enable_hamlib),)
-CFLAGS += -DUSE_HAMLIB
-LDFLAGS += -lhamlib
-endif
-
-
-# Should enabling of this feature be strongly encouraged or
-# is it quite specialized and of interest to a small audience?
-# If, for some reason, can't obtain the libudev-dev package, or
-# don't want to install it, comment out the next 5 lines.
-
-ifeq ($(OS),Linux)
-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" )
-endif
-endif
-
-
-# Enable cm108 PTT support if libudev header file is present.
-
-enable_cm108 := $(wildcard /usr/include/libudev.h)
-ifneq ($(enable_cm108),)
-CFLAGS += -DUSE_CM108
-LDFLAGS += -ludev
-endif
-
-
-# Name of current directory.
-# Used to generate zip file name for distribution.
-
-z := $(notdir ${CURDIR})
-
-
-
-# --------------------------------  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 \
-		hdlc_rec2.o multi_modem.o rdq.o rrbb.o dlq.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 \
-		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 \
-		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 \
-		misc.a geotranz.a
-	$(CC) -o $@ $^ $(LDFLAGS)
-	@echo " "
-ifneq ($(enable_gpsd),)
-	@echo "        >       This includes support for gpsd."
-else
-	@echo "        >       This does NOT include support for gpsd."
-endif
-ifneq ($(enable_hamlib),)
-	@echo "        >       This includes support for hamlib."
-else
-	@echo "        >       This does NOT include support for hamlib."
-endif
-ifneq ($(enable_cm108),)
-	@echo "        >       This includes support for CM108/CM119 PTT."
-else
-	@echo "        >       This does NOT include support for CM108/CM119 PTT."
-endif
-	@echo " "
-
-# Optimization for slow processors.
-
-demod.o      : fsk_fast_filter.h
-
-demod_afsk.o : fsk_fast_filter.h
-
-
-fsk_fast_filter.h : gen_fff
-	./gen_fff > fsk_fast_filter.h
-
-gen_fff : demod_afsk.c dsp.c textcolor.c
-	echo " " > tune.h
-	$(CC) $(CFLAGS) -DGEN_FFF -o $@ $^ $(LDFLAGS)
-
-
-#
-# 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
-# a file called tocalls.txt at application start up time.
-#
-# The original permanent symbols are built in but the "new" symbols,
-# using overlays, are often updated.  These are also read from files.
-#
-# You can obtain an updated copy by typing "make tocalls-symbols".
-# This is not part of the normal build process.  You have to do this explicitly.
-#
-# The locations below appear to be the most recent.
-# The copy at http://www.aprs.org/tocalls.txt is out of date.
-#
-
-.PHONY: tocalls-symbols
-tocalls-symbols :
-	cp tocalls.txt tocalls.txt~
-	wget http://www.aprs.org/aprs11/tocalls.txt -O tocalls.txt
-	-diff -Z tocalls.txt~ tocalls.txt
-	cp symbols-new.txt symbols-new.txt~
-	wget http://www.aprs.org/symbols/symbols-new.txt -O symbols-new.txt
-	-diff -Z symbols-new.txt~ symbols-new.txt
-	cp symbolsX.txt symbolsX.txt~
-	wget http://www.aprs.org/symbols/symbolsX.txt -O symbolsX.txt
-	-diff -Z symbolsX.txt~ symbolsX.txt
-
-
-# ---------------------------------------- Other utilities included ------------------------------
-
-
-# Separate application to decode raw data.
-
-# First three use .c rather than .o because they depend on DECAMAIN definition.
-
-decode_aprs : decode_aprs.c kiss_frame.c ax25_pad.c dwgpsnmea.o dwgps.o dwgpsd.o serial_port.o symbols.o textcolor.o fcs_calc.o latlong.o log.o telemetry.o tt_text.o misc.a
-	$(CC) $(CFLAGS) -DDECAMAIN -o $@ $^ $(LDFLAGS)
-
-
-
-# Convert between text and touch tone representation.
-
-text2tt : tt_text.c misc.a
-	$(CC) $(CFLAGS) -DENC_MAIN -o $@ $^ $(LDFLAGS)
-
-tt2text : tt_text.c misc.a
-	$(CC) $(CFLAGS) -DDEC_MAIN -o $@ $^ $(LDFLAGS)
-
-
-# Convert between Latitude/Longitude and UTM coordinates.
-
-ll2utm : ll2utm.c geotranz.a textcolor.o misc.a
-	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
-
-utm2ll : utm2ll.c geotranz.a textcolor.o misc.a
-	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
-
-
-# Convert from log file to GPX.
-
-log2gpx : log2gpx.c textcolor.o misc.a
-	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
-
-
-# Test application to generate sound.
-
-gen_packets : gen_packets.c ax25_pad.c hdlc_send.c fcs_calc.c gen_tone.c morse.c dtmf.c textcolor.c dsp.c misc.a
-	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
-
-# Unit test for AFSK demodulator
-
-atest : atest.c demod.o demod_afsk.o demod_psk.o demod_9600.o \
-		dsp.o hdlc_rec.o hdlc_rec2.o multi_modem.o rrbb.o \
-		fcs_calc.o ax25_pad.o decode_aprs.o dwgpsnmea.o \
-		dwgps.o dwgpsd.o serial_port.o telemetry.o dtime_now.o latlong.o symbols.o tt_text.o textcolor.o \
-		misc.a
-	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
-
-
-# Multiple AGWPE network or serial port clients to test TNCs side by side.
-
-aclients : aclients.c ax25_pad.c fcs_calc.c textcolor.o misc.a
-	$(CC) $(CFLAGS) -g -o $@ $^ 
-
-
-# Talk to a KISS TNC.
-# Note:  kiss_frame.c has conditional compilation on KISSUTIL.
-
-kissutil : kissutil.c kiss_frame.c ax25_pad.o fcs_calc.o textcolor.o serial_port.o dtime_now.o dwsock.o misc.a
-	$(CC) $(CFLAGS) -g -DKISSUTIL -o $@ $^ $(LDFLAGS)
-
-
-# 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
-	$(CC) $(CFLAGS) -g -DCM108_MAIN -o $@ $^ $(LDFLAGS)
-
-
-# Touch Tone to Speech sample application.
-
-ttcalc : ttcalc.o ax25_pad.o fcs_calc.o textcolor.o misc.a
-	$(CC) $(CFLAGS) -g -o $@ $^ 
-
-
-# -----------------------------------------  Libraries  --------------------------------------------
-
-# UTM, USNG, MGRS conversions.
-
-geotranz.a : error_string.o  mgrs.o  polarst.o  tranmerc.o  ups.o  usng.o  utm.o
-	ar -cr $@ $^
-
-error_string.o : geotranz/error_string.c
-	$(CC) $(CFLAGS) -c -o $@ $^
-
-mgrs.o : geotranz/mgrs.c
-	$(CC) $(CFLAGS) -c -o $@ $^
-
-polarst.o : geotranz/polarst.c
-	$(CC) $(CFLAGS) -c -o $@ $^
-
-tranmerc.o : geotranz/tranmerc.c
-	$(CC) $(CFLAGS) -c -o $@ $^
-
-ups.o : geotranz/ups.c
-	$(CC) $(CFLAGS) -c -o $@ $^
-
-usng.o : geotranz/usng.c
-	$(CC) $(CFLAGS) -c -o $@ $^
-
-utm.o : geotranz/utm.c
-	$(CC) $(CFLAGS) -c -o $@ $^
-
-
-# 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.
-# 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
-	ar -cr $@ $^	
- 
-strlcpy.o : misc/strlcpy.c
-	$(CC) $(CFLAGS) -I. -c -o $@ $^
-
-strlcat.o : misc/strlcat.c
-	$(CC) $(CFLAGS) -I. -c -o $@ $^
-
-endif
-
-
-# -------------------------------------  Installation  ----------------------------------
-
-
-
-# Generate apprpriate sample configuration file for this platform.
-# Originally, there was one sample for all platforms.  It got too cluttered
-# and confusing saying, this is for windows, and this is for Linux, and this ...
-# Trying to maintain 3 different versions in parallel is error prone.
-# We now have a single generic version which can be used to generate
-# the various platform specific versions.
-
-# generic.conf should be checked into source control.
-# 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
-	egrep '^C|^L' generic.conf | cut -c2-999 > direwolf.conf
-
-
-# Where should we install it?
-
-# Something built from source and installed locally would normally go in /usr/local/...
-# If not specified on the make command line, this is our default.
-
-DESTDIR ?= /usr/local
-
-# However, if you are preparing a "binary" DEB or RPM package, the installation location
-# would normally be  /usr/...  instead.   In this case, use a command line like this:
-#
-#	make  DESTDIR=/usr  install
-
-
-
-# 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}
-
-
-# direwolf.desktop was previously handcrafted for the Raspberry Pi.
-# It was hardcoded with lxterminal, /home/pi, and so on.
-# In version 1.2, try to customize this to match other situations better.
-
-# TODO:  Test this better.
-
-
-direwolf.desktop :
-	@echo "Generating customized direwolf.desktop ..."
-	@echo '[Desktop Entry]' > $@
-	@echo 'Type=Application' >> $@
-ifneq ($(wildcard ${PREFIX}/bin/lxterminal),)
-	@echo "Exec=lxterminal -t \"Dire Wolf\" -e \"$(DESTDIR)/bin/direwolf\"" >> $@
-else ifneq ($(wildcard ${PREFIX}/bin/lxterm),)
-	@echo "Exec=lxterm -hold -title \"Dire Wolf\" -bg white -e \"$(DESTDIR)/bin/direwolf\"" >> $@
-else
-	@echo "Exec=xterm -hold -title \"Dire Wolf\" -bg white -e \"$(DESTDIR)/bin/direwolf\"" >> $@
-endif
-	@echo 'Name=Dire Wolf' >> $@
-	@echo 'Comment=APRS Soundcard TNC' >> $@
-	@echo 'Icon=$(DESTDIR)/share/direwolf/pixmaps/dw-icon.png' >> $@
-	@echo "Path=$(HOME)" >> $@
-	@echo '#Terminal=true' >> $@
-	@echo 'Categories=HamRadio' >> $@
-	@echo 'Keywords=Ham Radio;APRS;Soundcard TNC;KISS;AGWPE;AX.25' >> $@
-
-
-# Installation into $(DESTDIR), usually /usr/local/... or /usr/...
-# Needs to be run as root or with sudo.
-
-
-.PHONY: install
-install : $(APPS) direwolf.conf tocalls.txt symbols-new.txt symbolsX.txt dw-icon.png direwolf.desktop
-#
-# Applications, not installed with package manager, normally go in /usr/local/bin.
-# /usr/bin is used instead when installing from .DEB or .RPM package.
-#
-	$(INSTALL_PROGRAM) direwolf $(DESTDIR)/bin/direwolf
-	$(INSTALL_PROGRAM) decode_aprs $(DESTDIR)/bin/decode_aprs
-	$(INSTALL_PROGRAM) text2tt $(DESTDIR)/bin/text2tt
-	$(INSTALL_PROGRAM) tt2text $(DESTDIR)/bin/tt2text
-	$(INSTALL_PROGRAM) ll2utm $(DESTDIR)/bin/ll2utm
-	$(INSTALL_PROGRAM) utm2ll $(DESTDIR)/bin/utm2ll
-	$(INSTALL_PROGRAM) aclients $(DESTDIR)/bin/aclients
-	$(INSTALL_PROGRAM) log2gpx $(DESTDIR)/bin/log2gpx
-	$(INSTALL_PROGRAM) gen_packets $(DESTDIR)/bin/gen_packets
-	$(INSTALL_PROGRAM) atest $(DESTDIR)/bin/atest
-	$(INSTALL_PROGRAM) ttcalc $(DESTDIR)/bin/ttcalc
-	$(INSTALL_PROGRAM) kissutil $(DESTDIR)/bin/kissutil
-	$(INSTALL_PROGRAM) cm108 $(DESTDIR)/bin/cm108
-	$(INSTALL_PROGRAM) dwespeak.sh $(DESTDIR)/bin/dwspeak.sh
-#
-# Telemetry Toolkit executables.   Other .conf and .txt files will go into doc directory.
-#
-	$(INSTALL_SCRIPT) telemetry-toolkit/telem-balloon.pl $(DESTDIR)/bin/telem-balloon.pl
-	$(INSTALL_SCRIPT) telemetry-toolkit/telem-bits.pl $(DESTDIR)/bin/telem-bits.pl
-	$(INSTALL_SCRIPT) telemetry-toolkit/telem-data.pl $(DESTDIR)/bin/telem-data.pl
-	$(INSTALL_SCRIPT) telemetry-toolkit/telem-data91.pl $(DESTDIR)/bin/telem-data91.pl
-	$(INSTALL_SCRIPT) telemetry-toolkit/telem-eqns.pl $(DESTDIR)/bin/telem-eqns.pl
-	$(INSTALL_SCRIPT) telemetry-toolkit/telem-parm.pl $(DESTDIR)/bin/telem-parm.pl
-	$(INSTALL_SCRIPT) telemetry-toolkit/telem-seq.sh $(DESTDIR)/bin/telem-seq.sh
-	$(INSTALL_SCRIPT) telemetry-toolkit/telem-unit.pl $(DESTDIR)/bin/telem-unit.pl
-	$(INSTALL_SCRIPT) telemetry-toolkit/telem-volts.py $(DESTDIR)/bin/telem-volts.py
-#
-# Misc. data such as "tocall" to system mapping.
-#
-	$(INSTALL_DATA) tocalls.txt $(DESTDIR)/share/direwolf/tocalls.txt
-	$(INSTALL_DATA) symbols-new.txt $(DESTDIR)/share/direwolf/symbols-new.txt
-	$(INSTALL_DATA) symbolsX.txt $(DESTDIR)/share/direwolf/symbolsX.txt
-#
-# For desktop icon.
-#
-	$(INSTALL_DATA) dw-icon.png $(DESTDIR)/share/direwolf/pixmaps/dw-icon.png
-	$(INSTALL_DATA) direwolf.desktop $(DESTDIR)/share/applications/direwolf.desktop
-#
-# Documentation.  Various plain text files and PDF.
-#
-	$(INSTALL_DATA) CHANGES.md $(DESTDIR)/share/doc/direwolf/CHANGES.md
-	$(INSTALL_DATA) LICENSE-dire-wolf.txt $(DESTDIR)/share/doc/direwolf/LICENSE-dire-wolf.txt
-	$(INSTALL_DATA) LICENSE-other.txt $(DESTDIR)/share/doc/direwolf/LICENSE-other.txt
-#
-# ./README.md is an overview for the project main page.
-# 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.
-#
-	$(INSTALL_DATA) doc/README.md $(DESTDIR)/share/doc/direwolf/README.md
-	$(INSTALL_DATA) doc/2400-4800-PSK-for-APRS-Packet-Radio.pdf $(DESTDIR)/share/doc/direwolf/2400-4800-PSK-for-APRS-Packet-Radio.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_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_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_DATA) doc/APRS-Telemetry-Toolkit.pdf $(DESTDIR)/share/doc/direwolf/APRS-Telemetry-Toolkit.pdf
-	$(INSTALL_DATA) doc/APRStt-Implementation-Notes.pdf $(DESTDIR)/share/doc/direwolf/APRStt-Implementation-Notes.pdf
-	$(INSTALL_DATA) doc/APRStt-interface-for-SARTrack.pdf $(DESTDIR)/share/doc/direwolf/APRStt-interface-for-SARTrack.pdf
-	$(INSTALL_DATA) doc/APRStt-Listening-Example.pdf $(DESTDIR)/share/doc/direwolf/APRStt-Listening-Example.pdf
-	$(INSTALL_DATA) doc/Bluetooth-KISS-TNC.pdf $(DESTDIR)/share/doc/direwolf/Bluetooth-KISS-TNC.pdf
-	$(INSTALL_DATA) doc/Going-beyond-9600-baud.pdf $(DESTDIR)/share/doc/direwolf/Going-beyond-9600-baud.pdf
-	$(INSTALL_DATA) doc/Raspberry-Pi-APRS.pdf $(DESTDIR)/share/doc/direwolf/Raspberry-Pi-APRS.pdf
-	$(INSTALL_DATA) doc/Raspberry-Pi-APRS-Tracker.pdf $(DESTDIR)/share/doc/direwolf/Raspberry-Pi-APRS-Tracker.pdf
-	$(INSTALL_DATA) doc/Raspberry-Pi-SDR-IGate.pdf $(DESTDIR)/share/doc/direwolf/Raspberry-Pi-SDR-IGate.pdf
-	$(INSTALL_DATA) doc/Successful-APRS-IGate-Operation.pdf $(DESTDIR)/share/doc/direwolf/Successful-APRS-IGate-Operation.pdf
-	$(INSTALL_DATA) doc/User-Guide.pdf $(DESTDIR)/share/doc/direwolf/User-Guide.pdf
-	$(INSTALL_DATA) doc/WA8LMF-TNC-Test-CD-Results.pdf $(DESTDIR)/share/doc/direwolf/WA8LMF-TNC-Test-CD-Results.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.
-# 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
-# the home directory or other desired location.
-#
-	$(INSTALL_DATA)   direwolf.conf $(DESTDIR)/share/doc/direwolf/examples/direwolf.conf
-	$(INSTALL_SCRIPT) dw-start.sh $(DESTDIR)/share/doc/direwolf/examples/dw-start.sh
-	$(INSTALL_DATA)   sdr.conf $(DESTDIR)/share/doc/direwolf/examples/sdr.conf
-	$(INSTALL_DATA)   telemetry-toolkit/telem-m0xer-3.txt $(DESTDIR)/share/doc/direwolf/examples/telem-m0xer-3.txt
-	$(INSTALL_DATA)   telemetry-toolkit/telem-balloon.conf $(DESTDIR)/share/doc/direwolf/examples/telem-balloon.conf
-	$(INSTALL_DATA)   telemetry-toolkit/telem-volts.conf $(DESTDIR)/share/doc/direwolf/examples/telem-volts.conf
-#
-# "man" pages
-#
-	$(INSTALL_MAN) man1/aclients.1 $(DESTDIR)/share/man/man1/aclients.1
-	$(INSTALL_MAN) man1/atest.1 $(DESTDIR)/share/man/man1/atest.1
-	$(INSTALL_MAN) man1/decode_aprs.1 $(DESTDIR)/share/man/man1/decode_aprs.1
-	$(INSTALL_MAN) man1/direwolf.1 $(DESTDIR)/share/man/man1/direwolf.1
-	$(INSTALL_MAN) man1/gen_packets.1 $(DESTDIR)/share/man/man1/gen_packets.1
-	$(INSTALL_MAN) man1/kissutil.1 $(DESTDIR)/share/man/man1/kissutil.1
-	$(INSTALL_MAN) man1/ll2utm.1 $(DESTDIR)/share/man/man1/ll2utm.1
-	$(INSTALL_MAN) man1/log2gpx.1 $(DESTDIR)/share/man/man1/log2gpx.1
-	$(INSTALL_MAN) man1/text2tt.1 $(DESTDIR)/share/man/man1/text2tt.1
-	$(INSTALL_MAN) man1/tt2text.1 $(DESTDIR)/share/man/man1/tt2text.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.
-# This will allow us to use the CM108/CM119 GPIO pins for PTT.
-# I don't think this is applicable to BSD.
-#
-ifeq ($(OS),Linux)
-	$(INSTALL_DATA) 99-direwolf-cmedia.rules /etc/udev/rules.d/99-direwolf-cmedia.rules
-endif
-#
-	@echo " "
-	@echo "If this is your first install, not an upgrade, type this to put a copy"
-	@echo "of the sample configuration file (direwolf.conf) in your home directory:"
-	@echo " "
-	@echo "        make install-conf"
-	@echo " "
-
-
-# Put sample configuration & startup files in home directory.
-# This step would be done as ordinary user.
-# Some people like to put the direwolf config file in /etc/ax25.
-# Note that all of these are also in $(DESTDIR)/share/doc/direwolf/examples/.
-
-# The Raspberry Pi has ~/Desktop but Ubuntu does not.
-
-# TODO: Handle Linux variations correctly.
-
-# Version 1.4 - Add "-n" option to avoid clobbering existing, probably customized, config files.
-
-# dw-start.sh is greatly improved in version 1.4.
-# It was moved from isntall-rpi to install-conf because it is not just for the RPi.
-
-.PHONY: install-conf
-install-conf : direwolf.conf
-	cp -n direwolf.conf ~
-	cp -n sdr.conf ~
-	cp -n telemetry-toolkit/telem-m0xer-3.txt ~
-	cp -n telemetry-toolkit/telem-*.conf ~
-	chmod +x dw-start.sh
-	cp -n dw-start.sh ~
-ifneq ($(wildcard $(HOME)/Desktop),)
-	@echo " "
-	@echo "This will add a desktop icon on some systems."
-	@echo "This is known to work on Raspberry Pi but might not be compatible with other desktops."
-	@echo " "
-	@echo "        make install-rpi"
-	@echo " "
-endif
-
-
-.PHONY: install-rpi
-install-rpi :
-ifeq ($(OS),Linux)
-	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  --------------------------------
-
-
-
-# Combine some unit tests into a single regression sanity check.
-
-
-check : dtest ttest tttexttest pftest tlmtest lltest enctest kisstest pad2test xidtest dtmftest check-modem1200 check-modem300 check-modem9600 check-modem19200 check-modem2400-a check-modem2400-b check-modem2400-g check-modem4800
-
-# Can we encode and decode at popular data rates?
-
-check-modem1200 : gen_packets atest
-	./gen_packets -n 100 -o /tmp/test12.wav
-	./atest -F0 -PE -L63 -G71 /tmp/test12.wav
-	./atest -F1 -PE -L70 -G75 /tmp/test12.wav
-	rm /tmp/test12.wav
-
-check-modem300 : gen_packets atest
-	./gen_packets -B300 -n 100 -o /tmp/test3.wav
-	./atest -B300 -F0 -L68 -G69 /tmp/test3.wav
-	./atest -B300 -F1 -L73 -G75 /tmp/test3.wav
-	rm /tmp/test3.wav
-
-check-modem9600 : gen_packets atest
-	./gen_packets -B9600 -n 100 -o /tmp/test96.wav
-	./atest -B9600 -F0 -L61 -G65 /tmp/test96.wav
-	./atest -B9600 -F1 -L62 -G66 /tmp/test96.wav
-	rm /tmp/test96.wav
-
-check-modem19200 : gen_packets atest
-	./gen_packets -r 96000 -B19200 -n 100 -o /tmp/test19.wav
-	./atest -B19200 -F0 -L60 -G64 /tmp/test19.wav
-	./atest -B19200 -F1 -L64 -G68 /tmp/test19.wav
-	rm /tmp/test19.wav
-
-check-modem2400-a : gen_packets atest
-	./gen_packets -B2400 -j -n 100 -o /tmp/test24-a.wav
-	./atest -B2400 -j -F0 -L76 -G80 /tmp/test24-a.wav
-	./atest -B2400 -j -F1 -L84 -G88 /tmp/test24-a.wav
-	rm /tmp/test24-a.wav
-
-check-modem2400-b : gen_packets atest
-	./gen_packets -B2400 -J -n 100 -o /tmp/test24-b.wav
-	./atest -B2400 -J -F0 -L79 -G83 /tmp/test24-b.wav
-	./atest -B2400 -J -F1 -L87 -G91 /tmp/test24-b.wav
-	rm /tmp/test24-b.wav
-
-check-modem2400-g : gen_packets atest
-	./gen_packets -B2400 -g -n 100 -o /tmp/test24-g.wav
-	./atest -B2400 -g -F0 -L99 -G100 /tmp/test24-g.wav
-	rm /tmp/test24-g.wav
-
-check-modem4800 : gen_packets atest
-	./gen_packets -B4800 -n 100 -o /tmp/test48.wav
-	./atest -B4800 -F0 -L70 -G74 /tmp/test48.wav
-	./atest -B4800 -F1 -L79 -G84 /tmp/test48.wav
-	rm /tmp/test48.wav
-
-
-# Unit test for inner digipeater algorithm
-
-.PHONY : dtest
-dtest : digipeater.c dedupe.c pfilter.c \
-		ax25_pad.o fcs_calc.o tq.o textcolor.o \
-		decode_aprs.o dwgpsnmea.o dwgps.o dwgpsd.o serial_port.o latlong.o telemetry.o symbols.o tt_text.o misc.a
-	$(CC) $(CFLAGS) -DDIGITEST -o $@ $^ $(LDFLAGS)
-	./dtest
-	rm dtest
-
-
-# Unit test for APRStt tone sequence parsing.
-
-.PHONY : ttest
-ttest : aprs_tt.c tt_text.c latlong.o textcolor.o misc.a geotranz.a misc.a
-	$(CC) $(CFLAGS) -DTT_MAIN  -o $@ $^ $(LDFLAGS)
-	./ttest
-	rm ttest
-
-
-# Unit test for APRStt tone sequence / text conversions.
-
-.PHONY: tttexttest
-tttexttest : tt_text.c textcolor.o misc.a
-	$(CC) $(CFLAGS) -DTTT_TEST -o $@ $^ $(LDFLAGS)
-	./tttexttest
-	rm tttexttest
-
-
-# Unit test for Packet Filtering.
-
-.PHONY: pftest
-pftest : pfilter.c ax25_pad.o textcolor.o fcs_calc.o decode_aprs.o dwgpsnmea.o dwgps.o dwgpsd.o serial_port.o latlong.o symbols.o telemetry.o tt_text.o misc.a 
-	$(CC) $(CFLAGS) -DPFTEST -o $@ $^ $(LDFLAGS)
-	./pftest
-	rm pftest
-
-# Unit test for telemetry decoding.
-
-.PHONY: tlmtest
-tlmtest : telemetry.c ax25_pad.o fcs_calc.o textcolor.o misc.a
-	$(CC) $(CFLAGS) -DTEST -o $@ $^ $(LDFLAGS)
-	./tlmtest
-	rm tlmtest
-
-# Unit test for location coordinate conversion.
-
-.PHONY: lltest
-lltest : latlong.c textcolor.o misc.a
-	$(CC) $(CFLAGS) -DLLTEST -o $@ $^ $(LDFLAGS)
-	./lltest
-	rm lltest
-
-# Unit test for encoding position & object report.
-
-.PHONY: enctest
-enctest : encode_aprs.c latlong.c textcolor.c misc.a
-	$(CC) $(CFLAGS) -DEN_MAIN -o $@ $^ $(LDFLAGS)
-	./enctest
-	rm enctest
-
-
-# Unit test for KISS encapsulation.
-
-.PHONY: kisstest
-kisstest : kiss_frame.c
-	$(CC) $(CFLAGS) -DKISSTEST -o $@ $^ $(LDFLAGS)
-	./kisstest
-	rm kisstest
-
-# Unit test for constructing frames besides UI.
-
-.PHONY: pad2test
-pad2test : ax25_pad2.c ax25_pad.c fcs_calc.o textcolor.o misc.a
-	$(CC) $(CFLAGS) -DPAD2TEST -o $@ $^ $(LDFLAGS)
-	./pad2test
-	rm pad2test
-
-
-# Unit Test for XID frame encode/decode.
-
-.PHONY: xidtest
-xidtest : xid.c textcolor.o misc.a
-	$(CC) $(CFLAGS) -DXIDTEST -o $@ $^  $(LDFLAGS)
-	./xidtest
-	rm xidtest
-
-
-# Unit Test for DTMF encode/decode.
-
-.PHONY: dtmftest
-dtmftest : dtmf.c textcolor.o
-	$(CC) $(CFLAGS) -DDTMF_TEST -o $@ $^  $(LDFLAGS)
-	./dtmftest
-	rm dtmftest
-
-
-
-#  -----------------------------  Manual tests and experiments  ---------------------------
-
-# These are not included in a normal build.  Might be broken.
-
-# Unit test for IGate
-
-itest : igate.c textcolor.c ax25_pad.c fcs_calc.c textcolor.o misc.a
-	$(CC) $(CFLAGS) -DITEST -o $@ $^
-	./itest
-
-# Unit test for UDP reception with AFSK demodulator.
-# Temporary during development.  Might not be useful anymore.
-
-udptest : udp_test.c demod.o dsp.o demod_afsk.o demod_psk.o demod_9600.o hdlc_rec.o hdlc_rec2.o multi_modem.o rrbb.o \
-		fcs_calc.o ax25_pad.o decode_aprs.o symbols.o textcolor.o misc.a
-	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
-	./udptest
-
-# For demodulator tweaking experiments.
-# Dependencies of demod*.c, rather than .o, are intentional.
-
-demod.o      : tune.h
-
-demod_afsk.o : tune.h
-
-demod_9600.o : tune.h
-
-demod_psk.o  : tune.h
-
-tune.h :
-	echo " " > tune.h
-
-
-testagc : atest.c demod.c dsp.c demod_afsk.c demod_psk.c demod_9600.c hdlc_rec.o hdlc_rec2.o multi_modem.o rrbb.o \
-		fcs_calc.o ax25_pad.o decode_aprs.o telemetry.o dtime_now.o latlong.o symbols.o tune.h textcolor.o misc.a
-	$(CC) $(CFLAGS) -o atest $^ $(LDFLAGS)
-	./atest 02_Track_2.wav | grep "packets decoded in" > atest.out
-
-
-testagc96 : atest.c fsk_fast_filter.h tune.h demod.c demod_afsk.c demod_psk.c demod_9600.c \
-		dsp.o hdlc_rec.o hdlc_rec2.o multi_modem.o \
-		rrbb.o fcs_calc.o ax25_pad.o decode_aprs.o \
-		dwgpsnmea.o dwgps.o dwgpsd.o serial_port.o latlong.o \
-		symbols.o tt_text.o textcolor.o telemetry.o dtime_now.o \
-		misc.a
-	rm -f atest96
-	$(CC) $(CFLAGS) -o atest96 $^ $(LDFLAGS)
-	./atest96 -B 9600 ../walkabout9600c.wav | grep "packets decoded in" >atest.out
-	#./atest96 -B 9600 noisy96.wav | grep "packets decoded in" >atest.out
-	#./atest96 -B 9600 19990303_0225_9600_8bis_22kHz.wav | grep "packets decoded in" >atest.out
-	#./atest96 -B 9600  19990303_0225_9600_16bit_22kHz.wav | grep "packets decoded in" >atest.out
-	#./atest96 -B 9600 -P + z8-22k.wav| grep "packets decoded in" >atest.out
-	#./atest96 -B 9600 test9600.wav | grep "packets decoded in" >atest.out
-	echo " " > tune.h
-
-
-# -----------------------------------------------------------------------------------------
-
-
-.PHONY: clean
-clean :
-	rm -f $(APPS) gen_fff tune.h fsk_fast_filter.h *.o *.a direwolf.desktop
-
-
-depend : $(wildcard *.c)
-	makedepend -f $(lastword $(MAKEFILE_LIST)) -- $(CFLAGS) -- $^
-
-
-#
-# The following is updated by "make depend"
-#
-# DO NOT DELETE
-
-
diff --git a/Makefile.macosx b/Makefile.macosx
deleted file mode 100644
index 9f3ff59d..00000000
--- a/Makefile.macosx
+++ /dev/null
@@ -1,563 +0,0 @@
-#
-# Makefile for Macintosh 10.6+ version of Dire Wolf.
-#
-
-# TODO: This is a modified version of Makefile.linux and it
-# has fallen a little behind.  For example, it is missing the check target.
-# It would be more maintainable if we could use a single file for both.
-# The differences are not that great.
-# Maybe the most of the differences could go in to platform specific include
-# files rather than cluttering it up with too many if blocks.
-
-# Changes:
-#
-# 16 Dec 2015
-# 1. Added condition check for gps/gpsd code. Commented out due to 32/64 bit
-#    library issues. Macports gpsd build problem.
-# 2. SDK version checks are now performed by a bash script 'search_sdks.sh'.
-#    This should resolve the varied locations Apple stored the SDKs on the different
-#    Xcode/OS versions. Executing 'make' on the first pass asks the operator
-#    which SDK he/she wishes to use. Executing 'make clean' resets the SDK
-#    selection and operator intervention is once again required. Selected SDK
-#    information resides in a file named './use_this_sdk' in the current working
-#    directory.
-# 3. Removed fsk_fast_filter.h from atest receipe, clang compiler was having
-#    a hissy fit. Not check with GCC.
-
-# Where should we install it?
-# Looks for libraries and includes, default is Homebrew
-INSTALLDIR := /usr/local
-
-# To use Macports, uncomment this line
-#INSTALLDIR := /opt/local
-
-APPS := direwolf decode_aprs text2tt tt2text ll2utm utm2ll aclients atest log2gpx gen_packets ttcalc kissutil
-
-all :  $(APPS) direwolf.conf
-	@echo " "
-	@echo "Next step install with: "
-	@echo " "
-	@echo "      sudo make install"
-	@echo " "
-	@echo " "
-
-SYS_LIBS :=
-SYS_MIN :=
-
-SYS_LIBS := $(shell ./search_sdks.sh)
-EXTRA_CFLAGS :=
-DARWIN_CC := $(shell which clang)
-ifeq (${DARWIN_CC},)
-DARWIN_CC := $(shell which gcc)
-EXTRA_CFLAGS :=
-else
-EXTRA_CFLAGS := -fvectorize -fslp-vectorize -pthread
-endif
-
-# Change as required in support of the available libraries
-
-UNAME_M := $(shell uname -m)
-ifeq (${UNAME_M},x86_64)
-CC := $(DARWIN_CC) -m64 $(SYS_LIBS) $(SYS_MIN)
-else
-CC := $(DARWIN_CC) -m32 $(SYS_LIBS) $(SYS_MIN)
-endif
-
-# _XOPEN_SOURCE=600 and _DEFAULT_SOURCE=1 are needed for glibc >= 2.24.
-# Explanation here:  https://github.com/wb2osz/direwolf/issues/62
-
-CFLAGS := -Os -pthread -Igeotranz -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE=1 $(EXTRA_CFLAGS)
-
-# That was fine for a recent Ubuntu and Raspbian Jessie.
-# However, Raspbian wheezy was then missing declaration for strsep and definition of fd_set.
-
-CFLAGS += -D_BSD_SOURCE
-
-
-# $(info $$CC is [${CC}])
-
-
-# If the compiler is generating code for a 32 bit target (-m32), we can
-# get much better results by telling it we have at least a Pentium 3
-# which hass the SSE instructions.
-
-#CFLAGS += -march=core2 -msse4.1 -std=gnu99
-#CFLAGS += -march=pentium3 -sse
-CFLAGS += -march=native
-
-
-# Add -ffastmath in only if compiler version recognizes it.
-
-useffast := $(shell gcc --help -v 2>/dev/null | grep ffast-math)
-ifneq ($(useffast),)
-CFLAGS += -ffast-math
-endif
-
-#CFLAGS += -D_FORTIFY_SOURCE
-
-# Use PortAudio Library
-
-# Force static linking of portaudio if the static library is available.
-PA_LIB_STATIC := $(shell find $(INSTALLDIR)/lib -maxdepth 1 -type f -name "libportaudio.a")
-#$(info $$PA_LIB_STATIC is [${PA_LIB_STATIC}])
-ifeq (${PA_LIB_STATIC},)
-LDLIBS += -L$(INSTALLDIR)/lib -lportaudio
-else
-LDLIBS += $(INSTALLDIR)/lib/libportaudio.a
-endif
-
-# Include libraries portaudio requires.
-LDLIBS += -framework CoreAudio -framework AudioUnit -framework AudioToolbox
-LDLIBS += -framework Foundation -framework CoreServices
-
-CFLAGS += -DUSE_PORTAUDIO -I$(INSTALLDIR)/include
-
-# Uncomment following lines to enable GPS interface & tracker function.
-# Not available for MacOSX (as far as I know).
-# Although MacPorts has gpsd, wonder if it's the same thing. Add the check
-# just in case it works.
-# Well never mind, issue with Macports with 64bit libs ;-( leave the check in
-# until (if ever) Macports fixes the issue.
-
-#GPS_HEADER := $(shell find $(INSTALLDIR)/include -maxdepth 1 -type f -name "gps.h")
-#ifeq (${GPS_HEADER},)
-#GPS_OBJS :=
-#else
-#CFLAGS += -DENABLE_GPSD
-#LDLIBS += -L$(INSTALLDIR)/lib -lgps -lgpsd
-#GPS_OBJS := dwgps.o dwgpsnmea.o dwgpsd.o
-#endif
-
-# Name of current directory.
-# Used to generate zip file name for distribution.
-
-z := $(notdir ${CURDIR})
-
-
-# Main application.
-
-direwolf : direwolf.o aprs_tt.o audio_portaudio.o audio_stats.o ax25_link.o ax25_pad.o  ax25_pad2.o beacon.o \
-		config.o decode_aprs.o dedupe.o demod_9600.o demod_afsk.o demod_psk.o \
-		demod.o digipeater.o cdigipeater.o dlq.o dsp.o dtime_now.o dtmf.o dwgps.o \
-		encode_aprs.o encode_aprs.o fcs_calc.o fcs_calc.o gen_tone.o \
-		geotranz.a hdlc_rec.o hdlc_rec2.o hdlc_send.o igate.o kiss_frame.o \
-		kiss.o kissserial.o kissnet.o latlong.o latlong.o log.o morse.o multi_modem.o \
-		waypoint.o serial_port.o pfilter.o ptt.o rdq.o recv.o rrbb.o server.o \
-		symbols.o telemetry.o textcolor.o tq.o tt_text.o tt_user.o xid.o xmit.o \
-		dwgps.o dwgpsnmea.o mheard.o
-	$(CC) $(CFLAGS) -o $@ $^ -lpthread $(LDLIBS) -lm
-
-
-# Optimization for slow processors.
-
-demod.o      : fsk_fast_filter.h
-
-demod_afsk.o : fsk_fast_filter.h
-
-
-fsk_fast_filter.h : gen_fff
-	./gen_fff > fsk_fast_filter.h
-
-gen_fff : demod_afsk.c dsp.c textcolor.c
-	echo " " > tune.h
-	$(CC) $(CFLAGS) -DGEN_FFF -o $@ $^ $(LDFLAGS)
-
-
-
-# UTM, USNG, MGRS conversions.
-
-geotranz.a : error_string.o  mgrs.o  polarst.o  tranmerc.o  ups.o  usng.o  utm.o
-	ar -cr $@ $^
-
-error_string.o : geotranz/error_string.c
-	$(CC) $(CFLAGS) -c -o $@ $^
-
-mgrs.o : geotranz/mgrs.c
-	$(CC) $(CFLAGS) -c -o $@ $^
-
-polarst.o : geotranz/polarst.c
-	$(CC) $(CFLAGS) -c -o $@ $^
-
-tranmerc.o : geotranz/tranmerc.c
-	$(CC) $(CFLAGS) -c -o $@ $^
-
-ups.o : geotranz/ups.c
-	$(CC) $(CFLAGS) -c -o $@ $^
-
-usng.o : geotranz/usng.c
-	$(CC) $(CFLAGS) -c -o $@ $^
-
-utm.o : geotranz/utm.c
-	$(CC) $(CFLAGS) -c -o $@ $^
-
-
-
-# Generate apprpriate sample configuration file for this platform.
-
-direwolf.conf : generic.conf
-	egrep '^C|^M' generic.conf | cut -c2-999 > direwolf.conf
-
-
-# Where should we install it?
-# Macports typically installs in /opt/local so maybe you want to use that instead.
-
-INSTALLDIR := /usr/local
-#INSTALLDIR := /opt/local
-
-# TODO:  Test this better.
-
-# Optional installation into INSTALLDIR.
-# Needs to be run as root or with sudo.
-
-# Command to "install" to system directories.  "install" for Linux.  "ginstall" for Mac.
-
-INSTALL=ginstall
-
-.PHONY: install
-install : $(APPS) direwolf.conf tocalls.txt symbols-new.txt symbolsX.txt dw-icon.png
-#
-# Applications.
-#
-	$(INSTALL) direwolf $(INSTALLDIR)/bin
-	$(INSTALL) decode_aprs $(INSTALLDIR)/bin
-	$(INSTALL) text2tt $(INSTALLDIR)/bin
-	$(INSTALL) tt2text $(INSTALLDIR)/bin
-	$(INSTALL) ll2utm $(INSTALLDIR)/bin
-	$(INSTALL) utm2ll $(INSTALLDIR)/bin
-	$(INSTALL) aclients $(INSTALLDIR)/bin
-	$(INSTALL) log2gpx $(INSTALLDIR)/bin
-	$(INSTALL) gen_packets $(INSTALLDIR)/bin
-	$(INSTALL) atest $(INSTALLDIR)/bin
-	$(INSTALL) ttcalc $(INSTALLDIR)/bin
-	$(INSTALL) kissutil $(INSTALLDIR)/bin
-	$(INSTALL) dwespeak.sh $(INSTALLDIR)/bin
-#
-# Telemetry Toolkit executables.   Other .conf and .txt files will go into doc directory.
-#
-	$(INSTALL) telemetry-toolkit/telem-balloon.pl $(INSTALLDIR)/bin
-	$(INSTALL) telemetry-toolkit/telem-bits.pl $(INSTALLDIR)/bin
-	$(INSTALL) telemetry-toolkit/telem-data.pl $(INSTALLDIR)/bin
-	$(INSTALL) telemetry-toolkit/telem-data91.pl $(INSTALLDIR)/bin
-	$(INSTALL) telemetry-toolkit/telem-eqns.pl $(INSTALLDIR)/bin
-	$(INSTALL) telemetry-toolkit/telem-parm.pl $(INSTALLDIR)/bin
-	$(INSTALL) telemetry-toolkit/telem-unit.pl $(INSTALLDIR)/bin
-	$(INSTALL) telemetry-toolkit/telem-volts.py $(INSTALLDIR)/bin
-#
-# Misc. data such as "tocall" to system mapping.
-#
-	$(INSTALL) -D --mode=644 tocalls.txt $(INSTALLDIR)/share/direwolf/tocalls.txt
-	$(INSTALL) -D --mode=644 symbols-new.txt $(INSTALLDIR)/share/direwolf/symbols-new.txt
-	$(INSTALL) -D --mode=644 symbolsX.txt $(INSTALLDIR)/share/direwolf/symbolsX.txt
-	$(INSTALL) -D --mode=644 dw-icon.png $(INSTALLDIR)/share/direwolf/dw-icon.png
-
-#
-# Documentation.  Various plain text files and PDF.
-#
-	$(INSTALL) -D --mode=644 README.md $(INSTALLDIR)/share/doc/direwolf/README.md
-	$(INSTALL) -D --mode=644 CHANGES.md $(INSTALLDIR)/share/doc/direwolf/CHANGES.md
-	$(INSTALL) -D --mode=644 LICENSE-dire-wolf.txt $(INSTALLDIR)/share/doc/direwolf/LICENSE-dire-wolf.txt
-	$(INSTALL) -D --mode=644 LICENSE-other.txt $(INSTALLDIR)/share/doc/direwolf/LICENSE-other.txt
-#
-# ./README.md is an overview for the project main page.
-# doc/README.md contains an overview of the PDF file contents and is more useful here.
-#
-	$(INSTALL) -D --mode=644 doc/README.md $(INSTALLDIR)/share/doc/direwolf/README.md
-	$(INSTALL) -D --mode=644 doc/2400-4800-PSK-for-APRS-Packet-Radio.pdf $(INSTALLDIR)/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 $(INSTALLDIR)/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 $(INSTALLDIR)/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 $(INSTALLDIR)/share/doc/direwolf/A-Closer-Look-at-the-WA8LMF-TNC-Test-CD.pdf
-	$(INSTALL) -D --mode=644 doc/APRS-Telemetry-Toolkit.pdf $(INSTALLDIR)/share/doc/direwolf/APRS-Telemetry-Toolkit.pdf
-	$(INSTALL) -D --mode=644 doc/APRStt-Implementation-Notes.pdf $(INSTALLDIR)/share/doc/direwolf/APRStt-Implementation-Notes.pdf
-	$(INSTALL) -D --mode=644 doc/APRStt-interface-for-SARTrack.pdf $(INSTALLDIR)/share/doc/direwolf/APRStt-interface-for-SARTrack.pdf
-	$(INSTALL) -D --mode=644 doc/APRStt-Listening-Example.pdf $(INSTALLDIR)/share/doc/direwolf/APRStt-Listening-Example.pdf
-	$(INSTALL) -D --mode=644 doc/Bluetooth-KISS-TNC.pdf $(INSTALLDIR)/share/doc/direwolf/Bluetooth-KISS-TNC.pdf
-	$(INSTALL) -D --mode=644 doc/Going-beyond-9600-baud.pdf $(INSTALLDIR)/share/doc/direwolf/Going-beyond-9600-baud.pdf
-	$(INSTALL) -D --mode=644 doc/Raspberry-Pi-APRS.pdf $(INSTALLDIR)/share/doc/direwolf/Raspberry-Pi-APRS.pdf
-	$(INSTALL) -D --mode=644 doc/Raspberry-Pi-APRS-Tracker.pdf $(INSTALLDIR)/share/doc/direwolf/Raspberry-Pi-APRS-Tracker.pdf
-	$(INSTALL) -D --mode=644 doc/Raspberry-Pi-SDR-IGate.pdf $(INSTALLDIR)/share/doc/direwolf/Raspberry-Pi-SDR-IGate.pdf
-	$(INSTALL) -D --mode=644 doc/Successful-APRS-IGate-Operation.pdf $(INSTALLDIR)/share/doc/direwolf/Successful-APRS-IGate-Operation.pdf
-	$(INSTALL) -D --mode=644 doc/User-Guide.pdf $(INSTALLDIR)/share/doc/direwolf/User-Guide.pdf
-	$(INSTALL) -D --mode=644 doc/WA8LMF-TNC-Test-CD-Results.pdf $(INSTALLDIR)/share/doc/direwolf/WA8LMF-TNC-Test-CD-Results.pdf
-#
-# Sample config files also go into the doc directory.
-# 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
-# the home directory or other desired location.
-# Someone suggested that these could go into an "examples" subdirectory under doc.
-#
-	$(INSTALL) -D --mode=644 direwolf.conf $(INSTALLDIR)/share/doc/direwolf/direwolf.conf
-	$(INSTALL) -D --mode=644 telemetry-toolkit/telem-m0xer-3.txt $(INSTALLDIR)/share/doc/direwolf/telem-m0xer-3.txt
-	$(INSTALL) -D --mode=644 telemetry-toolkit/telem-balloon.conf $(INSTALLDIR)/share/doc/direwolf/telem-balloon.conf
-	$(INSTALL) -D --mode=644 telemetry-toolkit/telem-volts.conf $(INSTALLDIR)/share/doc/direwolf/telem-volts.conf
-#
-# "man" pages
-#
-	$(INSTALL) -D --mode=644 man1/aclients.1 $(INSTALLDIR)/man/man1/aclients.1
-	$(INSTALL) -D --mode=644 man1/atest.1 $(INSTALLDIR)/man/man1/atest.1
-	$(INSTALL) -D --mode=644 man1/decode_aprs.1 $(INSTALLDIR)/man/man1/decode_aprs.1
-	$(INSTALL) -D --mode=644 man1/direwolf.1 $(INSTALLDIR)/man/man1/direwolf.1
-	$(INSTALL) -D --mode=644 man1/gen_packets.1 $(INSTALLDIR)/man/man1/gen_packets.1
-	$(INSTALL) -D --mode=644 man1/ll2utm.1 $(INSTALLDIR)/man/man1/ll2utm.1
-	$(INSTALL) -D --mode=644 man1/log2gpx.1 $(INSTALLDIR)/man/man1/log2gpx.1
-	$(INSTALL) -D --mode=644 man1/text2tt.1 $(INSTALLDIR)/man/man1/text2tt.1
-	$(INSTALL) -D --mode=644 man1/tt2text.1 $(INSTALLDIR)/man/man1/tt2text.1
-	$(INSTALL) -D --mode=644 man1/utm2ll.1 $(INSTALLDIR)/man/man1/utm2ll.1
-#
-	@echo " "
-	@echo "If this is your first install, not an upgrade, type this to put a copy"
-	@echo "of the sample configuration file (direwolf.conf) in your home directory:"
-	@echo " "
-	@echo "        make install-conf"
-	@echo " "
-
-
-# TODO:  Should we put the sample direwolf.conf file somewhere like
-# /usr/share/doc/direwolf/examples and add that to the
-# end of the search path list?
-# That would make it easy to see user customizations compared to the
-# latest sample.
-
-# These would be done as ordinary user.
-
-
-.PHONY: install-conf
-install-conf : direwolf.conf
-	cp direwolf.conf ~
-	cp telemetry-toolkit/telem-m0xer-3.txt ~
-	cp telemetry-toolkit/telem-*.conf ~
-
-
-# Separate application to decode raw data.
-
-# First three use .c rather than .o because they depend on DECAMAIN definition.
-
-decode_aprs : decode_aprs.c kiss_frame.c ax25_pad.c  dwgpsnmea.o dwgps.o dwgpsd.o serial_port.o symbols.o textcolor.o fcs_calc.o latlong.o log.o telemetry.o tt_text.o
-	$(CC) $(CFLAGS) -DDECAMAIN -o $@ $^ -lm
-
-# Convert between text and touch tone representation.
-
-text2tt : tt_text.c
-	$(CC) $(CFLAGS) -DENC_MAIN -o $@ $^
-
-tt2text : tt_text.c
-	$(CC) $(CFLAGS) -DDEC_MAIN -o $@ $^
-
-
-# Convert between Latitude/Longitude and UTM coordinates.
-
-ll2utm : ll2utm.c geotranz.a
-	$(CC) $(CFLAGS) -o $@ $^ -lm
-
-utm2ll : utm2ll.c geotranz.a
-	$(CC) $(CFLAGS) -o $@ $^ -lm
-
-
-# Convert from log file to GPX.
-
-log2gpx : log2gpx.c
-	$(CC) $(CFLAGS) -o $@ $^ -lm
-
-
-# Test application to generate sound.
-
-gen_packets : gen_packets.c ax25_pad.c hdlc_send.c fcs_calc.c gen_tone.c morse.c dtmf.c textcolor.c dsp.c
-	$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS) -lm
-
-demod.o      : tune.h
-
-demod_afsk.o : tune.h
-
-demod_9600.o : tune.h
-
-demod_psk.o  : tune.h
-
-tune.h :
-	echo " " > tune.h
-
-
-testagc : atest.c demod.c dsp.c demod_afsk.c demod_9600.c hdlc_rec.c hdlc_rec2.o multi_modem.o rrbb.o \
-        fcs_calc.c ax25_pad.c decode_aprs.c telemetry.c dtime_now.o latlong.c symbols.c tune.h textcolor.c
-	$(CC) $(CFLAGS) -o atest $^ -lm
-	./atest 02_Track_2.wav | grep "packets decoded in" > atest.out
-
-
-# Unit test for demodulators
-
-atest : atest.c demod.c dsp.c demod_afsk.c demod_psk.c demod_9600.c hdlc_rec.c hdlc_rec2.o multi_modem.o rrbb.o \
-        fcs_calc.c ax25_pad.c decode_aprs.c dwgpsnmea.o dwgps.o serial_port.o telemetry.c dtime_now.o latlong.c symbols.c textcolor.c tt_text.c
-	$(CC) $(CFLAGS) -o $@ $^ -lm
-#atest : atest.c fsk_fast_filter.h demod.c dsp.c demod_afsk.c demod_psk.c demod_9600.c hdlc_rec.c hdlc_rec2.o multi_modem.o rrbb.o \
-#        fcs_calc.c ax25_pad.c decode_aprs.c dwgpsnmea.o dwgps.o serial_port.o telemetry.c latlong.c symbols.c textcolor.c tt_text.c
-#	$(CC) $(CFLAGS) -o $@ $^ -lm
-
-# Unit test for inner digipeater algorithm
-
-
-dtest : digipeater.c pfilter.o ax25_pad.o dedupe.o fcs_calc.o tq.o textcolor.o \
-		decode_aprs.o dwgpsnmea.o dwgps.o serial_port.o latlong.o telemetry.o symbols.o tt_text.o
-	$(CC) $(CFLAGS) -DTEST -o $@ $^
-	./dtest
-
-
-# Unit test for APRStt.
-
-ttest : aprs_tt.c tt_text.c  latlong.c geotranz.a
-	$(CC) $(CFLAGS) -DTT_MAIN  -o $@ $^
-
-
-# Unit test for IGate
-
-
-itest : igate.c textcolor.c ax25_pad.c fcs_calc.c
-	$(CC) $(CFLAGS) -DITEST -o $@ $^
-	./itest
-
-
-# Unit test for UDP reception with AFSK demodulator
-
-udptest : udp_test.c demod.c dsp.c demod_afsk.c demod_9600.c hdlc_rec.c hdlc_rec2.c multi_modem.c rrbb.c fcs_calc.c ax25_pad.c decode_aprs.c symbols.c textcolor.c
-	$(CC) $(CFLAGS) -o $@ $^ -lm
-	./udptest
-
-
-# Unit test for telemetry decoding.
-
-
-tlmtest : telemetry.c ax25_pad.c fcs_calc.c textcolor.c
-	$(CC) $(CFLAGS) -o $@ $^ -lm
-	./tlmtest
-
-
-# Multiple AGWPE network or serial port clients to test TNCs side by side.
-
-aclients : aclients.c ax25_pad.c fcs_calc.c textcolor.c
-	$(CC) $(CFLAGS) -g -o $@ $^
-
-
-# Talk to a KISS TNC.
-# Note:  kiss_frame.c has conditional compilation on KISSUTIL.
-
-kissutil : kissutil.c kiss_frame.c ax25_pad.o fcs_calc.o textcolor.o serial_port.o dtime_now.o dwsock.o
-	$(CC) $(CFLAGS) -g -DKISSUTIL -o $@ $^
-
-
-
-# Touch Tone to Speech sample application.
-
-ttcalc : ttcalc.o ax25_pad.o fcs_calc.o textcolor.o
-	$(CC) $(CFLAGS) -g -o $@ $^
-
-
-depend : $(wildcard *.c)
-	makedepend -f $(lastword $(MAKEFILE_LIST)) -- $(CFLAGS) -- $^
-
-
-.PHONY: clean
-clean :
-	rm -f $(APPS) gen_fff \
-		fsk_fast_filter.h *.o *.a use_this_sdk
-	echo " " > tune.h
-
-
-.PHONY: dist-mac
-dist-mac: direwolf decode_aprs text2tt tt2text ll2utm utm2ll aclients log2gpx gen_packets \
-		tocalls.txt symbols-new.txt symbolsX.txt dw-icon.png
-	rm -f ../direwolf_dist_bin.zip
-	(cd .. ; zip direwolf_dist_bin.zip \
-	$(INSTALLDIR)/bin/direwolf \
-	$(INSTALLDIR)/bin/decode_aprs \
-	$(INSTALLDIR)/bin/text2tt \
-	$(INSTALLDIR)/bin/tt2text \
-	$(INSTALLDIR)/bin/ll2utm \
-	$(INSTALLDIR)/bin/utm2ll \
-	$(INSTALLDIR)/bin/aclients \
-	$(INSTALLDIR)/bin/log2gpx \
-	$(INSTALLDIR)/bin/gen_packets \
-	$(INSTALLDIR)/bin/atest \
-	$(INSTALLDIR)/bin/ttcalc \
-	$(INSTALLDIR)/bin/kissutil \
-	$(INSTALLDIR)/bin/dwespeak.sh \
-	$(INSTALLDIR)/share/direwolf/tocalls.txt \
-	$(INSTALLDIR)/share/direwolf/config/direwolf.conf \
-	$(INSTALLDIR)/share/direwolf/symbols-new.txt \
-	$(INSTALLDIR)/share/direwolf/symbolsX.txt \
-	$(INSTALLDIR)/share/direwolf/dw-icon.png \
-	$(INSTALLDIR)/share/doc/direwolf/README.md \
-	$(INSTALLDIR)/share/doc/direwolf/CHANGES.md \
-	$(INSTALLDIR)/share/doc/direwolf/LICENSE-dire-wolf.txt \
-	$(INSTALLDIR)/share/doc/direwolf/LICENSE-other.txt \
-	$(INSTALLDIR)/share/doc/direwolf/User-Guide.pdf \
-	$(INSTALLDIR)/share/doc/direwolf/Raspberry-Pi-APRS.pdf \
-	$(INSTALLDIR)/share/doc/direwolf/Raspberry-Pi-APRS-Tracker.pdf \
-	$(INSTALLDIR)/share/doc/direwolf/APRStt-Implementation-Notes.pdf \
-	$(INSTALLDIR)/share/doc/direwolf/APRS-Telemetry-Toolkit.pdf \
-	$(INSTALLDIR)/man/man1/aclients.1 \
-	$(INSTALLDIR)/man/man1/atest.1 \
-	$(INSTALLDIR)/man/man1/decode_aprs.1 \
-	$(INSTALLDIR)/man/man1/direwolf.1 \
-	$(INSTALLDIR)/man/man1/gen_packets.1 \
-	$(INSTALLDIR)/man/man1/kissutil.1 \
-	$(INSTALLDIR)/man/man1/ll2utm.1 \
-	$(INSTALLDIR)/man/man1/log2gpx.1 \
-	$(INSTALLDIR)/man/man1/text2tt.1 \
-	$(INSTALLDIR)/man/man1/tt2text.1 \
-	$(INSTALLDIR)/man/man1/utm2ll.1 \
-	)
-
-# Package it up for distribution.
-
-.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/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/* )
-
-
-#
-# The destination field is often used to identify the manufacturer/model.
-# These are not hardcoded into Dire Wolf.  Instead they are read from
-# a file called tocalls.txt at application start up time.
-#
-# The original permanent symbols are built in but the "new" symbols,
-# using overlays, are often updated.  These are also read from files.
-#
-# You can obtain an updated copy by typing "make tocalls-symbols".
-# This is not part of the normal build process.  You have to do this explicitly.
-#
-# The locations below appear to be the most recent.
-# The copy at http://www.aprs.org/tocalls.txt is out of date.
-#
-
-.PHONY: tocalls-symbols
-tocalls-symbols :
-	cp tocalls.txt tocalls.txt~
-	wget http://www.aprs.org/aprs11/tocalls.txt -O tocalls.txt
-	-diff -Z tocalls.txt~ tocalls.txt
-	cp symbols-new.txt symbols-new.txt~
-	wget http://www.aprs.org/symbols/symbols-new.txt -O symbols-new.txt
-	-diff -Z symbols-new.txt~ symbols-new.txt
-	cp symbolsX.txt symbolsX.txt~
-	wget http://www.aprs.org/symbols/symbolsX.txt -O symbolsX.txt
-	-diff -Z symbolsX.txt~ symbolsX.txt
diff --git a/Makefile.win b/Makefile.win
deleted file mode 100644
index c3f14970..00000000
--- a/Makefile.win
+++ /dev/null
@@ -1,727 +0,0 @@
-#
-# Makefile for native Windows version of Dire Wolf.
-#
-#
-# This is built in the Cygwin environment with the MinGW compiler.
-# MinGW is a special version of gcc that generates native Windows executables.
-#
-# A minimum of Windows XP is required due to some of the system
-# features being used.  XP requires a Pentium processor or later.
-# The DSP filters can be sped up considerably with the SSE instructions.
-# The SSE instructions were introduced in 1999 with the Pentium III series.
-# SSE2 instructions, added in 2000, with the Pentium 4, don't seem to offer any advantage.
-
-
-
-all : direwolf decode_aprs text2tt tt2text ll2utm utm2ll aclients log2gpx gen_packets atest ttcalc kissutil
-# tnctest tnctest-issue-132
-
-
-
-# October 2019, version 1.6:  64 bit target for Windows.  It runs twice as fast!
-# Originally I installed MinGW outside of Cygwin and added location to PATH in .bash_profile.
-# Install these two Cygwin packages so the compiler is in /usr/bin
-# and no special PATH is required.
-#	mingw64-x86_64-gcc-core (7.4.0-1)
-#	mingw64-x86_64-gcc-g++ (7.4.0-1)
-
-CC ?= x86_64-w64-mingw32-gcc
-CXX ?= x86_64-w64-mingw32-g++
-AR ?= x86_64-w64-mingw32-ar
-WINDRES ?= x86_64-w64-mingw32-windres
-
-# MinGW requires "-mthreads" option for threadsafe operation.
-
-CFLAGS := -Ofast -Iregex -Iutm -Igeotranz -mthreads -DUSE_REGEX_STATIC -Wall -Wlogical-op
-
-# For a 32 bit target, install these Cygwin packages.
-#	mingw64-i686gcc-core (7.4.0-1)
-#	mingw64-i686gcc-g++ (7.4.0-1)
-# i686 corresponds to Pentium II.
-# We need to add Pentium III and SSE instructions to speed things up.
-# Pentium 4 and SSE2 offers no advantage so no reason to bump up minimum CPU requirement.
-# Code for the 64 bit target runs about twice as fast, so use that if possible.
-
-#CC = i686-w64-mingw32-gcc
-#CXX = i686-w64-mingw32-g++
-#AR = i686-w64-mingw32-ar
-#WINDRES = i686-w64-mingw32-windres
-#CFLAGS += -march=pentium3 -msse
-
-
-CFLAGS += -g
-# TEMP EXPERIMENT - DO NOT RELEASE
-#CFLAGS += -fsanitize=undefined
-
-# For version 1.4, we upgrade from gcc 4.6.2 to 4.9.3.
-
-# gcc 4.8 adds these.  Try them just for fun.
-# No, it needs libasan which is not on Windows.
-#CFLAGS += -fsanitize=address -fno-omit-frame-pointer
-
-# Helpful for the demodulators.  Overkill for non-hot spots.
-#CFLAGS += -Wdouble-promotion
-
-# Don't have the patience for this right now.
-#CFLAGS += -Wextra
-
-# Continue working on these.
-CFLAGS += -Wsign-compare
-CFLAGS += -Wuninitialized
-CFLAGS += -Wold-style-declaration
-CFLAGS += -Wnull-dereference
-CFLAGS += -fdelete-null-pointer-checks
-#CFLAGS += -Wmissing-prototypes
-#CFLAGS += -Wold-style-definition
-
-
-
-
-# --------------------------------------  Main application   --------------------------------
-
-# Not sure why this is here.
-
-demod.o      : fsk_demod_state.h
-
-demod_9600.o : fsk_demod_state.h
-
-demod_afsk.o : fsk_demod_state.h
-
-demod_psk.o  : fsk_demod_state.h
-
-
-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 \
-		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 \
-		gen_tone.o morse.o audio_win.o audio_stats.o digipeater.o cdigipeater.o pfilter.o dedupe.o tq.o xmit.o \
-		ptt.o beacon.o dwgps.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 \
-		dwgps.o dwgpsnmea.o dtime_now.o mheard.o ax25_link.o cm108.c \
-		dw-icon.o regex.a misc.a geotranz.a
-	$(CC) $(CFLAGS) -o $@ $^ -lwinmm -lws2_32
-
-dw-icon.o : dw-icon.rc dw-icon.ico
-	$(WINDRES) dw-icon.rc -o $@
-
-
-# Optimization for slow processors.
-
-demod.o : fsk_fast_filter.h
-
-demod_afsk.o : fsk_fast_filter.h
-
-
-fsk_fast_filter.h : gen_fff
-	./gen_fff > fsk_fast_filter.h
-
-gen_fff : demod_afsk.c dsp.c textcolor.c
-	echo " " > tune.h
-	$(CC) $(CFLAGS) -DGEN_FFF -o $@ $^
-
-
-#
-# The destination field is often used to identify the manufacturer/model.
-# These are not hardcoded into Dire Wolf.  Instead they are read from
-# a file called tocalls.txt at application start up time.
-#
-# The original permanent symbols are built in but the "new" symbols,
-# using overlays, are often updated.  These are also read from files.
-#
-# You can obtain an updated copy by typing "make tocalls-symbols".
-# This is not part of the normal build process.  You have to do this explicitly.
-#
-# The locations below appear to be the most recent.
-# The copy at http://www.aprs.org/tocalls.txt is out of date.
-#
-
-.PHONY: tocalls-symbols
-tocalls-symbols :
-	cp tocalls.txt tocalls.txt~
-	wget http://www.aprs.org/aprs11/tocalls.txt -O tocalls.txt
-	-diff tocalls.txt~ tocalls.txt
-	cp symbols-new.txt symbols-new.txt~
-	wget http://www.aprs.org/symbols/symbols-new.txt -O symbols-new.txt
-	-diff symbols-new.txt~ symbols-new.txt
-	cp symbolsX.txt symbolsX.txt~
-	wget http://www.aprs.org/symbols/symbolsX.txt -O symbolsX.txt
-	-diff symbolsX.txt~ symbolsX.txt
-
-
-
-# ----------------------------  Other utilities included with distribution  -------------------------
-
-
-# Separate application to decode raw data.
-
-# First three use .c rather than .o because they depend on DECAMAIN definition.
-
-decode_aprs : decode_aprs.c kiss_frame.c ax25_pad.c dwgpsnmea.o dwgps.o serial_port.o symbols.o  textcolor.o fcs_calc.o latlong.o log.o telemetry.o tt_text.o regex.a misc.a geotranz.a
-	$(CC) $(CFLAGS) -DDECAMAIN -o decode_aprs $^
-
-
-# Convert between text and touch tone representation.
-
-text2tt : tt_text.c misc.a
-	$(CC) $(CFLAGS) -DENC_MAIN -o $@ $^
-
-tt2text : tt_text.c misc.a
-	$(CC) $(CFLAGS) -DDEC_MAIN -o $@ $^
-
-
-# Convert between Latitude/Longitude and UTM coordinates.
-
-ll2utm : ll2utm.c textcolor.c geotranz.a misc.a
-	$(CC) $(CFLAGS) -o $@ $^
-
-utm2ll : utm2ll.c textcolor.c geotranz.a misc.a
-	$(CC) $(CFLAGS) -o $@ $^
-
-
-# Convert from log file to GPX.
-
-log2gpx : log2gpx.c textcolor.o misc.a
-	$(CC) $(CFLAGS) -o $@ $^
-
-
-# Test application to generate sound.
-
-gen_packets : gen_packets.o  ax25_pad.o hdlc_send.o fcs_calc.o gen_tone.o morse.o dtmf.o textcolor.o dsp.o misc.a regex.a
-	$(CC) $(CFLAGS) -o $@ $^
-
-
-
-# Connected mode sample applications for talking to network TNC with AGW protocol.
-
-appserver : appserver.o agwlib.o dwsock.o textcolor.o dtime_now.o misc.a
-	$(CC) $(CFLAGS) -o $@ $^ -lwinmm -lws2_32
-
-
-# -------------------------------------------  Libraries  --------------------------------------------
-
-
-
-# UTM, USNG, MGRS conversions.
-
-geotranz.a : error_string.o  mgrs.o  polarst.o  tranmerc.o  ups.o  usng.o  utm.o
-	$(AR) -cr $@ $^
-
-error_string.o : geotranz/error_string.c
-	$(CC) $(CFLAGS) -c -o $@ $^
-
-mgrs.o : geotranz/mgrs.c
-	$(CC) $(CFLAGS) -c -o $@ $^
-
-polarst.o : geotranz/polarst.c
-	$(CC) $(CFLAGS) -c -o $@ $^
-
-tranmerc.o : geotranz/tranmerc.c
-	$(CC) $(CFLAGS) -c -o $@ $^
-
-ups.o : geotranz/ups.c
-	$(CC) $(CFLAGS) -c -o $@ $^
-
-usng.o : geotranz/usng.c
-	$(CC) $(CFLAGS) -c -o $@ $^
-
-utm.o : geotranz/utm.c
-	$(CC) $(CFLAGS) -c -o $@ $^
-
-
-#
-# When building for Linux, we use regular expression
-# functions supplied by the gnu C library.
-# For the native WIN32 version, we need to use our own copy.
-# These were copied from http://gnuwin32.sourceforge.net/packages/regex.htm
-# Consider upgrading from https://www.gnu.org/software/libc/sources.html
-
-regex.a : regex.o
-	$(AR) -cr $@ $^
- 
-regex.o : regex/regex.c
-	$(CC) $(CFLAGS) -Dbool=int -Dtrue=1 -Dfalse=0 -c -o $@ $^
-
-
-
-# There are several string functions found in Linux
-# but not on Windows.  Need to provide our own copy.
-
-misc.a : strsep.o strtok_r.o strcasestr.o strlcpy.o strlcat.o
-	$(AR) -cr $@ $^
- 
-strsep.o : misc/strsep.c
-	$(CC) $(CFLAGS) -c -o $@ $^
-
-strtok_r.o : misc/strtok_r.c
-	$(CC) $(CFLAGS) -c -o $@ $^
-
-strcasestr.o : misc/strcasestr.c
-	$(CC) $(CFLAGS) -c -o $@ $^
-
-strlcpy.o : misc/strlcpy.c
-	$(CC) $(CFLAGS) -I. -c -o $@ $^
-
-strlcat.o : misc/strlcat.c
-	$(CC) $(CFLAGS) -I. -c -o $@ $^
-
-
-# ---------------------------------  Automated Smoke Test  --------------------------------
-
-
-# Combine some unit tests into a single regression sanity check.
-
-check : dtest ttest tttexttest pftest tlmtest lltest enctest kisstest pad2test xidtest dtmftest check-modem1200 check-modem300 check-modem9600 check-modem19200 check-modem2400-a check-modem2400-b check-modem2400-g check-modem4800
-
-# Can we encode and decode at popular data rates?
-# Verify that single bit fixup increases the count.
-
-check-modem1200 : gen_packets atest
-	gen_packets -n 100 -o test12.wav
-	atest -F0 -PE -L64 -G72 test12.wav
-	atest -F1 -PE -L70 -G75 test12.wav
-	rm test12.wav
-
-check-modem300 : gen_packets atest
-	gen_packets -B300 -n 100 -o test3.wav
-	atest -B300 -F0 -L68 -G69 test3.wav
-	atest -B300 -F1 -L71 -G75 test3.wav
-	rm test3.wav
-
-#FIXME: test full amplitude.
-
-check-modem9600 : gen_packets atest
-	gen_packets -B9600 -a 170 -o test96.wav
-	sleep 1
-	atest -B9600 -F0 -L4 -G4 test96.wav
-	sleep 1
-	rm test96.wav
-	sleep 1
-	gen_packets -B9600 -n 100 -o test96.wav
-	sleep 1
-	atest -B9600 -F0 -L61 -G65 test96.wav
-	atest -B9600 -F1 -L62 -G66 test96.wav
-	sleep 1
-	rm test96.wav
-
-check-modem19200 : gen_packets atest
-	gen_packets -r 96000 -B19200 -a 170 -o test19.wav
-	sleep 1
-	atest -B19200 -F0 -L4 test19.wav
-	sleep 1
-	rm test19.wav
-	sleep 1
-	gen_packets -r 96000 -B19200 -n 100 -o test19.wav
-	sleep 1
-	atest -B19200 -F0 -L60 -G64 test19.wav
-	atest -B19200 -F1 -L64 -G68 test19.wav
-	sleep 1
-	rm test19.wav
-
-check-modem2400-a : gen_packets atest
-	gen_packets -B2400 -j -n 100 -o test24-a.wav
-	sleep 1
-	atest -B2400 -j -F0 -L76 -G80 test24-a.wav
-	atest -B2400 -j -F1 -L84 -G88 test24-a.wav
-	sleep 1
-	rm test24-a.wav
-
-check-modem2400-b : gen_packets atest
-	gen_packets -B2400 -J -n 100 -o test24-b.wav
-	sleep 1
-	atest -B2400 -J -F0 -L79 -G83 test24-b.wav
-	atest -B2400 -J -F1 -L87 -G91 test24-b.wav
-	sleep 1
-	rm test24-b.wav
-
-check-modem2400-g : gen_packets atest
-	gen_packets -B2400 -g -n 100 -o test24-g.wav
-	sleep 1
-	atest -B2400 -g -F0 -L99 -G100 test24-g.wav
-	sleep 1
-	rm test24-g.wav
-
-check-modem4800 : gen_packets atest
-	gen_packets -B4800 -n 100 -o test48.wav
-	sleep 1
-	atest -B4800 -F0 -L70 -G74 test48.wav
-	atest -B4800 -F1 -L79 -G84 test48.wav
-	sleep 1
-	rm test48.wav
-
-
-# Unit test for demodulators
-
-atest : atest.c fsk_fast_filter.h demod.c demod_afsk.c demod_psk.c demod_9600.c \
-		dsp.o hdlc_rec.o hdlc_rec2.o multi_modem.o \
-		rrbb.o fcs_calc.o ax25_pad.o decode_aprs.o \
-		dwgpsnmea.o dwgps.o serial_port.o latlong.c \
-		symbols.c tt_text.c textcolor.c telemetry.c dtime_now.o \
-		decode_aprs.o log.o \
-		misc.a regex.a
-	echo " " > tune.h
-	$(CC) $(CFLAGS) -o $@ $^
-	#./atest ..\\direwolf-0.2\\02_Track_2.wav
-	#atest -B 9600 z9.wav
-	#atest za100.wav
-
-atest9 : atest.c demod.c dsp.c demod_afsk.c demod_psk.c demod_9600.c hdlc_rec.c hdlc_rec2.c multi_modem.c \
-		rrbb.c fcs_calc.c ax25_pad.c decode_aprs.c latlong.c symbols.c textcolor.c telemetry.c dtime_now.o misc.a regex.a \
-		fsk_fast_filter.h
-	echo " " > tune.h
-	$(CC) $(CFLAGS) -o $@ $^
-	./atest9 -B 9600 ../walkabout9600.wav | grep "packets decoded in" >atest.out
-	#./atest9 -B 9600 noise96.wav
-
-
-# Unit test for inner digipeater algorithm
-
-.PHONY: dtest
-dtest : digipeater.c dedupe.c pfilter.c \
-		ax25_pad.o fcs_calc.o tq.o textcolor.o \
-		decode_aprs.o dwgpsnmea.o dwgps.o serial_port.o latlong.o telemetry.o symbols.o tt_text.o misc.a regex.a
-	$(CC) $(CFLAGS) -DDIGITEST -o $@ $^
-	./dtest
-	rm dtest.exe
-
-# Unit test for APRStt tone seqence parsing.
-
-.PHONTY: ttest
-ttest : aprs_tt.c tt_text.c latlong.o textcolor.o geotranz.a misc.a
-	$(CC) $(CFLAGS) -Igeotranz -DTT_MAIN  -o $@ $^
-	./ttest
-	rm ttest.exe
-
-# Unit test for APRStt tone sequence / text conversions.
-
-.PHONY: tttexttest
-tttexttest : tt_text.c textcolor.o misc.a
-	$(CC) $(CFLAGS) -DTTT_TEST -o $@ $^
-	./tttexttest
-	rm tttexttest.exe
-
-# Unit test for Packet Filtering.
-
-.PHONY: pftest
-pftest : pfilter.c ax25_pad.o textcolor.o fcs_calc.o decode_aprs.o dwgpsnmea.o dwgps.o serial_port.o latlong.o symbols.o telemetry.o tt_text.o misc.a regex.a
-	$(CC) $(CFLAGS) -DPFTEST -o $@ $^
-	./pftest
-	rm pftest.exe
-
-
-
-# Unit test for telemetry decoding.
-
-.PHONY: tlmtest
-tlmtest : telemetry.c ax25_pad.o fcs_calc.o textcolor.o misc.a regex.a
-	$(CC) $(CFLAGS) -DTEST -o $@ $^
-	./tlmtest
-	rm tlmtest.exe
-
-
-# Unit test for location coordinate conversion.
-
-.PHONY: lltest
-lltest : latlong.c textcolor.o misc.a
-	$(CC) $(CFLAGS) -DLLTEST -o $@ $^
-	./lltest
-	rm lltest.exe
-
-# Unit test for encoding position & object report.
-
-.PHONY: enctest
-enctest : encode_aprs.c latlong.c textcolor.c misc.a
-	$(CC) $(CFLAGS) -DEN_MAIN -o $@ $^
-	./enctest
-	rm enctest.exe
-
-
-# Unit test for KISS encapsulation.
-
-.PHONY: kisstest
-kisstest : kiss_frame.c
-	$(CC) $(CFLAGS) -DKISSTEST -o $@ $^
-	./kisstest
-	rm kisstest.exe
-
-
-# Unit test for constructing frames besides UI.
-
-.PHONY: pad2test
-pad2test : ax25_pad2.c ax25_pad.c fcs_calc.o textcolor.o regex.a misc.a
-	$(CC) $(CFLAGS) -DPAD2TEST -o $@ $^
-	./pad2test
-	rm pad2test.exe
-
-# Unit Test for XID frame encode/decode.
-
-.PHONY: xidtest
-xidtest : xid.c textcolor.o misc.a
-	$(CC) $(CFLAGS) -DXIDTEST -o $@ $^
-	./xidtest
-	rm xidtest.exe
-
-# Unit Test for DTMF encode/decode.
-
-.PHONY: dtmftest
-dtmftest : dtmf.c textcolor.o
-	$(CC) $(CFLAGS) -DDTMF_TEST -o $@ $^
-	./dtmftest
-	rm dtmftest.exe
-
-
-# ------------------------------ Other manual testing & experimenting  -------------------------------
-
-
-tnctest : tnctest.c textcolor.o dtime_now.o serial_port.o misc.a
-	$(CC) $(CFLAGS) -o $@ $^ -lwinmm -lws2_32
-
-tnctest-issue-132 : tnctest-issue-132.c textcolor.o dtime_now.o serial_port.o misc.a
-	$(CC) $(CFLAGS) -o $@ $^ -lwinmm -lws2_32
-
-
-# For tweaking the demodulator.
-
-demod.o      : tune.h
-demod_9600.o : tune.h
-demod_afsk.o : tune.h
-demod_psk.o  : tune.h
-
-testagc : atest.c demod.c dsp.c demod_afsk.c demod_psk.c demod_9600.o fsk_demod_agc.h \
-		hdlc_rec.o hdlc_rec2.o multi_modem.o \
-		rrbb.o fcs_calc.o ax25_pad.o decode_aprs.o latlong.o symbols.o textcolor.o telemetry.o \
-		dwgpsnmea.o dwgps.o serial_port.o tt_text.o dtime_now.o regex.a misc.a
-	rm -f atest.exe
-	$(CC) $(CFLAGS) -o atest $^
-	./atest -P H+ -F 0 ../01_Track_1.wav ../02_Track_2.wav | grep "packets decoded in" >atest.out
-	echo " " > tune.h
-
-
-noisy3.wav : gen_packets
-	./gen_packets -B 300 -n 100 -o noisy3.wav
-
-testagc3 : atest.c demod.c dsp.c demod_afsk.c demod_psk.c demod_9600.c hdlc_rec.c hdlc_rec2.c multi_modem.c \
-		rrbb.c fcs_calc.c ax25_pad.c decode_aprs.c latlong.c symbols.c textcolor.c telemetry.c dtime_now.o regex.a misc.a \
-		tune.h 
-	rm -f atest3.exe
-	$(CC) $(CFLAGS) -o atest3 $^
-	./atest3 -B 300 -P D -D 3 noisy3.wav | grep "packets decoded in" >atest.out
-	echo " " > tune.h
-
-
-noisy96.wav : gen_packets
-	./gen_packets -B 9600 -n 100 -o noisy96.wav
-
-testagc96 : atest.c fsk_fast_filter.h tune.h demod.c demod_afsk.c demod_psk.c demod_9600.c \
-		dsp.o hdlc_rec.o hdlc_rec2.o multi_modem.o \
-		rrbb.o fcs_calc.o ax25_pad.o decode_aprs.o \
-		dwgpsnmea.o dwgps.o serial_port.o latlong.o \
-		symbols.o tt_text.o textcolor.o telemetry.o dtime_now.o \
-		misc.a regex.a
-	rm -f atest96.exe
-	$(CC) $(CFLAGS) -o atest96 $^
-	./atest96 -B 9600 ../walkabout9600c.wav noisy96.wav zzz16.wav zzz16.wav zzz16.wav zzz8.wav zzz8.wav zzz8.wav | grep "packets decoded in" >atest.out
-	#./atest96 -B 9600 ../walkabout9600c.wav | grep "packets decoded in" >atest.out
-	#./atest96 -B 9600 zzz16.wav zzz8.wav | grep "packets decoded in" >atest.out
-	#./atest96 -B 9600 noisy96.wav | grep "packets decoded in" >atest.out
-	#./atest96 -B 9600 19990303_0225_9600_8bis_22kHz.wav | grep "packets decoded in" >atest.out
-	#./atest96 -B 9600  19990303_0225_9600_16bit_22kHz.wav | grep "packets decoded in" >atest.out
-	#./atest96 -B 9600 -P + z8-22k.wav| grep "packets decoded in" >atest.out
-	#./atest96 -B 9600 test9600.wav | grep "packets decoded in" >atest.out
-	echo " " > tune.h
-
-testagc24 : atest.c fsk_fast_filter.h tune.h demod.c demod_afsk.c demod_psk.c demod_9600.c \
-		dsp.o hdlc_rec.o hdlc_rec2.o multi_modem.o \
-		rrbb.o fcs_calc.o ax25_pad.o decode_aprs.o \
-		dwgpsnmea.o dwgps.o serial_port.o latlong.o \
-		symbols.o tt_text.o textcolor.o telemetry.o dtime_now.o \
-		misc.a regex.a
-	rm -f atest24.exe
-	sleep 1
-	$(CC) $(CFLAGS) -o atest24mfj $^
-	./atest24 -B 2400 test2400.wav | grep "packets decoded in" >atest.out
-	echo " " > tune.h
-
-testagc24mfj : atest.c fsk_fast_filter.h tune.h demod.c demod_afsk.c demod_psk.c demod_9600.c \
-		dsp.o hdlc_rec.o hdlc_rec2.o multi_modem.o \
-		rrbb.o fcs_calc.o ax25_pad.o decode_aprs.o \
-		dwgpsnmea.o dwgps.o serial_port.o latlong.o \
-		symbols.o tt_text.o textcolor.o telemetry.o dtime_now.o \
-		misc.a regex.a
-	rm -f atest24mfj.exe
-	sleep 1
-	$(CC) $(CFLAGS) -o atest24mfj $^
-	./atest24mfj -F 1 -B 2400 ../ref-doc/MFJ-2400-PSK/2k4_short.wav
-	echo " " > tune.h
-
-testagc48 : atest.c fsk_fast_filter.h tune.h demod.c demod_afsk.c demod_psk.c demod_9600.c \
-		dsp.o hdlc_rec.o hdlc_rec2.o multi_modem.o \
-		rrbb.o fcs_calc.o ax25_pad.o decode_aprs.o \
-		dwgpsnmea.o dwgps.o serial_port.o latlong.o \
-		symbols.o tt_text.o textcolor.o telemetry.o dtime_now.o \
-		misc.a regex.a
-	rm -f atest48.exe
-	sleep 1
-	$(CC) $(CFLAGS) -o atest48 $^
-	./atest48 -B 4800 test4800.wav | grep "packets decoded in" >atest.out
-	#./atest48 -B 4800 test4800.wav 
-	echo " " > tune.h
-
-
-# Unit test for IGate
-
-itest : igate.c textcolor.c ax25_pad.c fcs_calc.c misc.a regex.a
-	$(CC) $(CFLAGS) -DITEST -o $@ $^ -lwinmm -lws2_32
-
-
-
-
-
-# Multiple AGWPE network or serial port clients to test TNCs side by side.
-
-aclients : aclients.c ax25_pad.c fcs_calc.c textcolor.c misc.a regex.a
-	$(CC) $(CFLAGS) -o $@ $^ -lwinmm -lws2_32
-
-
-# Talk to a KISS TNC.
-
-# Note:  kiss_frame.c has conditional compilation on KISSUTIL.
-
-kissutil : kissutil.c kiss_frame.c ax25_pad.o fcs_calc.o textcolor.o serial_port.o dwsock.o dtime_now.o misc.a regex.a
-	$(CC) $(CFLAGS) -DKISSUTIL -o $@ $^ -lwinmm -lws2_32
-
-
-mqtest : aprsmsg.c kiss_frame.c encode_aprs.o ax25_pad.o fcs_calc.o textcolor.o serial_port.o dwsock.o dtime_now.o latlong.o misc.a regex.a
-	$(CC) $(CFLAGS) -DMQTEST -DKISSUTIL -o $@ $^ -lwinmm -lws2_32
-
-
-
-# Touch Tone to Speech sample application.
-
-ttcalc : ttcalc.o ax25_pad.o fcs_calc.o textcolor.o misc.a regex.a
-	$(CC) $(CFLAGS) -o $@ $^ -lwinmm -lws2_32
-
-
-# Send GPS location to KISS TNC each second.
-
-walk96 : walk96.c dwgps.o dwgpsnmea.o kiss_frame.o \
-		latlong.o encode_aprs.o serial_port.o textcolor.o \
-		ax25_pad.o fcs_calc.o \
-		xmit.o hdlc_send.o gen_tone.o ptt.o tq.o \
-		hdlc_rec.o hdlc_rec2.o rrbb.o dsp.o audio_win.o \
-		multi_modem.o demod.o demod_afsk.o demod_psk.c demod_9600.o rdq.o \
-		server.o morse.o dtmf.o audio_stats.o dtime_now.o dlq.o \
-		regex.a misc.a 
-	$(CC) $(CFLAGS) -DWALK96 -o $@ $^ -lwinmm -lws2_32
-
-
-
-
-#--------------------------------------------------------------
-
-
-.PHONY: depend
-depend : $(wildcard *.c)
-	makedepend -f $(lastword $(MAKEFILE_LIST)) -- $(CFLAGS) -- $^
-
-.PHONY: clean
-clean :
-	rm -f *.o *.a *.exe fsk_fast_filter.h noisy96.wav
-	echo " " > tune.h
-
-
-
-# -------------------------------  Packaging for distribution  ----------------------
-
-# Name of zip file for distribution.
-
-z := $(notdir ${CURDIR})
-
-
-.PHONY: dist-win
-dist-win : direwolf.exe decode_aprs.exe text2tt.exe tt2text.exe ll2utm.exe utm2ll.exe \
-			aclients.exe log2gpx.exe gen_packets.exe atest.exe ttcalc.exe kissutil.exe \
-		 	generic.conf dwespeak.bat \
-			README.md CHANGES.md \
-			doc/User-Guide.pdf \
-			doc/Raspberry-Pi-APRS.pdf \
-			doc/APRStt-Implementation-Notes.pdf 
-	rm -f ../$z-win.zip
-	egrep '^C|^W' generic.conf | cut -c2-999 > direwolf.conf
-	unix2dos direwolf.conf
-	cp doc/README.md README-doc.md
-	zip --junk-paths ../$z-win.zip \
-		README.md \
-		CHANGES.md \
-		README-doc.md \
-		doc/2400-4800-PSK-for-APRS-Packet-Radio.pdf \
-		doc/A-Better-APRS-Packet-Demodulator-Part-1-1200-baud.pdf \
-		doc/A-Better-APRS-Packet-Demodulator-Part-2-9600-baud.pdf \
-		doc/A-Closer-Look-at-the-WA8LMF-TNC-Test-CD.pdf \
-		doc/APRS-Telemetry-Toolkit.pdf \
-		doc/APRStt-Implementation-Notes.pdf \
-		doc/APRStt-interface-for-SARTrack.pdf \
-		doc/APRStt-Listening-Example.pdf \
-		doc/Bluetooth-KISS-TNC.pdf \
-		doc/Going-beyond-9600-baud.pdf \
-		doc/Raspberry-Pi-APRS.pdf \
-		doc/Raspberry-Pi-APRS-Tracker.pdf \
-		doc/Raspberry-Pi-SDR-IGate.pdf \
-		doc/Successful-APRS-IGate-Operation.pdf \
-		doc/User-Guide.pdf \
-		doc/WA8LMF-TNC-Test-CD-Results.pdf \
-		doc/Why-is-9600-only-twice-as-fast-as-1200.pdf \
-		LICENSE* \
-		direwolf.conf \
-		direwolf.exe \
-		decode_aprs.exe \
-		tocalls.txt symbols-new.txt symbolsX.txt \
-		text2tt.exe tt2text.exe \
-		ll2utm.exe utm2ll.exe \
-		aclients.exe \
-		log2gpx.exe \
-		gen_packets.exe \
-		atest.exe \
-		ttcalc.exe \
-		kissutil.exe \
-		dwespeak.bat \
-		telemetry-toolkit/*
-	rm README-doc.md
-
-
-# Reminders if pdf files are not up to date.
-
-doc/User-Guide.pdf : doc/User-Guide.docx
-	echo "***** User-Guide.pdf is out of date *****"
-
-doc/Raspberry-Pi-APRS.pdf : doc/Raspberry-Pi-APRS.docx
-	echo "***** Raspberry-Pi-APRS.pdf is out of date *****" 
-
-doc/Raspberry-Pi-APRS-Tracker.pdf : doc/Raspberry-Pi-APRS-Tracker.docx
-	echo "***** Raspberry-Pi-APRS-Tracker.pdf is out of date *****" 
-
-doc/APRStt-Implementation-Notes.pdf : doc/APRStt-Implementation-Notes.docx
-	echo "***** APRStt-Implementation-Notes.pdf is out of date *****"
-
-doc/A-Better-APRS-Packet-Demodulator-Part-1-1200-baud.pdf : doc/A-Better-APRS-Packet-Demodulator-Part-1-1200-baud.docx
-	echo "***** A-Better-APRS-Packet-Demodulator-Part-1-1200-baud.pdf is out of date *****"
-
-doc/A-Better-APRS-Packet-Demodulator-Part-2-9600-baud.pdf : doc/A-Better-APRS-Packet-Demodulator-Part-2-9600-baud.docx
-	echo "***** A-Better-APRS-Packet-Demodulator-Part-2-9600-baud.pdf is out of date *****"
-
-doc/APRS-Telemetry-Toolkit.pdf : doc/APRS-Telemetry-Toolkit.docx
-	echo "***** APRS-Telemetry-Toolkit.pdf is out of date *****"
-
-
-
-.PHONY: backup
-backup :
-	mkdir /cygdrive/e/backup-cygwin-home/`date +"%Y-%m-%d"`
-	cp -r . /cygdrive/e/backup-cygwin-home/`date +"%Y-%m-%d"`
-
-
-#
-# The following is updated by "make depend"
-#
-# DO NOT DELETE
-
-
diff --git a/cmake/cpack/CMakeLists.txt b/cmake/cpack/CMakeLists.txt
new file mode 100644
index 00000000..845c377c
--- /dev/null
+++ b/cmake/cpack/CMakeLists.txt
@@ -0,0 +1 @@
+include(CPack)
diff --git a/cmake/cpack/direwolf.desktop.in b/cmake/cpack/direwolf.desktop.in
new file mode 100644
index 00000000..79c63aa6
--- /dev/null
+++ b/cmake/cpack/direwolf.desktop.in
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Name=@APPLICATION_NAME@
+Comment=APRS Soundcard TNC
+Exec=@APPLICATION_DESKTOP_EXEC@
+Icon=@CMAKE_PROJECT_NAME@_icon.png
+StartupNotify=true
+Terminal=false
+Type=Application
+Categories=HamRadio
+Keywords=Ham Radio;APRS;Soundcard TNC;KISS;AGWPE;AX.25
\ No newline at end of file
diff --git a/cmake/cpack/direwolf.rc b/cmake/cpack/direwolf.rc
new file mode 100644
index 00000000..99de6d9f
--- /dev/null
+++ b/cmake/cpack/direwolf.rc
@@ -0,0 +1 @@
+MAINICON ICON "direwolf_icon.ico"
\ No newline at end of file
diff --git a/dw-icon.ico b/cmake/cpack/direwolf_icon.ico
similarity index 100%
rename from dw-icon.ico
rename to cmake/cpack/direwolf_icon.ico
diff --git a/dw-icon.png b/cmake/cpack/direwolf_icon.png
similarity index 100%
rename from dw-icon.png
rename to cmake/cpack/direwolf_icon.png
diff --git a/cmake/cpu_tests/test_arm_neon.cxx b/cmake/cpu_tests/test_arm_neon.cxx
new file mode 100644
index 00000000..cb48159f
--- /dev/null
+++ b/cmake/cpu_tests/test_arm_neon.cxx
@@ -0,0 +1,16 @@
+#include <stdint.h>
+#include <arm_neon.h>
+#include <stdlib.h>
+#include <signal.h>
+
+void signalHandler(int signum) {
+    exit(signum); // SIGILL = 4
+}
+
+int main(int argc, char* argv[])
+{
+    signal(SIGILL, signalHandler);
+	uint32x4_t x={0};
+	x=veorq_u32(x,x);
+	return 0;
+}
diff --git a/cmake/cpu_tests/test_x86_avx.cxx b/cmake/cpu_tests/test_x86_avx.cxx
new file mode 100644
index 00000000..2344fbcb
--- /dev/null
+++ b/cmake/cpu_tests/test_x86_avx.cxx
@@ -0,0 +1,15 @@
+#include <signal.h>
+#include <stdlib.h>
+#include <immintrin.h>
+
+void signalHandler(int signum) {
+    exit(signum); // SIGILL = 4
+}
+
+int main(int argc, char* argv[])
+{
+    signal(SIGILL, signalHandler);
+	__m256d x = _mm256_setzero_pd();
+	x=_mm256_addsub_pd(x,x);
+	return 0;
+}
diff --git a/cmake/cpu_tests/test_x86_avx2.cxx b/cmake/cpu_tests/test_x86_avx2.cxx
new file mode 100644
index 00000000..369186de
--- /dev/null
+++ b/cmake/cpu_tests/test_x86_avx2.cxx
@@ -0,0 +1,15 @@
+#include <signal.h>
+#include <stdlib.h>
+#include <immintrin.h>
+
+void signalHandler(int signum) {
+    exit(signum); // SIGILL = 4
+}
+
+int main(int argc, char* argv[])
+{
+    signal(SIGILL, signalHandler);
+	__m256i x = _mm256_setzero_si256();
+	x=_mm256_add_epi64 (x,x);
+	return 0;
+}
diff --git a/cmake/cpu_tests/test_x86_avx512.cxx b/cmake/cpu_tests/test_x86_avx512.cxx
new file mode 100644
index 00000000..eed07d3f
--- /dev/null
+++ b/cmake/cpu_tests/test_x86_avx512.cxx
@@ -0,0 +1,16 @@
+#include <stdint.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <immintrin.h>
+
+void signalHandler(int signum) {
+    exit(signum); // SIGILL = 4
+}
+
+int main(int argc, char* argv[])
+{
+    signal(SIGILL, signalHandler);
+    uint64_t x[8] = {0};
+    __m512i y = _mm512_loadu_si512((__m512i*)x);
+    return 0;
+}
diff --git a/cmake/cpu_tests/test_x86_sse2.cxx b/cmake/cpu_tests/test_x86_sse2.cxx
new file mode 100644
index 00000000..98eb27ea
--- /dev/null
+++ b/cmake/cpu_tests/test_x86_sse2.cxx
@@ -0,0 +1,15 @@
+#include <signal.h>
+#include <stdlib.h>
+#include <emmintrin.h>
+
+void signalHandler(int signum) {
+    exit(signum); // SIGILL = 4
+}
+
+int main(int argc, char* argv[])
+{
+    signal(SIGILL, signalHandler);
+	__m128i x = _mm_setzero_si128();
+	x=_mm_add_epi64(x,x);
+	return 0;
+}
diff --git a/cmake/cpu_tests/test_x86_sse3.cxx b/cmake/cpu_tests/test_x86_sse3.cxx
new file mode 100644
index 00000000..70a31e3f
--- /dev/null
+++ b/cmake/cpu_tests/test_x86_sse3.cxx
@@ -0,0 +1,16 @@
+#include <signal.h>
+#include <stdlib.h>
+#include <emmintrin.h>
+#include <pmmintrin.h>
+
+void signalHandler(int signum) {
+    exit(signum); // SIGILL = 4
+}
+
+int main(int argc, char* argv[])
+{
+    signal(SIGILL, signalHandler);
+	__m128d x = _mm_setzero_pd();
+	x=_mm_addsub_pd(x,x);
+	return 0;
+}
diff --git a/cmake/cpu_tests/test_x86_sse41.cxx b/cmake/cpu_tests/test_x86_sse41.cxx
new file mode 100644
index 00000000..e08697fb
--- /dev/null
+++ b/cmake/cpu_tests/test_x86_sse41.cxx
@@ -0,0 +1,18 @@
+#include <signal.h>
+#include <stdlib.h>
+#include <emmintrin.h>
+#include <smmintrin.h>
+
+void signalHandler(int signum) {
+    exit(signum); // SIGILL = 4
+}
+
+int main(int argc, char* argv[])
+{
+    signal(SIGILL, signalHandler);
+	__m128i x = _mm_setzero_si128();
+	__m128i a = _mm_setzero_si128();
+	__m128i b = _mm_setzero_si128();
+	x=_mm_blend_epi16(a,b,4);
+	return 0;
+}
diff --git a/cmake/cpu_tests/test_x86_sse42.cxx b/cmake/cpu_tests/test_x86_sse42.cxx
new file mode 100644
index 00000000..58032a57
--- /dev/null
+++ b/cmake/cpu_tests/test_x86_sse42.cxx
@@ -0,0 +1,15 @@
+#include <signal.h>
+#include <stdlib.h>
+#include <nmmintrin.h>
+
+void signalHandler(int signum) {
+    exit(signum); // SIGILL = 4
+}
+
+int main(int argc, char* argv[])
+{
+    signal(SIGILL, signalHandler);
+	unsigned int x=32;
+	x=_mm_crc32_u8(x,4);
+	return 0;
+}
diff --git a/cmake/cpu_tests/test_x86_ssse3.cxx b/cmake/cpu_tests/test_x86_ssse3.cxx
new file mode 100644
index 00000000..01688f4a
--- /dev/null
+++ b/cmake/cpu_tests/test_x86_ssse3.cxx
@@ -0,0 +1,16 @@
+#include <signal.h>
+#include <stdlib.h>
+#include <emmintrin.h>
+#include <tmmintrin.h>
+
+void signalHandler(int signum) {
+    exit(signum); // SIGILL = 4
+}
+
+int main(int argc, char* argv[])
+{
+    signal(SIGILL, signalHandler);
+	__m128i x = _mm_setzero_si128();
+	x=_mm_alignr_epi8(x,x,2);
+	return 0;
+}
diff --git a/cmake/include/uninstall.cmake.in b/cmake/include/uninstall.cmake.in
new file mode 100644
index 00000000..2037e365
--- /dev/null
+++ b/cmake/include/uninstall.cmake.in
@@ -0,0 +1,21 @@
+if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+  message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+
+file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
+string(REGEX REPLACE "\n" ";" files "${files}")
+foreach(file ${files})
+  message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
+  if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+    exec_program(
+      "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+      OUTPUT_VARIABLE rm_out
+      RETURN_VALUE rm_retval
+      )
+    if(NOT "${rm_retval}" STREQUAL 0)
+      message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
+    endif(NOT "${rm_retval}" STREQUAL 0)
+  else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+    message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
+  endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+endforeach(file)
diff --git a/cmake/modules/FindCPUflags.cmake b/cmake/modules/FindCPUflags.cmake
new file mode 100644
index 00000000..461fe749
--- /dev/null
+++ b/cmake/modules/FindCPUflags.cmake
@@ -0,0 +1,307 @@
+# Clang or AppleClang (see CMP0025)
+if(NOT DEFINED C_CLANG AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+    set(C_CLANG 1)
+elseif(NOT DEFINED C_GCC AND CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+    set(C_GCC 1)
+elseif(NOT DEFINED C_MSVC AND CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
+    set(C_MSVC 1)
+endif()
+
+# Detect current compilation architecture and create standard definitions
+include(CheckSymbolExists)
+function(detect_architecture symbol arch)
+    if (NOT DEFINED ARCHITECTURE)
+        set(CMAKE_REQUIRED_QUIET 1)
+        check_symbol_exists("${symbol}" "" ARCHITECTURE_${arch})
+        unset(CMAKE_REQUIRED_QUIET)
+
+        # The output variable needs to be unique across invocations otherwise
+        # CMake's crazy scope rules will keep it defined
+        if (ARCHITECTURE_${arch})
+            set(ARCHITECTURE "${arch}" PARENT_SCOPE)
+            set(ARCHITECTURE_${arch} 1 PARENT_SCOPE)
+            add_definitions(-DARCHITECTURE_${arch}=1)
+        endif()
+    endif()
+endfunction()
+
+if (NOT ENABLE_GENERIC)
+    if (C_MSVC)
+        detect_architecture("_M_AMD64" x86_64)
+        detect_architecture("_M_IX86" x86)
+        detect_architecture("_M_ARM" ARM)
+        detect_architecture("_M_ARM64" ARM64)
+    else()
+        detect_architecture("__x86_64__" x86_64)
+        detect_architecture("__i386__" x86)
+        detect_architecture("__arm__" ARM)
+        detect_architecture("__aarch64__" ARM64)
+    endif()
+endif()
+if (NOT DEFINED ARCHITECTURE)
+    set(ARCHITECTURE "GENERIC")
+    set(ARCHITECTURE_GENERIC 1)
+    add_definitions(-DARCHITECTURE_GENERIC=1)
+endif()
+message(STATUS "Target architecture: ${ARCHITECTURE}")
+
+set(TEST_DIR ${PROJECT_SOURCE_DIR}/cmake/cpu_tests)
+
+# flag that set the minimum cpu flag requirements
+# used to create re-distribuitable binary
+if (${ARCHITECTURE} MATCHES "x86_64|x86" AND (FORCE_SSE OR FORCE_SSSE3 OR FORCE_SSE41))
+  if (FORCE_SSE)
+    set(HAS_SSE ON CACHE BOOL "SSE SIMD enabled")
+    if(C_GCC OR C_CLANG)
+      set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse" )
+      set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse" )
+      message(STATUS "Use SSE SIMD instructions")
+      add_definitions(-DUSE_SSE)
+    elseif(C_MSVC)
+      set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:SSE" )
+      set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE" )
+      set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
+      set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
+      set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
+      message(STATUS "Use MSVC SSSE3 SIMD instructions")
+      add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
+      add_definitions(-DUSE_SSSE3)
+    endif()
+  elseif (FORCE_SSSE3)
+    set(HAS_SSSE3 ON CACHE BOOL "SSSE3 SIMD enabled")
+    if(C_GCC OR C_CLANG)
+      set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mssse3" )
+      set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3" )
+      message(STATUS "Use SSSE3 SIMD instructions")
+      add_definitions(-DUSE_SSSE3)
+    elseif(C_MSVC)
+      set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:SSSE3" )
+      set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSSE3" )
+      set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
+      set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
+      set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
+      message(STATUS "Use MSVC SSSE3 SIMD instructions")
+      add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
+      add_definitions(-DUSE_SSSE3)
+    endif()
+  elseif (FORCE_SSE41)
+    set(HAS_SSSE3 ON CACHE BOOL "SSSE3 SIMD enabled")
+    set(HAS_SSE4_1 ON CACHE BOOL "Architecture has SSE 4.1 SIMD enabled")
+    if(C_GCC OR C_CLANG)
+      set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.1" )
+      set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1" )
+      message(STATUS "Use SSE 4.1 SIMD instructions")
+      add_definitions(-DUSE_SSSE3)
+      add_definitions(-DUSE_SSE4_1)
+    elseif(C_MSVC)
+      # seems that from MSVC 2015 comiler doesn't support those flags
+      set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:SSE4_1" )
+      set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE4_1" )
+      set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
+      set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
+      set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
+      message(STATUS "Use SSE 4.1 SIMD instructions")
+      add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
+      add_definitions(-DUSE_SSSE3)
+      add_definitions(-DUSE_SSE4_1)
+    endif()
+  endif()
+else ()
+  if (${ARCHITECTURE} MATCHES "x86_64|x86")
+    if(C_MSVC)
+      try_run(RUN_SSE2 COMPILE_SSE2 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_sse2.cxx" COMPILE_DEFINITIONS /O0)
+    else()
+      try_run(RUN_SSE2 COMPILE_SSE2 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_sse2.cxx" COMPILE_DEFINITIONS -msse2 -O0)
+    endif()
+    if(COMPILE_SSE2 AND RUN_SSE2 EQUAL 0)
+      set(HAS_SSE2 ON CACHE BOOL "Architecture has SSSE2 SIMD enabled")
+      message(STATUS "Use SSE2 SIMD instructions")
+      if(C_GCC OR C_CLANG)
+        set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2" )
+        set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2" )
+        add_definitions(-DUSE_SSE2)
+      elseif(C_MSVC)
+        set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:SSE2" )
+        set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE2" )
+        set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE2" )
+        set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE2" )
+        set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
+        add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
+        add_definitions(-DUSE_SSE2)
+      endif()
+    else()
+      set(HAS_SSE2 OFF CACHE BOOL "Architecture does not have SSSE2 SIMD enabled")
+    endif()
+    if(C_MSVC)
+      try_run(RUN_SSSE3 COMPILE_SSSE3 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_ssse3.cxx" COMPILE_DEFINITIONS /O0)
+    else()
+      try_run(RUN_SSSE3 COMPILE_SSSE3 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_ssse3.cxx" COMPILE_DEFINITIONS -mssse3 -O0)
+    endif()
+    if(COMPILE_SSSE3 AND RUN_SSSE3 EQUAL 0)
+      set(HAS_SSSE3 ON CACHE BOOL "Architecture has SSSE3 SIMD enabled")
+      message(STATUS "Use SSSE3 SIMD instructions")
+      if(C_GCC OR C_CLANG)
+        set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mssse3" )
+        set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3" )
+        add_definitions(-DUSE_SSSE3)
+       elseif(C_MSVC)
+         # seems not present on MSVC 2017
+         #set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSSE3" )
+         set( CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
+         set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
+         set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
+         add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
+         add_definitions(-DUSE_SSSE3)
+         endif()
+       else()
+         set(HAS_SSSE3 OFF CACHE BOOL "Architecture does not have SSSE3 SIMD enabled")
+       endif()
+       if(C_MSVC)
+         try_run(RUN_SSE4_1 COMPILE_SSE4_1 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_sse41.cxx" COMPILE_DEFINITIONS /O0)
+       else()
+        try_run(RUN_SSE4_1 COMPILE_SSE4_1 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_sse41.cxx" COMPILE_DEFINITIONS -msse4.1 -O0)
+    endif()
+    if(COMPILE_SSE4_1 AND RUN_SSE4_1 EQUAL 0)
+      set(HAS_SSE4_1 ON CACHE BOOL "Architecture has SSE 4.1 SIMD enabled")
+      message(STATUS "Use SSE 4.1 SIMD instructions")
+      if(C_GCC OR C_CLANG)
+        set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.1" )
+        set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1" )
+        add_definitions(-DUSE_SSE4_1)
+       elseif(C_MSVC)
+           # seems not present on MSVC 2017
+           #set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE4_1" )
+           #set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE4_1" )
+           set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
+           set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
+           set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
+           add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
+           add_definitions(-DUSE_SSE4_1)
+       endif()
+    else()
+       set(HAS_SSE4_1 OFF CACHE BOOL "Architecture does not have SSE 4.1 SIMD enabled")
+    endif()
+    if(C_MSVC)
+        try_run(RUN_SSE4_2 COMPILE_SSE4_2 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_sse42.cxx" COMPILE_DEFINITIONS /O0)
+    else()
+        try_run(RUN_SSE4_2 COMPILE_SSE4_2 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_sse42.cxx" COMPILE_DEFINITIONS -msse4.2 -O0)
+    endif()
+    if(COMPILE_SSE4_2 AND RUN_SSE4_2 EQUAL 0)
+       set(HAS_SSE4_2 ON CACHE BOOL "Architecture has SSE 4.2 SIMD enabled")
+       message(STATUS "Use SSE 4.2 SIMD instructions")
+       if(C_GCC OR C_CLANG)
+           set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.2" )
+           set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2" )
+           add_definitions(-DUSE_SSE4_2)
+       elseif(C_MSVC)
+           # seems not present on MSVC 2017
+           #set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE4_2" )
+           #set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE4_2" )
+           set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
+           set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
+           set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
+           add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
+           add_definitions(-DUSE_SSE4_2)
+       endif()
+    else()
+       set(HAS_SSE4_2 OFF CACHE BOOL "Architecture does not have SSE 4.2 SIMD enabled")
+    endif()
+    if(C_MSVC)
+        try_run(RUN_AVX COMPILE_AVX "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_avx.cxx" COMPILE_DEFINITIONS /O0)
+    else()
+        try_run(RUN_AVX COMPILE_AVX "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_avx.cxx" COMPILE_DEFINITIONS -mavx -O0)
+    endif()
+    if(COMPILE_AVX AND RUN_AVX EQUAL 0)
+       set(HAS_AVX ON CACHE BOOL "Architecture has AVX SIMD enabled")
+       message(STATUS "Use AVX SIMD instructions")
+       if(C_GCC OR C_CLANG)
+           set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx" )
+           set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx" )
+           add_definitions(-DUSE_AVX)
+       elseif(C_MSVC)
+         set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:AVX" )
+         set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX" )
+         set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX" )
+         set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX" )
+         set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
+         add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
+         add_definitions(-DUSE_AVX)
+       endif()
+    else()
+       set(HAS_AVX OFF CACHE BOOL "Architecture does not have AVX SIMD enabled")
+    endif()
+    if(C_MSVC)
+        try_run(RUN_AVX2 COMPILE_AVX2 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_avx2.cxx" COMPILE_DEFINITIONS /O0)
+    else()
+        try_run(RUN_AVX2 COMPILE_AVX2 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_avx2.cxx" COMPILE_DEFINITIONS -mavx2 -O0)
+    endif()
+    if(COMPILE_AVX2 AND RUN_AVX2 EQUAL 0)
+       set(HAS_AVX2 ON CACHE BOOL "Architecture has AVX2 SIMD enabled")
+       message(STATUS "Use AVX2 SIMD instructions")
+       if(C_GCC OR C_CLANG)
+           set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx2" )
+           set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2" )
+           add_definitions(-DUSE_AVX2)
+         elseif(C_MSVC)
+         set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:AVX2" )
+         set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX2" )
+         set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX2" )
+         set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX2" )
+         set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
+         add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
+         add_definitions(-DUSE_AVX2)
+       endif()
+    else()
+       set(HAS_AVX2 OFF CACHE BOOL "Architecture does not have AVX2 SIMD enabled")
+    endif()
+    if(C_MSVC)
+        try_run(RUN_AVX512 COMPILE_AVX512 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_avx512.cxx" COMPILE_DEFINITIONS /O0)
+    else()
+        try_run(RUN_AVX512 COMPILE_AVX512 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_avx512.cxx" COMPILE_DEFINITIONS -mavx512f -O0)
+    endif()
+    if(COMPILE_AVX512 AND RUN_AVX512 EQUAL 0)
+       set(HAS_AVX512 ON CACHE BOOL "Architecture has AVX512 SIMD enabled")
+       message(STATUS "Use AVX512 SIMD instructions")
+       if(C_GCC OR C_CLANG)
+           set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx512f" )
+           set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512f" )
+           add_definitions(-DUSE_AVX512)
+       elseif(C_MSVC)
+         set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:AVX512" )
+         set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX512" )
+         set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX512" )
+         set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX512" )
+         set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
+         add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
+         add_definitions(-DUSE_AVX512)
+       endif()
+    else()
+       set(HAS_AVX512 OFF CACHE BOOL "Architecture does not have AVX512 SIMD enabled")
+    endif()
+elseif(ARCHITECTURE_ARM)
+    if(C_MSVC)
+        try_run(RUN_NEON COMPILE_NEON "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_arm_neon.cxx" COMPILE_DEFINITIONS /O0)
+    else()
+        try_run(RUN_NEON COMPILE_NEON "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_arm_neon.cxx" COMPILE_DEFINITIONS -mfpu=neon -O0)
+    endif()
+    if(COMPILE_NEON AND RUN_NEON EQUAL 0)
+       set(HAS_NEON ON CACHE BOOL "Architecture has NEON SIMD enabled")
+       message(STATUS "Use NEON SIMD instructions")
+       if(C_GCC OR C_CLANG)
+           set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon" )
+           set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon" )
+           add_definitions(-DUSE_NEON)
+       endif()
+    else()
+       set(HAS_NEON OFF CACHE BOOL "Architecture does not have NEON SIMD enabled")
+    endif()
+elseif(ARCHITECTURE_ARM64)
+    # Advanced SIMD (aka NEON) is mandatory for AArch64
+    set(HAS_NEON ON CACHE BOOL "Architecture has NEON SIMD enabled")
+    message(STATUS "Use NEON SIMD instructions")
+    add_definitions(-DUSE_NEON)
+endif()
+endif()
+
+# clear binary test folder
+FILE(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/tmp)
diff --git a/cmake/modules/FindCompiler.cmake b/cmake/modules/FindCompiler.cmake
new file mode 100644
index 00000000..f339a73e
--- /dev/null
+++ b/cmake/modules/FindCompiler.cmake
@@ -0,0 +1,13 @@
+# Clang or AppleClang (see CMP0025)
+if(NOT DEFINED C_CLANG AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+  set(C_CLANG 1)
+elseif(NOT DEFINED C_GCC AND CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+  set(C_GCC 1)
+elseif(NOT DEFINED C_MSVC AND CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
+  set(C_MSVC 1)
+  if(MSVC_VERSION GREATER 1910 AND MSVC_VERSION LESS 1919)
+    set(VS2017 ON)
+  elseif(MSVC_VERSION GREATER 1899 AND MSVC_VERSION LESS 1910)
+    set(VS2015 ON)
+  endif()
+endif()
diff --git a/cmake/modules/FindGPSD.cmake b/cmake/modules/FindGPSD.cmake
new file mode 100644
index 00000000..d21b3311
--- /dev/null
+++ b/cmake/modules/FindGPSD.cmake
@@ -0,0 +1,88 @@
+# - Try to find GPSD
+# Once done this will define
+#
+#  GPSD_FOUND - system has GPSD
+#  GPSD_INCLUDE_DIRS - the GPSD include directory
+#  GPSD_LIBRARIES - Link these to use GPSD
+#  GPSD_DEFINITIONS - Compiler switches required for using GPSD
+#
+#  Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
+#
+#  Redistribution and use is allowed according to the terms of the New
+#  BSD license.
+#  For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+
+set(GPSD_ROOT_DIR
+  "${GPSD_ROOT_DIR}"
+  CACHE
+  PATH
+  "Directory to search for gpsd")
+
+find_package(PkgConfig QUIET)
+if(PKG_CONFIG_FOUND)
+  pkg_check_modules(PC_GPSD libgps)
+endif()
+
+if (GPSD_LIBRARIES AND GPSD_INCLUDE_DIRS)
+  # in cache already
+  set(GPSD_FOUND TRUE)
+else (GPSD_LIBRARIES AND GPSD_INCLUDE_DIRS)
+  find_path(GPSD_INCLUDE_DIRS
+    NAMES
+    gps.h
+    PATHS
+    /usr/include
+    /usr/local/include
+    /opt/local/include
+    /sw/include
+    /usr/include/gps
+    /usr/local/include/gps
+    /opt/local/include/gps
+    /sw/include/gps
+    HINTS
+    ${PC_GPSD_INCLUDEDIR}
+    ${GPSD_ROOT_DIR}
+    )
+
+  # debian uses version suffixes
+  # add suffix evey new release
+  find_library(GPSD_LIBRARIES
+    NAMES
+    gps
+    PATHS
+    /usr/lib64
+    /usr/lib
+    /usr/local/lib
+    /opt/local/lib
+    /sw/lib
+    HINTS
+    ${PC_GPSD_LIBDIR}
+    ${GPSD_ROOT_DIR}
+    )
+
+  if (GPSD_INCLUDE_DIRS AND GPSD_LIBRARIES)
+    set(GPSD_FOUND TRUE)
+  endif (GPSD_INCLUDE_DIRS AND GPSD_LIBRARIES)
+
+  if (GPSD_FOUND)
+    if (NOT GPSD_FIND_QUIETLY)
+      message(STATUS "Found GPSD: ${GPSD_LIBRARIES}")
+    endif (NOT GPSD_FIND_QUIETLY)
+  else (GPSD_FOUND)
+    if (GPSD_FIND_REQUIRED)
+      message(FATAL_ERROR "Could not find GPSD")
+    endif (GPSD_FIND_REQUIRED)
+  endif (GPSD_FOUND)
+
+  # show the GPSD_INCLUDE_DIRS and GPSD_LIBRARIES variables only in the advanced view
+  mark_as_advanced(GPSD_INCLUDE_DIRS GPSD_LIBRARIES)
+
+endif (GPSD_LIBRARIES AND GPSD_INCLUDE_DIRS)
+
+# maybe on CYGWIN gpsd works
+if (WIN32)
+  set(GPSD_FOUND FALSE)
+  set(GPSD_LIBRARIES "")
+  set(GPSD_INCLUDE_DIRS "")
+endif (WIN32)
diff --git a/cmake/modules/FindPortaudio.cmake b/cmake/modules/FindPortaudio.cmake
new file mode 100644
index 00000000..9cda3428
--- /dev/null
+++ b/cmake/modules/FindPortaudio.cmake
@@ -0,0 +1,64 @@
+# - Try to find Portaudio
+# Once done this will define
+#
+#  PORTAUDIO_FOUND - system has Portaudio
+#  PORTAUDIO_INCLUDE_DIRS - the Portaudio include directory
+#  PORTAUDIO_LIBRARIES - Link these to use Portaudio
+
+set(PORTAUDIO_ROOT_DIR
+  "${PORTAUDIO_ROOT_DIR}"
+  CACHE
+  PATH
+  "Directory to search for portaudio")
+
+find_package(PkgConfig QUIET)
+if(PKG_CONFIG_FOUND)
+  pkg_check_modules(PC_PORTAUDIO portaudio-2.0)
+endif()
+
+find_path(PORTAUDIO_INCLUDE_DIRS
+  NAMES
+  portaudio.h
+  PATHS
+  /usr/local/include
+  /usr/include
+  /opt/local/include
+  HINTS
+  ${PC_PORTAUDIO_INCLUDEDIR}
+  ${PORTAUDIO_ROOT_DIR}
+  )
+
+find_library(PORTAUDIO_LIBRARIES
+  NAMES
+  portaudio
+  PATHS
+  /usr/local/lib
+  /usr/lib
+  /usr/lib64
+  /opt/local/lib
+  HINTS
+  ${PC_PORTAUDIO_LIBDIR}
+  ${PORTAUDIO_ROOT_DIR}
+  )
+
+mark_as_advanced(PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES)
+
+# Found PORTAUDIO, but it may be version 18 which is not acceptable.
+if(EXISTS ${PORTAUDIO_INCLUDE_DIRS}/portaudio.h)
+  include(CheckCXXSourceCompiles)
+  set(CMAKE_REQUIRED_INCLUDES_SAVED ${CMAKE_REQUIRED_INCLUDES})
+  set(CMAKE_REQUIRED_INCLUDES ${PORTAUDIO_INCLUDE_DIRS})
+  CHECK_CXX_SOURCE_COMPILES(
+    "#include <portaudio.h>\nPaDeviceIndex pa_find_device_by_name(const char *name); int main () {return 0;}"
+    PORTAUDIO2_FOUND)
+  set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVED})
+  unset(CMAKE_REQUIRED_INCLUDES_SAVED)
+  if(PORTAUDIO2_FOUND)
+    INCLUDE(FindPackageHandleStandardArgs)
+    FIND_PACKAGE_HANDLE_STANDARD_ARGS(PORTAUDIO DEFAULT_MSG PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES)
+  else(PORTAUDIO2_FOUND)
+    message(STATUS
+      "  portaudio.h not compatible (requires API 2.0)")
+    set(PORTAUDIO_FOUND FALSE)
+  endif(PORTAUDIO2_FOUND)
+endif()
diff --git a/cmake/modules/Findhamlib.cmake b/cmake/modules/Findhamlib.cmake
new file mode 100644
index 00000000..2086a98f
--- /dev/null
+++ b/cmake/modules/Findhamlib.cmake
@@ -0,0 +1,67 @@
+# - Try to find Hamlib
+#
+# HAMLIB_FOUND - system has Hamlib
+# HAMLIB_LIBRARIES - location of the library for hamlib
+# HAMLIB_INCLUDE_DIRS - location of the include files for hamlib
+#
+# Requires these CMake modules:
+#  FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
+#
+# Original Author:
+# 2019 Davide Gerhard <rainbow@irh.it>
+
+set(HAMLIB_ROOT_DIR
+  "${HAMLIB_ROOT_DIR}"
+  CACHE
+  PATH
+  "Directory to search for hamlib")
+
+find_package(PkgConfig QUIET)
+if(PKG_CONFIG_FOUND)
+  pkg_check_modules(PC_HAMLIB hamlib)
+endif()
+
+find_path(HAMLIB_INCLUDE_DIR
+  NAMES hamlib/rig.h
+  PATHS
+  /usr/include
+  /usr/local/include
+  /opt/local/include
+  HINTS
+  ${PC_HAMLIB_INCLUDEDIR}
+  ${HAMLIB_ROOT_DIR}
+  )
+
+find_library(HAMLIB_LIBRARY
+  NAMES hamlib
+  PATHS
+  /usr/lib64/hamlib
+  /usr/lib/hamlib
+  /usr/lib64
+  /usr/lib
+  /usr/local/lib64/hamlib
+  /usr/local/lib/hamlib
+  /usr/local/lib64
+  /usr/local/lib
+  /opt/local/lib
+  /opt/local/lib/hamlib
+  HINTS
+  ${PC_HAMLIB_LIBDIR}
+  ${HAMLIB_ROOT_DIR}
+
+  )
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(HAMLIB
+  DEFAULT_MSG
+  HAMLIB_LIBRARY
+  HAMLIB_INCLUDE_DIR
+  )
+
+if(HAMLIB_FOUND)
+  list(APPEND HAMLIB_LIBRARIES ${HAMLIB_LIBRARY})
+  list(APPEND HAMLIB_INCLUDE_DIRS ${HAMLIB_INCLUDE_DIR})
+  mark_as_advanced(HAMLIB_ROOT_DIR)
+endif()
+
+mark_as_advanced(HAMLIB_INCLUDE_DIR HAMLIB_LIBRARY)
diff --git a/cmake/modules/Findudev.cmake b/cmake/modules/Findudev.cmake
new file mode 100644
index 00000000..3a706250
--- /dev/null
+++ b/cmake/modules/Findudev.cmake
@@ -0,0 +1,76 @@
+# - try to find the udev library
+#
+# Cache Variables: (probably not for direct use in your scripts)
+#  UDEV_INCLUDE_DIR
+#  UDEV_SOURCE_DIR
+#  UDEV_LIBRARY
+#
+# Non-cache variables you might use in your CMakeLists.txt:
+#  UDEV_FOUND
+#  UDEV_INCLUDE_DIRS
+#  UDEV_LIBRARIES
+#
+# Requires these CMake modules:
+#  FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
+#
+# Original Author:
+# 2014 Kevin M. Godby <kevin@godby.org>
+#
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+set(UDEV_ROOT_DIR
+  "${UDEV_ROOT_DIR}"
+  CACHE
+  PATH
+  "Directory to search for udev")
+
+find_package(PkgConfig QUIET)
+if(PKG_CONFIG_FOUND)
+  pkg_check_modules(PC_LIBUDEV libudev)
+endif()
+
+find_library(UDEV_LIBRARY
+  NAMES
+  udev
+  PATHS
+  ${PC_LIBUDEV_LIBRARY_DIRS}
+  ${PC_LIBUDEV_LIBDIR}
+  HINTS
+  "${UDEV_ROOT_DIR}"
+  PATH_SUFFIXES
+  lib
+  )
+
+get_filename_component(_libdir "${UDEV_LIBRARY}" PATH)
+
+find_path(UDEV_INCLUDE_DIR
+  NAMES
+  libudev.h
+  PATHS
+  ${PC_LIBUDEV_INCLUDE_DIRS}
+  ${PC_LIBUDEV_INCLUDEDIR}
+  HINTS
+  "${_libdir}"
+  "${_libdir}/.."
+  "${UDEV_ROOT_DIR}"
+  PATH_SUFFIXES
+  include
+  )
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(UDEV
+  DEFAULT_MSG
+  UDEV_LIBRARY
+  UDEV_INCLUDE_DIR
+  )
+
+if(UDEV_FOUND)
+  list(APPEND UDEV_LIBRARIES ${UDEV_LIBRARY})
+  list(APPEND UDEV_INCLUDE_DIRS ${UDEV_INCLUDE_DIR})
+  mark_as_advanced(UDEV_ROOT_DIR)
+endif()
+
+mark_as_advanced(UDEV_INCLUDE_DIR
+  UDEV_LIBRARY)
diff --git a/99-direwolf-cmedia.rules b/conf/99-direwolf-cmedia.rules
similarity index 100%
rename from 99-direwolf-cmedia.rules
rename to conf/99-direwolf-cmedia.rules
diff --git a/conf/CMakeLists.txt b/conf/CMakeLists.txt
new file mode 100644
index 00000000..d4a229d7
--- /dev/null
+++ b/conf/CMakeLists.txt
@@ -0,0 +1,48 @@
+# generate conf per platform
+file(READ "${CUSTOM_CONF_DIR}/generic.conf" file_content)
+
+if(LINUX)
+  string(REGEX REPLACE "\n%W%[^\n]*" "" file_content "${file_content}")
+  string(REGEX REPLACE "\n%M%[^\n]*" "" file_content "${file_content}")
+  string(REGEX REPLACE "\n%L%([^\n]*)" "\n\\1" file_content "${file_content}")
+elseif(WIN32 OR CYGWIN)
+  string(REGEX REPLACE "\n%M%[^\n]*" "" file_content "${file_content}")
+  string(REGEX REPLACE "\n%L%[^\n]*" "" file_content "${file_content}")
+  string(REGEX REPLACE "\n%W%([^\n]*)" "\n\\1" file_content "${file_content}")
+else() # macOS FreeBSD OpenBSD
+  string(REGEX REPLACE "\n%W%[^\n]*" "" file_content "${file_content}")
+  string(REGEX REPLACE "\n%L%[^\n]*" "" file_content "${file_content}")
+  string(REGEX REPLACE "\n%M%([^\n]*)" "\n\\1" file_content "${file_content}")
+endif()
+
+# remove remark
+string(REGEX REPLACE "\n%R%[^\n]*" "" file_content "${file_content}")
+
+# clear common lines
+string(REGEX REPLACE "\n%C%([^\n]*)" "\n\\1" file_content "${file_content}")
+string(REGEX REPLACE "^%C%([^\n]*)" "\\1" file_content "${file_content}")
+
+file(WRITE "${CMAKE_BINARY_DIR}/direwolf.conf" "${file_content}")
+
+# install udev rules for CM108
+if(LINUX)
+  install(FILES "${CUSTOM_CONF_DIR}/99-direwolf-cmedia.rules" DESTINATION /etc/udev/rules.d/)
+endif()
+
+install(FILES "${CMAKE_BINARY_DIR}/direwolf.conf" DESTINATION ${INSTALL_CONF_DIR})
+install(FILES "${CUSTOM_CONF_DIR}/sdr.conf" DESTINATION ${INSTALL_CONF_DIR})
+
+# Put sample configuration & startup files in home directory.
+# This step would be done as ordinary user.
+# Some people like to put the direwolf config file in /etc/ax25.
+# Note that all of these are also in $(DESTDIR)/share/doc/direwolf/examples/.
+if(NOT (WIN32 OR CYGWIN))
+  add_custom_target(install-conf
+    COMMAND ${CMAKE_COMMAND}
+    -DCUSTOM_BINARY_DIR="${CMAKE_BINARY_DIR}"
+    -DCUSTOM_CONF_DIR="${CUSTOM_CONF_DIR}"
+    -DCUSTOM_SCRIPTS_DIR="${CUSTOM_SCRIPTS_DIR}"
+    -DCUSTOM_TELEMETRY_DIR="${CUSTOM_TELEMETRY_DIR}"
+    -P "${CMAKE_SOURCE_DIR}/conf/install_conf.cmake"
+    )
+endif()
diff --git a/direwolf.txt b/conf/direwolf.txt
similarity index 100%
rename from direwolf.txt
rename to conf/direwolf.txt
diff --git a/conf/generic.conf b/conf/generic.conf
new file mode 100644
index 00000000..4d53313a
--- /dev/null
+++ b/conf/generic.conf
@@ -0,0 +1,573 @@
+%C%#############################################################
+%C%#                                                           #
+%C%#               Configuration file for Dire Wolf            #
+%C%#                                                           #
+%L%#                   Linux version                           #
+%W%#                   Windows version                         #
+%M%#                   Macintosh version                       #
+%C%#                                                           #
+%C%#############################################################
+%R%
+%R%
+%R%	The sample config file was getting pretty messy
+%R%	with the Windows and Linux differences.
+%R%	It would be a maintenance burden to keep most of
+%R%	two different versions in sync.
+%R%	This common source is now used to generate the
+%R%	two different variations while having only a single
+%R%	copy of the common parts.
+%R%
+%R%	The first column contains one of the following:
+%R%
+%R%		R	remark which is discarded.
+%R%		C	common to both versions.
+%R%		W	Windows version only.
+%R%		L	Linux version only.
+%R%		M	Macintosh version and possibly others (portaudio used).
+%R%
+%C%#
+%C%# Consult the User Guide for more details on configuration options.
+%C%#
+%C%#
+%C%# These are the most likely settings you might change:
+%C%#
+%C%#	(1)   	MYCALL 	-  call sign and SSID for your station.
+%C%#
+%C%#			Look for lines starting with MYCALL and
+%C%#			change NOCALL to your own.
+%C%#
+%C%#	(2)	PBEACON	-  enable position beaconing.
+%C%#
+%C%#			Look for lines starting with PBEACON and
+%C%#			modify for your call, location, etc.
+%C%#
+%C%#	(3)	DIGIPEATER  -  configure digipeating rules.
+%C%#
+%C%#			Look for lines starting with DIGIPEATER.
+%C%#			Most people will probably use the given example.
+%C%#			Just remove the "#" from the start of the line
+%C%#			to enable it.
+%C%#
+%C%#	(4)	IGSERVER, IGLOGIN  - IGate server and login
+%C%#
+%C%#			Configure an IGate client to relay messages between
+%C%#			radio and internet servers.
+%C%#
+%C%#
+%C%# The default location is "direwolf.conf" in the current working directory.
+%L%# On Linux, the user's home directory will also be searched.
+%C%# An alternate configuration file location can be specified with the "-c" command line option.
+%C%#
+%C%# As you probably guessed by now, # indicates a comment line.
+%C%#
+%C%# Remove the # at the beginning of a line if you want to use a sample
+%C%# configuration that is currently commented out.
+%C%#
+%C%# Commands are a keyword followed by parameters.
+%C%#
+%C%# Command key words are case insensitive.  i.e. upper and lower case are equivalent.
+%C%#
+%C%# Command parameters are generally case sensitive.  i.e. upper and lower case are different.
+%C%#
+%C%
+%C%
+%C%#############################################################
+%C%#                                                           #
+%C%#               FIRST AUDIO DEVICE PROPERTIES               #
+%C%#               (Channel 0 + 1 if in stereo)                #
+%C%#                                                           #
+%C%#############################################################
+%C%
+%C%#
+%C%# Many people will simply use the default sound device.
+%C%# Some might want to use an alternative device by chosing it here.
+%C%#
+%W%# When the Windows version starts up, it displays something like
+%W%# this with the available sound devices and capabilities:
+%W%#
+%W%#	Available audio input devices for receive (*=selected):
+%W%#	   *  0: Microphone (C-Media USB Headpho   (channel 2)
+%W%#	      1: Microphone (Bluetooth SCO Audio
+%W%#	      2: Microphone (Bluetooth AV Audio)
+%W%#	 *    3: Microphone (Realtek High Defini   (channels 0 & 1)
+%W%#	Available audio output devices for transmit (*=selected):
+%W%#	   *  0: Speakers (C-Media USB Headphone   (channel 2)
+%W%#	      1: Speakers (Bluetooth SCO Audio)
+%W%#	      2: Realtek Digital Output(Optical)
+%W%#	      3: Speakers (Bluetooth AV Audio)
+%W%#	 *    4: Speakers (Realtek High Definiti   (channels 0 & 1)
+%W%#	      5: Realtek Digital Output (Realtek
+%W%#
+%W%# Example: To use the microphone and speaker connections on the
+%W%# system board, either of these forms can be used:
+%W%
+%W%#ADEVICE High
+%W%#ADEVICE  3 4
+%W%
+%W%
+%W%# Example: To use the USB Audio, use a command like this with
+%W%# the input and output device numbers.  (Remove the # comment character.)
+%W%#ADEVICE USB
+%W%
+%W%# The position in the list can change when devices (e.g. USB) are added and removed.
+%W%# You can also specify devices by using part of the name.
+%W%# Here is an example of specifying the USB Audio device.
+%W%# This is case-sensitive.  Upper and lower case are not treated the same.
+%W%
+%W%#ADEVICE USB
+%W%
+%W%
+%L%# Linux ALSA is complicated.  See User Guide for discussion.
+%L%# To use something other than the default, generally use plughw
+%L%# and a card number reported by "arecord -l" command.  Example:
+%L%
+%L%# ADEVICE  plughw:1,0
+%L%
+%L%# Starting with version 1.0, you can also use "-" or "stdin" to
+%L%# pipe stdout from some other application such as a software defined
+%L%# radio.  You can also specify "UDP:" and an optional port for input.
+%L%# Something different must be specified for output.
+%L%
+%M%# Macintosh Operating System uses portaudio driver for audio
+%M%# input/output. Default device selection not available. User/OP
+%M%# must configure the sound input/output option.  Note that
+%M%# the device names can contain spaces.  In this case, the names
+%M%# must be enclosed by quotes.
+%M%#
+%M%# Examples:
+%M%#
+%M%# ADEVICE  "USB Audio Codec:6"  "USB Audio Codec:5"
+%M%#
+%M%#
+%W%# ADEVICE - 0
+%W%# ADEVICE UDP:7355 0
+%L%# ADEVICE - plughw:1,0
+%L%# ADEVICE UDP:7355 default
+%M%# ADEVICE UDP:7355 default
+%M%#
+%L%
+%L%
+%C%
+%C%#
+%C%# Number of audio channels for this souncard:  1 or 2.
+%C%#
+%C%
+%C%ACHANNELS 1
+%C%#ACHANNELS 2
+%C%
+%C%
+%C%#############################################################
+%C%#                                                           #
+%C%#               SECOND AUDIO DEVICE PROPERTIES              #
+%C%#               (Channel 2 + 3 if in stereo)                #
+%C%#                                                           #
+%C%#############################################################
+%C%
+%C%#ADEVICE1  ...
+%C%
+%C%
+%C%#############################################################
+%C%#                                                           #
+%C%#               THIRD AUDIO DEVICE PROPERTIES               #
+%C%#               (Channel 4 + 5 if in stereo)                #
+%C%#                                                           #
+%C%#############################################################
+%C%
+%C%#ADEVICE2  ...
+%C%
+%C%
+%C%#############################################################
+%C%#                                                           #
+%C%#               CHANNEL 0 PROPERTIES                        #
+%C%#                                                           #
+%C%#############################################################
+%C%
+%C%CHANNEL 0
+%C%
+%C%#
+%C%# The following MYCALL, MODEM, PTT, etc. configuration items
+%C%# apply to the most recent CHANNEL.
+%C%#
+%C%
+%C%#
+%C%# Station identifier for this channel.
+%C%# Multiple channels can have the same or different names.
+%C%#
+%C%# It can be up to 6 letters and digits with an optional ssid.
+%C%# The APRS specification requires that it be upper case.
+%C%#
+%C%# Example (don't use this unless you are me):  MYCALL	WB2OSZ-5
+%C%#
+%C%
+%C%MYCALL N0CALL
+%C%
+%C%#
+%C%# Pick a suitable modem speed based on your situation.
+%C%#	1200 	Most common for VHF/UHF.  Default if not specified.
+%C%#	300	Low speed for HF SSB.
+%C%#	9600	High speed - Can't use Microphone and Speaker connections.
+%C%#
+%C%# In the simplest form, just specify the speed.
+%C%#
+%C%
+%C%MODEM 1200
+%C%#MODEM 300
+%C%#MODEM 9600
+%C%
+%C%#
+%C%# These are the defaults should be fine for most cases.  In special situations,
+%C%# you might want to specify different AFSK tones or the baseband mode which does
+%C%# not use AFSK.
+%C%#
+%C%#MODEM 1200 1200:2200
+%C%#MODEM 300  1600:1800
+%C%#MODEM 9600 0:0
+%C%#
+%C%#
+%C%# On HF SSB, you might want to use multiple demodulators on slightly different
+%C%# frequencies to compensate for stations off frequency.  Here we have 7 different
+%C%# demodulators at 30 Hz intervals.  This takes a lot of CPU power so you will
+%C%# probably need to reduce the audio sampling rate with the /n option.
+%C%
+%C%#MODEM 300 1600:1800 7@30 /4
+%C%
+%C%
+%C%#
+%C%# Uncomment line below to enable the DTMF decoder for this channel.
+%C%#
+%C%
+%C%#DTMF
+%C%
+%C%#
+%C%# If not using a VOX circuit, the transmitter Push to Talk (PTT)
+%C%# control is usually wired to a serial port with a suitable interface circuit.
+%C%# DON'T connect it directly!
+%C%#
+%C%# For the PTT command, specify the device and either RTS or DTR.
+%C%# RTS or DTR may be preceded by "-" to invert the signal.
+%C%# Both can be used for interfaces that want them driven with opposite polarity.
+%C%#
+%L%# COM1 can be used instead of /dev/ttyS0, COM2 for /dev/ttyS1, and so on.
+%L%#
+%C%
+%C%#PTT COM1 RTS
+%C%#PTT COM1 RTS -DTR
+%L%#PTT /dev/ttyUSB0 RTS
+%C%
+%L%#
+%L%# On Linux, you can also use general purpose I/O pins if
+%L%# your system is configured for user access to them.
+%L%# This would apply mostly to microprocessor boards, not a regular PC.
+%L%# See separate Raspberry Pi document for more details.
+%L%# The number may be preceded by "-" to invert the signal.
+%L%#
+%L%
+%L%#PTT GPIO 25
+%L%
+%C%# The Data Carrier Detect (DCD) signal can be sent to the same places
+%C%# as the PTT signal.  This could be used to light up an LED like a normal TNC.
+%C%
+%C%#DCD COM1 -DTR
+%L%#DCD GPIO 24
+%C%
+%C%
+%C%#############################################################
+%C%#                                                           #
+%C%#               CHANNEL 1 PROPERTIES                        #
+%C%#                                                           #
+%C%#############################################################
+%C%
+%C%#CHANNEL 1
+%C%
+%C%#
+%C%# Specify MYCALL, MODEM, PTT, etc. configuration items for
+%C%# CHANNEL 1.   Repeat for any other channels.
+%C%
+%C%
+%C%#############################################################
+%C%#                                                           #
+%C%#               TEXT TO SPEECH COMMAND FILE                 #
+%C%#                                                           #
+%C%#############################################################
+%C%
+%W%#SPEECH dwespeak.bat
+%L%#SPEECH dwespeak.sh
+%C%
+%C%
+%C%#############################################################
+%C%#                                                           #
+%C%#               VIRTUAL TNC SERVER PROPERTIES               #
+%C%#                                                           #
+%C%#############################################################
+%C%
+%C%#
+%C%# Dire Wolf acts as a virtual TNC and can communicate with
+%C%# client applications by different protocols:
+%C%#
+%C%#	- the "AGW TCPIP Socket Interface" - default port 8000
+%C%#	- KISS protocol over TCP socket - default port 8001
+%W%#	- KISS TNC via serial port
+%L%#	- KISS TNC via pseudo terminal   (-p command line option)
+%C%#
+%C%
+%C%AGWPORT 8000
+%C%KISSPORT 8001
+%C%
+%W%#
+%W%# Some applications are designed to operate with only a physical
+%W%# TNC attached to a serial port.  For these, we provide a virtual serial
+%W%# port that appears to be connected to a TNC.
+%W%#
+%W%# Take a look at the User Guide for instructions to set up
+%W%# two virtual serial ports named COM3 and COM4 connected by
+%W%# a null modem.
+%W%#
+%W%# Using the  configuration described, Dire Wolf will connect to
+%W%# COM3 and the client application will use COM4.
+%W%#
+%W%# Uncomment following line to use this feature.
+%W%
+%W%#NULLMODEM COM3
+%W%
+%W%
+%C%#
+%C%# It is sometimes possible to recover frames with a bad FCS.
+%C%# This applies to all channels.
+%C%#
+%C%#	0  [NONE] - Don't try to repair.
+%C%#	1  [SINGLE] - Attempt to fix single bit error.  (default)
+%C%#	2  [DOUBLE] - Also attempt to fix two adjacent bits.
+%C%#	... see User Guide for more values and in-depth discussion.
+%C%#
+%C%
+%C%#FIX_BITS 0
+%C%
+%C%#
+%C%#############################################################
+%C%#                                                           #
+%C%#               BEACONING PROPERTIES                        #
+%C%#                                                           #
+%C%#############################################################
+%C%
+%C%
+%C%#
+%C%# Beaconing is configured with these two commands:
+%C%#
+%C%#	PBEACON		- for a position report (usually yourself)
+%C%#	OBEACON		- for an object report (usually some other entity)
+%C%#
+%C%# Each has a series of keywords and values for options.
+%C%# See User Guide for details.
+%C%#
+%C%# Example:
+%C%#
+%C%# This results in a broadcast once every 10 minutes.
+%C%# Every half hour, it can travel via two digipeater hops.
+%C%# The others are kept local.
+%C%#
+%C%
+%C%#PBEACON delay=1  every=30 overlay=S symbol="digi" lat=42^37.14N long=071^20.83W power=50 height=20 gain=4 comment="Chelmsford MA" via=WIDE1-1,WIDE2-1
+%C%#PBEACON delay=11 every=30 overlay=S symbol="digi" lat=42^37.14N long=071^20.83W power=50 height=20 gain=4 comment="Chelmsford MA"
+%C%#PBEACON delay=21 every=30 overlay=S symbol="digi" lat=42^37.14N long=071^20.83W power=50 height=20 gain=4 comment="Chelmsford MA"
+%C%
+%C%
+%C%# With UTM coordinates instead of latitude and longitude.
+%C%
+%C%#PBEACON delay=1 every=10 overlay=S symbol="digi" zone=19T easting=307477 northing=4720178
+%C%
+%C%
+%C%#
+%C%# When the destination field is set to "SPEECH" the information part is
+%C%# converted to speech rather than transmitted as a data frame.
+%C%#
+%C%
+%C%#CBEACON dest="SPEECH" info="Club meeting tonight at 7 pm."
+%C%
+%C%# Similar for Morse code.  If SSID is specified, it is multiplied
+%C%# by 2 to get speed in words per minute (WPM).
+%C%
+%C%#CBEACON dest="MORSE-6" info="de MYCALL"
+%C%
+%C%
+%C%#
+%C%# Modify for your particular situation before removing
+%C%# the # comment character from the beginning of appropriate lines above.
+%C%#
+%C%
+%C%
+%C%#############################################################
+%C%#                                                           #
+%C%#               DIGIPEATER PROPERTIES                       #
+%C%#                                                           #
+%C%#############################################################
+%C%
+%C%#
+%C%# For most common situations, use something like this by removing
+%C%# the "#" from the beginning of the line below.
+%C%#
+%C%
+%C%#DIGIPEAT 0 0 ^WIDE[3-7]-[1-7]$|^TEST$ ^WIDE[12]-[12]$ TRACE
+%C%
+%C%# See User Guide for more explanation of what this means and how
+%C%# it can be customized for your particular needs.
+%C%
+%C%# Filtering can be used to limit was is digipeated.
+%C%# For example, only weather weather reports, received on channel 0,
+%C%# will be retransmitted on channel 1.
+%C%#
+%C%
+%C%#FILTER 0 1 t/wn
+%C%
+%C%
+%C%#############################################################
+%C%#                                                           #
+%C%#               INTERNET GATEWAY                            #
+%C%#                                                           #
+%C%#############################################################
+%C%
+%C%# First you need to specify the name of a Tier 2 server.
+%C%# The current preferred way is to use one of these regional rotate addresses:
+%C%
+%C%#	noam.aprs2.net 		- for North America
+%C%#	soam.aprs2.net		- for South America
+%C%#	euro.aprs2.net		- for Europe and Africa
+%C%#	asia.aprs2.net 		- for Asia
+%C%#	aunz.aprs2.net		- for Oceania
+%C%
+%C%#IGSERVER noam.aprs2.net
+%C%
+%C%# You also need to specify your login name and passcode.
+%C%# Contact the author if you can't figure out how to generate the passcode.
+%C%
+%C%#IGLOGIN WB2OSZ-5 123456
+%C%
+%C%# That's all you need for a receive only IGate which relays
+%C%# messages from the local radio channel to the global servers.
+%C%
+%C%# Some might want to send an IGate client position directly to a server
+%C%# without sending it over the air and relying on someone else to
+%C%# forward it to an IGate server.  This is done by using sendto=IG rather
+%C%# than a radio channel number. Overlay R for receive only, T for two way.
+%C%
+%C%#PBEACON sendto=IG delay=0:30 every=60:00 symbol="igate" overlay=R lat=42^37.14N long=071^20.83W
+%C%#PBEACON sendto=IG delay=0:30 every=60:00 symbol="igate" overlay=T lat=42^37.14N long=071^20.83W
+%C%
+%C%
+%C%# To relay messages from the Internet to radio, you need to add
+%C%# one more option with the transmit channel number and a VIA path.
+%C%
+%C%#IGTXVIA 0 WIDE1-1
+%C%
+%C%# You might want to apply a filter for what packets will be obtained from the server.
+%C%# Read about filters here:  http://www.aprs-is.net/javaprsfilter.aspx
+%C%# Example, positions and objects within 50 km of my location:
+%C%
+%C%#IGFILTER m/50
+%C%
+%C%# That is known as a server-side filter.  It is processed by the IGate server.
+%C%# You can also apply local filtering to limit what will be transmitted on the
+%C%# RF side.  For example, transmit only "messages" on channel 0 and weather
+%C%# reports on channel 1.
+%C%
+%C%#FILTER IG 0 t/m
+%C%#FILTER IG 1 t/wn
+%C%
+%C%# Finally, we don't want to flood the radio channel.
+%C%# The IGate function will limit the number of packets transmitted
+%C%# during 1 minute and 5 minute intervals.   If a limit would
+%C%# be exceeded, the packet is dropped and message is displayed in red.
+%C%
+%C%IGTXLIMIT 6 10
+%C%
+%C%
+%C%#############################################################
+%C%#                                                           #
+%C%#               APRStt GATEWAY                              #
+%C%#                                                           #
+%C%#############################################################
+%C%
+%C%#
+%C%# Dire Wolf can receive DTMF (commonly known as Touch Tone)
+%C%# messages and convert them to packet objects.
+%C%#
+%C%# See separate "APRStt-Implementation-Notes" document for details.
+%C%#
+%C%
+%C%#
+%C%# Sample gateway configuration based on:
+%C%#
+%C%#	http://www.aprs.org/aprstt/aprstt-coding24.txt
+%C%#	http://www.aprs.org/aprs-jamboree-2013.html
+%C%#
+%C%
+%C%# Define specific points.
+%C%
+%C%TTPOINT  B01  37^55.37N  81^7.86W
+%C%TTPOINT  B7495088  42.605237  -71.34456
+%C%TTPOINT  B934  42.605237  -71.34456
+%C%
+%C%TTPOINT B901  42.661279  -71.364452
+%C%TTPOINT B902  42.660411  -71.364419
+%C%TTPOINT B903  42.659046  -71.364452
+%C%TTPOINT B904  42.657578  -71.364602
+%C%
+%C%
+%C%# For location at given bearing and distance from starting point.
+%C%
+%C%TTVECTOR  B5bbbddd  37^55.37N  81^7.86W  0.01  mi
+%C%
+%C%# For location specified by x, y coordinates.
+%C%
+%C%TTGRID   Byyyxxx    37^50.00N  81^00.00W  37^59.99N  81^09.99W
+%C%
+%C%# UTM location for Lowell-Dracut-Tyngsborough State Forest.
+%C%
+%C%TTUTM  B6xxxyyy  19T  10  300000  4720000
+%C%
+%C%
+%C%
+%C%# Location for the corral.
+%C%
+%C%TTCORRAL   37^55.50N  81^7.00W  0^0.02N
+%C%
+%C%# Compact messages - Fixed locations xx and object yyy where
+%C%#   	Object numbers 100 - 199	= bicycle
+%C%#	Object numbers 200 - 299	= fire truck
+%C%#	Others				= dog
+%C%
+%C%TTMACRO  xx1yy  B9xx*AB166*AA2B4C5B3B0A1yy
+%C%TTMACRO  xx2yy  B9xx*AB170*AA3C4C7C3B0A2yy
+%C%TTMACRO  xxyyy  B9xx*AB180*AA3A6C4A0Ayyy
+%C%
+%C%TTMACRO  z  Cz
+%C%
+%C%# Receive on channel 0, Transmit object reports on channel 1 with optional via path.
+%C%# You probably want to put in a transmit delay on the APRStt channel so it
+%C%# it doesn't start sending a response before the user releases PTT.
+%C%# This is in 10 ms units so 100 means 1000 ms = 1 second.
+%C%
+%C%#TTOBJ 0 1 WIDE1-1
+%C%#CHANNEL 0
+%C%#DWAIT 100
+%C%
+%C%# Advertise gateway position with beacon.
+%C%
+%C%# OBEACON DELAY=0:15 EVERY=10:00 VIA=WIDE1-1 OBJNAME=WB2OSZ-tt SYMBOL=APRStt LAT=42^37.14N LONG=71^20.83W COMMENT="APRStt Gateway"
+%C%
+%C%
+%C%# Sample speech responses.
+%C%# Default is Morse code "R" for received OK and "?" for all errors.
+%C%
+%C%#TTERR  OK               SPEECH  Message Received.
+%C%#TTERR  D_MSG            SPEECH  D not implemented.
+%C%#TTERR  INTERNAL         SPEECH  Internal error.
+%C%#TTERR  MACRO_NOMATCH    SPEECH  No definition for digit sequence.
+%C%#TTERR  BAD_CHECKSUM     SPEECH  Bad checksum on call.
+%C%#TTERR  INVALID_CALL     SPEECH  Invalid callsign.
+%C%#TTERR  INVALID_OBJNAME  SPEECH  Invalid object name.
+%C%#TTERR  INVALID_SYMBOL   SPEECH  Invalid symbol.
+%C%#TTERR  INVALID_LOC      SPEECH  Invalid location.
+%C%#TTERR  NO_CALL          SPEECH  No call or object name.
+%C%#TTERR  SATSQ            SPEECH  Satellite square must be 4 digits.
+%C%#TTERR  SUFFIX_NO_CALL   SPEECH  Send full call before using suffix.
+%C%
\ No newline at end of file
diff --git a/conf/install_conf.cmake b/conf/install_conf.cmake
new file mode 100644
index 00000000..af111a76
--- /dev/null
+++ b/conf/install_conf.cmake
@@ -0,0 +1,23 @@
+if(NOT EXISTS $ENV{HOME}/direwolf.conf)
+  configure_file("${CUSTOM_BINARY_DIR}/direwolf.conf" $ENV{HOME})
+endif()
+
+if(NOT EXISTS $ENV{HOME}/sdr.conf)
+  configure_file("${CUSTOM_CONF_DIR}/sdr.conf" $ENV{HOME})
+endif()
+
+if(NOT EXISTS $ENV{HOME}/dw-start.sh)
+  configure_file("${CUSTOM_SCRIPTS_DIR}/dw-start.sh" $ENV{HOME})
+endif()
+
+if(NOT EXISTS $ENV{HOME}/telem-m0xer-3.txt)
+  configure_file("${CUSTOM_TELEMETRY_DIR}/telem-m0xer-3.txt" $ENV{HOME})
+endif()
+
+if(NOT EXISTS $ENV{HOME}/telem-balloon.conf)
+  configure_file("${CUSTOM_TELEMETRY_DIR}/telem-balloon.conf" $ENV{HOME})
+endif()
+
+if(NOT EXISTS $ENV{HOME}/telem-volts.conf)
+  configure_file("${CUSTOM_TELEMETRY_DIR}/telem-volts.conf" $ENV{HOME})
+endif()
diff --git a/sdr.conf b/conf/sdr.conf
similarity index 100%
rename from sdr.conf
rename to conf/sdr.conf
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
new file mode 100644
index 00000000..9f7c40e4
--- /dev/null
+++ b/data/CMakeLists.txt
@@ -0,0 +1,94 @@
+#
+# The destination field is often used to identify the manufacturer/model.
+# These are not hardcoded into Dire Wolf.  Instead they are read from
+# a file called tocalls.txt at application start up time.
+#
+# The original permanent symbols are built in but the "new" symbols,
+# using overlays, are often updated.  These are also read from files.
+#
+# You can obtain an updated copy by typing "make data-update".
+# This is not part of the normal build process.  You have to do this explicitly.
+#
+# The locations below appear to be the most recent.
+# The copy at http://www.aprs.org/tocalls.txt is out of date.
+#
+
+include(ExternalProject)
+
+set(TOCALLS_TXT "tocalls.txt")
+set(TOCALLS_TXT_BKP "tocalls.txt.old")
+set(TOCALLS_URL "http://www.aprs.org/aprs11/tocalls.txt")
+set(SYMBOLS-NEW_TXT "symbols-new.txt")
+set(SYMBOLS-NEW_TXT_BKP "symbols-new.txt.old")
+set(SYMBOLS-NEW_URL "http://www.aprs.org/symbols/symbols-new.txt")
+set(SYMBOLSX_TXT "symbolsX.txt")
+set(SYMBOLSX_TXT_BKP "symbolsX.txt.old")
+set(SYMBOLSX_URL "http://www.aprs.org/symbols/symbolsX.txt")
+set(CUSTOM_BINARY_DATA_DIR "${CMAKE_BINARY_DIR}/data")
+
+# we can also move to a separate cmake file and use file(download)
+# see conf/install_conf.cmake as example
+file(COPY "${CUSTOM_DATA_DIR}/${TOCALLS_TXT}" DESTINATION "${CUSTOM_BINARY_DATA_DIR}")
+file(COPY "${CUSTOM_DATA_DIR}/${SYMBOLS-NEW_TXT}" DESTINATION "${CUSTOM_BINARY_DATA_DIR}")
+file(COPY "${CUSTOM_DATA_DIR}/${SYMBOLSX_TXT}" DESTINATION "${CUSTOM_BINARY_DATA_DIR}")
+
+add_custom_target(data_rename
+  COMMAND ${CMAKE_COMMAND} -E rename "${CUSTOM_BINARY_DATA_DIR}/${TOCALLS_TXT}" "${CUSTOM_BINARY_DATA_DIR}/${TOCALLS_TXT_BKP}"
+  COMMAND ${CMAKE_COMMAND} -E rename "${CUSTOM_BINARY_DATA_DIR}/${SYMBOLS-NEW_TXT}" "${CUSTOM_BINARY_DATA_DIR}/${SYMBOLS-NEW_TXT_BKP}"
+  COMMAND ${CMAKE_COMMAND} -E rename "${CUSTOM_BINARY_DATA_DIR}/${SYMBOLSX_TXT}" "${CUSTOM_BINARY_DATA_DIR}/${SYMBOLSX_TXT_BKP}"
+  )
+
+ExternalProject_Add(download_tocalls
+  DEPENDS data_rename
+  URL ${TOCALLS_URL}
+  PREFIX ""
+  DOWNLOAD_DIR "${CUSTOM_BINARY_DATA_DIR}"
+  DOWNLOAD_NAME "${TOCALLS_TXT}"
+  DOWNLOAD_NO_EXTRACT 0
+  EXCLUDE_FROM_ALL 1
+  UPDATE_COMMAND ""
+  PATCH_COMMAND ""
+  CONFIGURE_COMMAND ""
+  BUILD_COMMAND ""
+  INSTALL_COMMAND ""
+  TEST_COMMAND ""
+  )
+
+ExternalProject_Add(download_symbols-new
+  DEPENDS data_rename
+  URL ${SYMBOLS-NEW_URL}
+  PREFIX ""
+  DOWNLOAD_DIR "${CUSTOM_BINARY_DATA_DIR}"
+  DOWNLOAD_NAME "${SYMBOLS-NEW_TXT}"
+  DOWNLOAD_NO_EXTRACT 0
+  EXCLUDE_FROM_ALL 1
+  UPDATE_COMMAND ""
+  PATCH_COMMAND ""
+  CONFIGURE_COMMAND ""
+  BUILD_COMMAND ""
+  INSTALL_COMMAND ""
+  TEST_COMMAND ""
+  )
+
+ExternalProject_Add(download_symbolsx
+  DEPENDS data_rename
+  URL ${SYMBOLSX_URL}
+  PREFIX ""
+  DOWNLOAD_DIR "${CUSTOM_BINARY_DATA_DIR}"
+  DOWNLOAD_NAME "${SYMBOLSX_TXT}"
+  DOWNLOAD_NO_EXTRACT 0
+  EXCLUDE_FROM_ALL 1
+  UPDATE_COMMAND ""
+  PATCH_COMMAND ""
+  CONFIGURE_COMMAND ""
+  BUILD_COMMAND ""
+  INSTALL_COMMAND ""
+  TEST_COMMAND ""
+  )
+
+add_custom_target(update-data)
+add_dependencies(update-data data_rename download_tocalls download_symbols-new download_symbolsx)
+
+install(FILES "${CUSTOM_BINARY_DATA_DIR}/${TOCALLS_TXT}" DESTINATION ${INSTALL_DATA_DIR})
+install(FILES "${CUSTOM_BINARY_DATA_DIR}/${SYMBOLS-NEW_TXT}" DESTINATION ${INSTALL_DATA_DIR})
+install(FILES "${CUSTOM_BINARY_DATA_DIR}/${SYMBOLSX_TXT}" DESTINATION ${INSTALL_DATA_DIR})
diff --git a/symbols-new.txt b/data/symbols-new.txt
similarity index 100%
rename from symbols-new.txt
rename to data/symbols-new.txt
diff --git a/symbolsX.txt b/data/symbolsX.txt
similarity index 100%
rename from symbolsX.txt
rename to data/symbolsX.txt
diff --git a/tocalls.txt b/data/tocalls.txt
similarity index 100%
rename from tocalls.txt
rename to data/tocalls.txt
diff --git a/debian/README.Debian b/debian/README.Debian
new file mode 100644
index 00000000..853f55f0
--- /dev/null
+++ b/debian/README.Debian
@@ -0,0 +1,5 @@
+In order to start direwolf as a service the configuration file
+/etc/direwolf.conf needs to exist. Otherwise attempting to start the service
+returns an 'Assertion failed' error. An example configuration file which may be
+used as a model can be found in
+/usr/share/doc/direwolf/examples/direwolf.conf.gz
diff --git a/debian/changelog b/debian/changelog
new file mode 120000
index 00000000..cf547089
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1 @@
+../CHANGES.md
\ No newline at end of file
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 00000000..9a037142
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+10
\ No newline at end of file
diff --git a/debian/control b/debian/control
new file mode 100644
index 00000000..106663b5
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,30 @@
+Source: direwolf
+Maintainer: Debian Hamradio Maintainers <debian-hams@lists.debian.org>
+Uploaders: Iain R. Learmonth <irl@debian.org>
+Section: hamradio
+Priority: optional
+Build-Depends: debhelper (>= 9),
+               libasound2-dev,
+               libgps-dev,
+               libhamlib-dev,
+	       dh-systemd
+Standards-Version: 4.1.0
+Vcs-Browser: https://anonscm.debian.org/cgit/pkg-hamradio/direwolf.git/
+Vcs-Git: https://anonscm.debian.org/git/pkg-hamradio/direwolf.git
+Homepage: https://github.com/wb2osz/direwolf
+
+Package: direwolf
+Architecture: alpha amd64 arm64 armel armhf i386 mipsel ppc64el sh4 x32
+Depends: ${shlibs:Depends},
+         ${misc:Depends},
+         adduser,
+         libhamlib2
+Suggests: gpsd, libhamlib-utils
+Breaks: direwolf-docs (<< 1.1-1)
+Replaces: direwolf-docs (<< 1.1-1)
+Description: Soundcard TNC for APRS
+ Dire Wolf is a software "soundcard" modem/TNC and APRS encoder/decoder. It can
+ be used stand-alone to receive APRS messages, as a digipeater, APRStt gateway,
+ or Internet Gateway (IGate). It can also be used as a virtual TNC for other
+ applications such as APRSIS32, UI-View32, Xastir, APRS-TW, YAAC, UISS, Linux
+ AX25, SARTrack, and many others.
\ No newline at end of file
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 00000000..b546bf71
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,176 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: direwolf
+Files-Excluded: doc/*.pdf
+Source: https://github.com/wb2osz/direwolf
+Comment:
+ The files in misc/ are copied directly from the Cygwin source code. These are
+ listed here as dual licensed as they are both part of the Cygwin distribution
+ and originally part of BSD. See misc/README-dire-wolf.txt for more information.
+ .
+ Please see ftp-master's comments on this here:
+ https://lists.debian.org/debian-hams/2014/09/msg00063.html
+ https://lists.debian.org/debian-hams/2014/10/msg00003.html
+
+Files: *
+Copyright: (C) 2011-2014 John Langner WB2OSZ
+License: GPL-2+
+
+Files: geotranz/*
+Copyright: National Geospatial-Intelligence Agency
+License: Permissive-NGA
+
+Files: regex/*
+Copyright: (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+License: LGPL-2.1+
+
+Files: misc/strcasestr.c
+Copyright:
+ (C) 1990, 1993 The Regents of the University of California
+ (C) RedHat
+License: BSD-4-clause or GPL-2+
+
+Files: misc/strtok_r.c misc/strsep.c
+Copyright:
+ (C) 1988 Regents of the University of California
+ (C) RedHat
+License: BSD-3-clause or GPL-2+
+
+Files: debian/*
+Copyright: (C) 2014 Iain R. Learmonth <irl@fsfe.org>
+License: GPL-2+
+
+License: BSD-3-clause
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ .
+ 1. Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+ .
+ 2. Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+ .
+ 3. Neither the name of the University nor the names of its contributors
+    may be used to endorse or promote products derived from this software
+    without specific prior written permission.
+ .
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+
+License: BSD-4-clause
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ .
+ 1. Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+ .
+ 2. Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+ .
+ 3. All advertising materials mentioning features or use of this software
+    must display the following acknowledgement:
+        This product includes software developed by the University of
+        California, Berkeley and its contributors.
+ .
+ 4. Neither the name of the University nor the names of its contributors
+    may be used to endorse or promote products derived from this software
+    without specific prior written permission.
+ .
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+
+License: GPL-2+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+ .
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ .
+ On Debian systems, a copy of the full license text is available in
+ /usr/share/common-licenses/GPL-2.
+
+License: LGPL-2.1+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+ .
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ Lesser General Public License for more details.
+ .
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ .
+ On Debian systems, a copy of the full license text is available in
+ /usr/share/common-licenses/LGPL-2.1.
+
+License: Permissive-NGA
+ 1. The GEOTRANS source code ("the software") is provided free of charge by the
+ National Geospatial-Intelligence Agency (NGA) of the United States Department
+ of Defense. Although NGA makes no copyright claim under Title 17 U.S.C., NGA
+ claims copyrights in the source code under other legal regimes. NGA hereby
+ grants to each user of the software a license to use and distribute the
+ software, and develop derivative works.
+ .
+ 2. NGA requests that products developed using the software credit the source of
+ the software with the following statement, "The product was developed using
+ GEOTRANS, a product of the National Geospatial-Intelligence Agency (NGA) and
+ U.S. Army Engineering Research and Development Center."  Do not use the name
+ GEOTRANS for any derived work.
+ .
+ 3. Warranty Disclaimer: The software was developed to meet only the internal
+ requirements of the National Geospatial-Intelligence Agency (NGA). The software
+ is provided "as is," and no warranty, express or implied, including but not
+ limited to the implied warranties of merchantability and fitness for particular
+ purpose or arising by statute or otherwise in law or from a course of dealing
+ or usage in trade, is made by NGA as to the accuracy and functioning of the
+ software.
+ .
+ 4. NGA and its personnel are not required to provide technical support or
+ general assistance with respect to public use of the software.  Government
+ customers may contact NGA.
+ .
+ 5. Neither NGA nor its personnel will be liable for any claims, losses, or
+ damages arising from or connected with the use of the software. The user agrees
+ to hold harmless the United States National Geospatial-Intelligence Agency
+ (NGA). The user's sole and exclusive remedy is to stop using the software.
+ .
+ 6. Please be advised that pursuant to the United States Code, 10 U.S.C. 425,
+ the name of the National Geospatial-Intelligence Agency, the initials "NGA",
+ the seal of the National Geospatial-Intelligence Agency, or any colorable
+ imitation thereof shall not be used to imply approval, endorsement, or
+ authorization of a product without prior written permission from United States
+ Secretary of Defense.  Do not create the impression that NGA, the Secretary of
+ Defense or the Director of National Intelligence has endorsed any product
+ derived from GEOTRANS.
\ No newline at end of file
diff --git a/debian/direwolf.postinst b/debian/direwolf.postinst
new file mode 100644
index 00000000..e42b9f83
--- /dev/null
+++ b/debian/direwolf.postinst
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+set -e
+
+. /usr/share/debconf/confmodule
+
+add_group_if_missing() {
+    if ! getent group direwolf >/dev/null; then
+        addgroup --system --force-badname direwolf || true
+    fi
+}
+
+add_user_if_missing() {
+    if ! id -u direwolf > /dev/null 2>&1; then
+        mkdir -m 02750 -p /var/lib/direwolf
+        adduser --system --home /var/lib/direwolf \
+          --disabled-password \
+          --force-badname direwolf \
+          --ingroup direwolf
+        adduser direwolf dialout
+        chown direwolf:direwolf /var/lib/direwolf
+    fi
+}
+
+add_group_if_missing
+add_user_if_missing
+
+db_stop
+
+#DEBHELPER#
+
+exit 0
+
diff --git a/debian/direwolf.postrm b/debian/direwolf.postrm
new file mode 100644
index 00000000..886af3d2
--- /dev/null
+++ b/debian/direwolf.postrm
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+    purge)
+        rm -rf /var/lib/direwolf/
+    ;;
+    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+    ;;
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+esac
+
+#DEBHELPER#
+
+exit 0
+
diff --git a/debian/rules b/debian/rules
new file mode 100644
index 00000000..b8c22228
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,7 @@
+#!/usr/bin/make -f
+
+%:
+	dh $@ --parallel
+
+override_dh_auto_configure:
+	dh_auto_configure -- -DFORCE_SSE=1
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 00000000..46ebe026
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
\ No newline at end of file
diff --git a/direwolf.spec b/direwolf.spec
deleted file mode 100644
index 4ac7d46c..00000000
--- a/direwolf.spec
+++ /dev/null
@@ -1,103 +0,0 @@
-#%global git_commit b2548ec58f44f4b651626757a166b9f4f18d8000
-%global git_commit 37179479caf0bf36adf8c9bc0fde641884edaeac
-%global git_date 20171216
-
-%global git_short_commit %(echo %{git_commit} | cut -c -8)
-%global git_suffix %{git_date}git%{git_short_commit}
-
-Name:           direwolf
-Version:        1.5Beta
-Release:        1.%{git_suffix}%{?dist}
-Summary:        Soundcard based AX.25 TNC
-
-Group:          Applications/Communications
-License:        GPLv2
-URL:            https://github.com/wb2osz/direwolf
-#Source0:        https://github.com/wb2osz/direwolf/archive/%{name}-%{version}.tar.gz
-Source:         %{name}-%{version}-%{git_suffix}.tgz
-Packager:       David Ranch (KI6ZHD) <dranch@trinnet.net>
-Distribution:   RedHat Linux
-
-Patch0:         direwolf-1.5-makefile.patch
-
-BuildRequires:  automake
-BuildRequires:  alsa-lib-devel
-
-#If the gpsd and gpsd-devel packages are installed, Direwolf will add gps support
-
-
-
-%description
-Dire Wolf is a software "soundcard" modem/TNC and APRS encoder/decoder.   It can 
-be used stand-alone to receive APRS messages, as a digipeater, APRStt gateway, 
-or Internet Gateway (IGate).    It can also be used as a virtual TNC for other 
-applications such as APRSIS32, UI-View32, Xastir, APRS-TW, YAAC, UISS, 
-Linux AX25, SARTrack, RMS Express, and many others.
-
-%prep
-
-%setup -q -n %{name}-%{version}
-%patch0 -p0
-
-%build 
-
-make -f Makefile.linux
-#make -f Makefile.linux tocalls-symbols
-make %{?_smp_mflags}
-
-
-%install
-make install INSTALLDIR=$RPM_BUILD_ROOT/usr
-make install-conf INSTALLDIR=$RPM_BUILD_ROOT/usr
-
-# Install icon
-mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/pixmaps/direwolf/
-cp dw-icon.png ${RPM_BUILD_ROOT}%{_datadir}/pixmaps/direwolf/
-mv symbols-new.txt ${RPM_BUILD_ROOT}%{_docdir}/%{name}/
-mv symbolsX.txt ${RPM_BUILD_ROOT}%{_docdir}/%{name}/
-mv tocalls.txt ${RPM_BUILD_ROOT}%{_docdir}/%{name}/
-desktop-file-install \
-        --dir=${RPM_BUILD_ROOT}%{_datadir}/applications direwolf.desktop
-#temp bug
-#non echo "fixing $RPM_BUILD_ROOT/%{_bindir}/bin"
-#non rm -f $RPM_BUILD_ROOT/usr/bin
-
-
-%files
-%{_sysconfdir}/ax25/direwolf.conf
-%{_sysconfdir}/ax25/sdr.conf
-%{_sysconfdir}/ax25/telemetry-toolkit/telem-balloon.conf
-%{_sysconfdir}/ax25/telemetry-toolkit/telem-m0xer-3.txt
-%{_sysconfdir}/ax25/telemetry-toolkit/telem-volts.conf
-%{_sysconfdir}/udev/rules.d/99-direwolf-cmedia.rules
-%{_bindir}/* 
-%{_datadir}/pixmaps/direwolf/dw-icon.png
-%{_datadir}/applications/%{name}.desktop
-%{_datadir}/direwolf/*
-%{_docdir}/*
-%{_mandir}/man1/*
-
-
-
-%changelog
-* Sat Dec 16 2017 David Ranch <dranch@trinnet.net> - 1.5-1
-- New 1.5-Beta version from Git 
-* Sun Apr 2 2017 David Ranch <dranch@trinnet.net> - 1.4-1
-- New 1.4-Beta1 version from Git 
-* Sun Mar 5 2017 David Ranch <dranch@trinnet.net> - 1.4-1
-- New 1.4-H Alpha version from Git version
-* Fri Aug 26 2016 David Ranch <dranch@trinnet.net> - 1.4-1
-- New version
-* Fri May 06 2016 David Ranch <dranch@trinnet.net> - 1.3-1
-- New version
-* Sat Sep 12 2015 David Ranch <dranch@trinnet.net> - 1.3F-1
-- New version with new features
-* Sun May 10 2015 David Ranch <dranch@trinnet.net> - 1.2E-1
-- New version that supports a PASSALL function
-- Updated the Makefile.linux patch
-* Sat Mar 21 2015 David Ranch <dranch@trinnet.net> - 1.2C-1
-- changed to support different make installation variable
-* Sat Feb 14 2015 David Ranch <dranch@trinnet.net> - 1.2b-1
-- new spec file
-* Sat Dec 20 2014 David Ranch <dranch@trinnet.net> - 1.1b1-1
-- new spec file
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
new file mode 100644
index 00000000..c768d5eb
--- /dev/null
+++ b/doc/CMakeLists.txt
@@ -0,0 +1,18 @@
+
+install(FILES "${CUSTOM_DOC_DIR}/README.md" DESTINATION ${INSTALL_DOC_DIR})
+install(FILES "${CUSTOM_DOC_DIR}/2400-4800-PSK-for-APRS-Packet-Radio.pdf" DESTINATION ${INSTALL_DOC_DIR})
+install(FILES "${CUSTOM_DOC_DIR}/A-Better-APRS-Packet-Demodulator-Part-1-1200-baud.pdf" DESTINATION ${INSTALL_DOC_DIR})
+install(FILES "${CUSTOM_DOC_DIR}/A-Better-APRS-Packet-Demodulator-Part-2-9600-baud.pdf" DESTINATION ${INSTALL_DOC_DIR})
+install(FILES "${CUSTOM_DOC_DIR}/A-Closer-Look-at-the-WA8LMF-TNC-Test-CD.pdf" DESTINATION ${INSTALL_DOC_DIR})
+install(FILES "${CUSTOM_DOC_DIR}/APRS-Telemetry-Toolkit.pdf" DESTINATION ${INSTALL_DOC_DIR})
+install(FILES "${CUSTOM_DOC_DIR}/APRStt-Implementation-Notes.pdf" DESTINATION ${INSTALL_DOC_DIR})
+install(FILES "${CUSTOM_DOC_DIR}/APRStt-interface-for-SARTrack.pdf" DESTINATION ${INSTALL_DOC_DIR})
+install(FILES "${CUSTOM_DOC_DIR}/APRStt-Listening-Example.pdf" DESTINATION ${INSTALL_DOC_DIR})
+install(FILES "${CUSTOM_DOC_DIR}/Bluetooth-KISS-TNC.pdf" DESTINATION ${INSTALL_DOC_DIR})
+install(FILES "${CUSTOM_DOC_DIR}/Going-beyond-9600-baud.pdf" DESTINATION ${INSTALL_DOC_DIR})
+install(FILES "${CUSTOM_DOC_DIR}/Raspberry-Pi-APRS.pdf" DESTINATION ${INSTALL_DOC_DIR})
+install(FILES "${CUSTOM_DOC_DIR}/Raspberry-Pi-APRS-Tracker.pdf" DESTINATION ${INSTALL_DOC_DIR})
+install(FILES "${CUSTOM_DOC_DIR}/Raspberry-Pi-SDR-IGate.pdf" DESTINATION ${INSTALL_DOC_DIR})
+install(FILES "${CUSTOM_DOC_DIR}/Successful-APRS-IGate-Operation.pdf" DESTINATION ${INSTALL_DOC_DIR})
+install(FILES "${CUSTOM_DOC_DIR}/User-Guide.pdf" DESTINATION ${INSTALL_DOC_DIR})
+install(FILES "${CUSTOM_DOC_DIR}/WA8LMF-TNC-Test-CD-Results.pdf" DESTINATION ${INSTALL_DOC_DIR})
diff --git a/dw-icon.rc b/dw-icon.rc
deleted file mode 100644
index ce34b403..00000000
--- a/dw-icon.rc
+++ /dev/null
@@ -1 +0,0 @@
-MAINICON ICON "dw-icon.ico"
\ No newline at end of file
diff --git a/LICENSE-other.txt b/external/LICENSE
similarity index 100%
rename from LICENSE-other.txt
rename to external/LICENSE
diff --git a/external/geotranz/CMakeLists.txt b/external/geotranz/CMakeLists.txt
new file mode 100644
index 00000000..576d8b82
--- /dev/null
+++ b/external/geotranz/CMakeLists.txt
@@ -0,0 +1,17 @@
+# UTM, USNG, MGRS conversions
+
+set(GEOTRANZ_LIBRARIES geotranz CACHE INTERNAL "geotranz")
+
+list(APPEND geotranz_SOURCES
+  error_string.c
+  mgrs.c
+  polarst.c
+  tranmerc.c
+  ups.c
+  usng.c
+  utm.c
+  )
+
+add_library(geotranz STATIC
+  ${geotranz_SOURCES}
+  )
diff --git a/geotranz/README-FIRST.txt b/external/geotranz/README-FIRST.txt
similarity index 100%
rename from geotranz/README-FIRST.txt
rename to external/geotranz/README-FIRST.txt
diff --git a/geotranz/error_string.c b/external/geotranz/error_string.c
similarity index 100%
rename from geotranz/error_string.c
rename to external/geotranz/error_string.c
diff --git a/geotranz/error_string.h b/external/geotranz/error_string.h
similarity index 100%
rename from geotranz/error_string.h
rename to external/geotranz/error_string.h
diff --git a/geotranz/mgrs.c b/external/geotranz/mgrs.c
similarity index 100%
rename from geotranz/mgrs.c
rename to external/geotranz/mgrs.c
diff --git a/geotranz/mgrs.h b/external/geotranz/mgrs.h
similarity index 100%
rename from geotranz/mgrs.h
rename to external/geotranz/mgrs.h
diff --git a/geotranz/polarst.c b/external/geotranz/polarst.c
similarity index 100%
rename from geotranz/polarst.c
rename to external/geotranz/polarst.c
diff --git a/geotranz/polarst.h b/external/geotranz/polarst.h
similarity index 100%
rename from geotranz/polarst.h
rename to external/geotranz/polarst.h
diff --git a/geotranz/readme.txt b/external/geotranz/readme.txt
similarity index 100%
rename from geotranz/readme.txt
rename to external/geotranz/readme.txt
diff --git a/geotranz/releasenotes.txt b/external/geotranz/releasenotes.txt
similarity index 100%
rename from geotranz/releasenotes.txt
rename to external/geotranz/releasenotes.txt
diff --git a/geotranz/tranmerc.c b/external/geotranz/tranmerc.c
similarity index 100%
rename from geotranz/tranmerc.c
rename to external/geotranz/tranmerc.c
diff --git a/geotranz/tranmerc.h b/external/geotranz/tranmerc.h
similarity index 100%
rename from geotranz/tranmerc.h
rename to external/geotranz/tranmerc.h
diff --git a/geotranz/ups.c b/external/geotranz/ups.c
similarity index 100%
rename from geotranz/ups.c
rename to external/geotranz/ups.c
diff --git a/geotranz/ups.h b/external/geotranz/ups.h
similarity index 100%
rename from geotranz/ups.h
rename to external/geotranz/ups.h
diff --git a/geotranz/usng.c b/external/geotranz/usng.c
similarity index 100%
rename from geotranz/usng.c
rename to external/geotranz/usng.c
diff --git a/geotranz/usng.h b/external/geotranz/usng.h
similarity index 100%
rename from geotranz/usng.h
rename to external/geotranz/usng.h
diff --git a/geotranz/utm.c b/external/geotranz/utm.c
similarity index 100%
rename from geotranz/utm.c
rename to external/geotranz/utm.c
diff --git a/geotranz/utm.h b/external/geotranz/utm.h
similarity index 100%
rename from geotranz/utm.h
rename to external/geotranz/utm.h
diff --git a/external/misc/CMakeLists.txt b/external/misc/CMakeLists.txt
new file mode 100644
index 00000000..07b10b2e
--- /dev/null
+++ b/external/misc/CMakeLists.txt
@@ -0,0 +1,41 @@
+
+set(MISC_LIBRARIES misc CACHE INTERNAL "misc")
+
+include_directories(
+  ${CMAKE_SOURCE_DIR}/src
+  )
+
+if(LINUX)
+  list(APPEND misc_SOURCES
+    # Provide our own copy of strlcpy and strlcat
+    # because they are not included with Linux.
+    ${CUSTOM_MISC_DIR}/strlcpy.c
+    ${CUSTOM_MISC_DIR}/strlcat.c
+    )
+
+  add_library(misc STATIC
+    ${misc_SOURCES}
+    )
+
+elseif(WIN32 OR CYGWIN) # windows
+
+  list(APPEND misc_SOURCES
+    # There are several string functions found in Linux
+    # but not on Windows.  Need to provide our own copy.
+    ${CUSTOM_MISC_DIR}/strsep.c
+    ${CUSTOM_MISC_DIR}/strtok_r.c
+    ${CUSTOM_MISC_DIR}/strcasestr.c
+    ${CUSTOM_MISC_DIR}/strlcpy.c
+    ${CUSTOM_MISC_DIR}/strlcat.c
+    )
+
+  add_library(misc STATIC
+    ${misc_SOURCES}
+    )
+
+else()
+
+  # on macOS, OpenBSD and FreeBSD not misc is necessary
+  set(MISC_LIBRARIES "" CACHE INTERNAL "")
+
+endif()
diff --git a/misc/README-dire-wolf.txt b/external/misc/README
similarity index 100%
rename from misc/README-dire-wolf.txt
rename to external/misc/README
diff --git a/misc/strcasestr.c b/external/misc/strcasestr.c
similarity index 100%
rename from misc/strcasestr.c
rename to external/misc/strcasestr.c
diff --git a/misc/strlcat.c b/external/misc/strlcat.c
similarity index 100%
rename from misc/strlcat.c
rename to external/misc/strlcat.c
diff --git a/misc/strlcpy.c b/external/misc/strlcpy.c
similarity index 100%
rename from misc/strlcpy.c
rename to external/misc/strlcpy.c
diff --git a/misc/strsep.c b/external/misc/strsep.c
similarity index 100%
rename from misc/strsep.c
rename to external/misc/strsep.c
diff --git a/misc/strtok_r.c b/external/misc/strtok_r.c
similarity index 100%
rename from misc/strtok_r.c
rename to external/misc/strtok_r.c
diff --git a/external/regex/CMakeLists.txt b/external/regex/CMakeLists.txt
new file mode 100644
index 00000000..67207639
--- /dev/null
+++ b/external/regex/CMakeLists.txt
@@ -0,0 +1,24 @@
+set(REGEX_LIBRARIES "" CACHE INTERNAL "")
+
+if(WIN32 OR CYGWIN) # windows
+
+  set(REGEX_LIBRARIES regex CACHE INTERNAL "regex")
+
+  list(APPEND regex_SOURCES
+    # When building for Linux, we use regular expression
+    # functions supplied by the gnu C library.
+    # For the native WIN32 version, we need to use our own copy.
+    # These were copied from http://gnuwin32.sourceforge.net/packages/regex.htm
+    # Consider upgrading from https://www.gnu.org/software/libc/sources.html
+    ${CUSTOM_REGEX_DIR}/regex.c
+    )
+
+  add_library(regex STATIC
+    ${regex_SOURCES}
+    )
+
+  set_target_properties(regex
+    PROPERTIES COMPILE_FLAGS "-Dbool=int -Dtrue=1 -Dfalse=0 -DUSE_REGEX_STATIC"
+    )
+
+endif()
diff --git a/regex/COPYING b/external/regex/COPYING
similarity index 100%
rename from regex/COPYING
rename to external/regex/COPYING
diff --git a/regex/INSTALL b/external/regex/INSTALL
similarity index 100%
rename from regex/INSTALL
rename to external/regex/INSTALL
diff --git a/regex/LICENSES b/external/regex/LICENSES
similarity index 100%
rename from regex/LICENSES
rename to external/regex/LICENSES
diff --git a/regex/NEWS b/external/regex/NEWS
similarity index 100%
rename from regex/NEWS
rename to external/regex/NEWS
diff --git a/regex/README b/external/regex/README
similarity index 100%
rename from regex/README
rename to external/regex/README
diff --git a/regex/README-dire-wolf.txt b/external/regex/README-dire-wolf.txt
similarity index 100%
rename from regex/README-dire-wolf.txt
rename to external/regex/README-dire-wolf.txt
diff --git a/regex/re_comp.h b/external/regex/re_comp.h
similarity index 100%
rename from regex/re_comp.h
rename to external/regex/re_comp.h
diff --git a/regex/regcomp.c b/external/regex/regcomp.c
similarity index 100%
rename from regex/regcomp.c
rename to external/regex/regcomp.c
diff --git a/regex/regex.c b/external/regex/regex.c
similarity index 100%
rename from regex/regex.c
rename to external/regex/regex.c
diff --git a/regex/regex.h b/external/regex/regex.h
similarity index 100%
rename from regex/regex.h
rename to external/regex/regex.h
diff --git a/regex/regex_internal.c b/external/regex/regex_internal.c
similarity index 100%
rename from regex/regex_internal.c
rename to external/regex/regex_internal.c
diff --git a/regex/regex_internal.h b/external/regex/regex_internal.h
similarity index 100%
rename from regex/regex_internal.h
rename to external/regex/regex_internal.h
diff --git a/regex/regexec.c b/external/regex/regexec.c
similarity index 100%
rename from regex/regexec.c
rename to external/regex/regexec.c
diff --git a/generic.conf b/generic.conf
deleted file mode 100644
index 223007f4..00000000
--- a/generic.conf
+++ /dev/null
@@ -1,573 +0,0 @@
-C#############################################################
-C#                                                           #
-C#               Configuration file for Dire Wolf            #
-C#                                                           #
-L#                   Linux version                           #
-W#                   Windows version                         #
-M#                   Macintosh version                       #
-C#                                                           #
-C#############################################################
-R
-R
-R	The sample config file was getting pretty messy
-R	with the Windows and Linux differences.
-R	It would be a maintenance burden to keep most of
-R	two different versions in sync.
-R	This common source is now used to generate the 
-R	two different variations while having only a single
-R	copy of the common parts.
-R
-R	The first column contains one of the following:
-R
-R		R	remark which is discarded.
-R		C	common to both versions.
-R		W	Windows version only.
-R		L	Linux version only.
-R		M	Macintosh version and possibly others (portaudio used).
-R
-C#
-C# Consult the User Guide for more details on configuration options.
-C#
-C#
-C# These are the most likely settings you might change:
-C#
-C#	(1)   	MYCALL 	-  call sign and SSID for your station.
-C#
-C#			Look for lines starting with MYCALL and 
-C#			change NOCALL to your own.
-C#
-C#	(2)	PBEACON	-  enable position beaconing.
-C#
-C#			Look for lines starting with PBEACON and 
-C#			modify for your call, location, etc.
-C#
-C#	(3)	DIGIPEATER  -  configure digipeating rules.
-C#
-C#			Look for lines starting with DIGIPEATER.
-C#			Most people will probably use the given example.
-C#			Just remove the "#" from the start of the line
-C#			to enable it.
-C#
-C#	(4)	IGSERVER, IGLOGIN  - IGate server and login
-C#
-C#			Configure an IGate client to relay messages between 
-C#			radio and internet servers.
-C#
-C#
-C# The default location is "direwolf.conf" in the current working directory.
-L# On Linux, the user's home directory will also be searched.
-C# An alternate configuration file location can be specified with the "-c" command line option.  
-C#
-C# As you probably guessed by now, # indicates a comment line.
-C#
-C# Remove the # at the beginning of a line if you want to use a sample
-C# configuration that is currently commented out.
-C#
-C# Commands are a keyword followed by parameters.
-C#
-C# Command key words are case insensitive.  i.e. upper and lower case are equivalent.
-C#
-C# Command parameters are generally case sensitive.  i.e. upper and lower case are different.
-C#
-C
-C
-C#############################################################
-C#                                                           #
-C#               FIRST AUDIO DEVICE PROPERTIES               #
-C#               (Channel 0 + 1 if in stereo)                #
-C#                                                           #
-C#############################################################
-C
-C#
-C# Many people will simply use the default sound device.
-C# Some might want to use an alternative device by chosing it here.
-C#
-W# When the Windows version starts up, it displays something like 
-W# this with the available sound devices and capabilities:
-W#
-W#	Available audio input devices for receive (*=selected):
-W#	   *  0: Microphone (C-Media USB Headpho   (channel 2)
-W#	      1: Microphone (Bluetooth SCO Audio
-W#	      2: Microphone (Bluetooth AV Audio)
-W#	 *    3: Microphone (Realtek High Defini   (channels 0 & 1)
-W#	Available audio output devices for transmit (*=selected):
-W#	   *  0: Speakers (C-Media USB Headphone   (channel 2)
-W#	      1: Speakers (Bluetooth SCO Audio)
-W#	      2: Realtek Digital Output(Optical)
-W#	      3: Speakers (Bluetooth AV Audio)
-W#	 *    4: Speakers (Realtek High Definiti   (channels 0 & 1)
-W#	      5: Realtek Digital Output (Realtek
-W#	
-W# Example: To use the microphone and speaker connections on the 
-W# system board, either of these forms can be used:
-W
-W#ADEVICE High
-W#ADEVICE  3 4 
-W
-W
-W# Example: To use the USB Audio, use a command like this with
-W# the input and output device numbers.  (Remove the # comment character.)
-W#ADEVICE USB
-W
-W# The position in the list can change when devices (e.g. USB) are added and removed.
-W# You can also specify devices by using part of the name.
-W# Here is an example of specifying the USB Audio device.
-W# This is case-sensitive.  Upper and lower case are not treated the same.
-W
-W#ADEVICE USB
-W
-W
-L# Linux ALSA is complicated.  See User Guide for discussion.
-L# To use something other than the default, generally use plughw
-L# and a card number reported by "arecord -l" command.  Example:
-L
-L# ADEVICE  plughw:1,0
-L
-L# Starting with version 1.0, you can also use "-" or "stdin" to 
-L# pipe stdout from some other application such as a software defined
-L# radio.  You can also specify "UDP:" and an optional port for input.
-L# Something different must be specified for output.
-L
-M# Macintosh Operating System uses portaudio driver for audio
-M# input/output. Default device selection not available. User/OP
-M# must configure the sound input/output option.  Note that
-M# the device names can contain spaces.  In this case, the names
-M# must be enclosed by quotes.
-M#
-M# Examples:
-M#
-M# ADEVICE  "USB Audio Codec:6"  "USB Audio Codec:5"
-M#
-M#
-W# ADEVICE - 0
-W# ADEVICE UDP:7355 0
-L# ADEVICE - plughw:1,0
-L# ADEVICE UDP:7355 default
-M# ADEVICE UDP:7355 default
-M#
-L
-L
-C
-C#
-C# Number of audio channels for this souncard:  1 or 2.
-C#
-C
-CACHANNELS 1
-C#ACHANNELS 2
-C
-C
-C#############################################################
-C#                                                           #
-C#               SECOND AUDIO DEVICE PROPERTIES              #
-C#               (Channel 2 + 3 if in stereo)                #
-C#                                                           #
-C#############################################################
-C
-C#ADEVICE1  ...
-C
-C
-C#############################################################
-C#                                                           #
-C#               THIRD AUDIO DEVICE PROPERTIES               #
-C#               (Channel 4 + 5 if in stereo)                #
-C#                                                           #
-C#############################################################
-C
-C#ADEVICE2  ...
-C
-C
-C#############################################################
-C#                                                           #
-C#               CHANNEL 0 PROPERTIES                        #
-C#                                                           #
-C#############################################################
-C
-CCHANNEL 0
-C
-C#
-C# The following MYCALL, MODEM, PTT, etc. configuration items
-C# apply to the most recent CHANNEL.
-C#
-C
-C#
-C# Station identifier for this channel.
-C# Multiple channels can have the same or different names.
-C#
-C# It can be up to 6 letters and digits with an optional ssid.
-C# The APRS specification requires that it be upper case.
-C#
-C# Example (don't use this unless you are me):  MYCALL	WB2OSZ-5
-C#
-C
-CMYCALL N0CALL
-C
-C#
-C# Pick a suitable modem speed based on your situation.
-C#	1200 	Most common for VHF/UHF.  Default if not specified.
-C#	300	Low speed for HF SSB.
-C#	9600	High speed - Can't use Microphone and Speaker connections.
-C#
-C# In the simplest form, just specify the speed. 
-C# 
-C
-CMODEM 1200
-C#MODEM 300
-C#MODEM 9600
-C
-C#
-C# These are the defaults should be fine for most cases.  In special situations, 
-C# you might want to specify different AFSK tones or the baseband mode which does
-C# not use AFSK.
-C#
-C#MODEM 1200 1200:2200
-C#MODEM 300  1600:1800
-C#MODEM 9600 0:0
-C#
-C#
-C# On HF SSB, you might want to use multiple demodulators on slightly different
-C# frequencies to compensate for stations off frequency.  Here we have 7 different
-C# demodulators at 30 Hz intervals.  This takes a lot of CPU power so you will 
-C# probably need to reduce the audio sampling rate with the /n option.
-C
-C#MODEM 300 1600:1800 7@30 /4
-C
-C
-C#
-C# Uncomment line below to enable the DTMF decoder for this channel.
-C#
-C
-C#DTMF
-C
-C# 
-C# If not using a VOX circuit, the transmitter Push to Talk (PTT) 
-C# control is usually wired to a serial port with a suitable interface circuit.  
-C# DON'T connect it directly!
-C#
-C# For the PTT command, specify the device and either RTS or DTR.
-C# RTS or DTR may be preceded by "-" to invert the signal.
-C# Both can be used for interfaces that want them driven with opposite polarity.
-C#
-L# COM1 can be used instead of /dev/ttyS0, COM2 for /dev/ttyS1, and so on.
-L#
-C
-C#PTT COM1 RTS
-C#PTT COM1 RTS -DTR
-L#PTT /dev/ttyUSB0 RTS
-C
-L#
-L# On Linux, you can also use general purpose I/O pins if
-L# your system is configured for user access to them. 
-L# This would apply mostly to microprocessor boards, not a regular PC.
-L# See separate Raspberry Pi document for more details.
-L# The number may be preceded by "-" to invert the signal.
-L#
-L
-L#PTT GPIO 25
-L
-C# The Data Carrier Detect (DCD) signal can be sent to the same places
-C# as the PTT signal.  This could be used to light up an LED like a normal TNC.
-C
-C#DCD COM1 -DTR
-L#DCD GPIO 24
-C
-C
-C#############################################################
-C#                                                           #
-C#               CHANNEL 1 PROPERTIES                        #
-C#                                                           #
-C#############################################################
-C
-C#CHANNEL 1
-C
-C#
-C# Specify MYCALL, MODEM, PTT, etc. configuration items for 
-C# CHANNEL 1.   Repeat for any other channels.
-C
-C
-C#############################################################
-C#                                                           #
-C#               TEXT TO SPEECH COMMAND FILE                 #
-C#                                                           #
-C#############################################################
-C
-W#SPEECH dwespeak.bat
-L#SPEECH dwespeak.sh
-C
-C
-C#############################################################
-C#                                                           #
-C#               VIRTUAL TNC SERVER PROPERTIES               #
-C#                                                           #
-C#############################################################
-C
-C#
-C# Dire Wolf acts as a virtual TNC and can communicate with
-C# client applications by different protocols:
-C#
-C#	- the "AGW TCPIP Socket Interface" - default port 8000
-C#	- KISS protocol over TCP socket - default port 8001
-W#	- KISS TNC via serial port
-L#	- KISS TNC via pseudo terminal   (-p command line option)
-C#
-C
-CAGWPORT 8000
-CKISSPORT 8001
-C
-W#
-W# Some applications are designed to operate with only a physical
-W# TNC attached to a serial port.  For these, we provide a virtual serial
-W# port that appears to be connected to a TNC.
-W#
-W# Take a look at the User Guide for instructions to set up
-W# two virtual serial ports named COM3 and COM4 connected by
-W# a null modem.
-W#
-W# Using the  configuration described, Dire Wolf will connect to 
-W# COM3 and the client application will use COM4.
-W#
-W# Uncomment following line to use this feature.
-W
-W#NULLMODEM COM3
-W
-W
-C#
-C# It is sometimes possible to recover frames with a bad FCS.
-C# This applies to all channels.  
-C#
-C#	0  [NONE] - Don't try to repair.
-C#	1  [SINGLE] - Attempt to fix single bit error.  (default)
-C#	2  [DOUBLE] - Also attempt to fix two adjacent bits.
-C#	... see User Guide for more values and in-depth discussion.
-C#
-C
-C#FIX_BITS 0
-C
-C#	
-C#############################################################
-C#                                                           #
-C#               BEACONING PROPERTIES                        #
-C#                                                           #
-C#############################################################
-C
-C
-C#
-C# Beaconing is configured with these two commands:
-C#
-C#	PBEACON		- for a position report (usually yourself)
-C#	OBEACON		- for an object report (usually some other entity)
-C#
-C# Each has a series of keywords and values for options.  
-C# See User Guide for details.
-C#
-C# Example:
-C#
-C# This results in a broadcast once every 10 minutes.
-C# Every half hour, it can travel via two digipeater hops.
-C# The others are kept local.
-C#
-C
-C#PBEACON delay=1  every=30 overlay=S symbol="digi" lat=42^37.14N long=071^20.83W power=50 height=20 gain=4 comment="Chelmsford MA" via=WIDE1-1,WIDE2-1 
-C#PBEACON delay=11 every=30 overlay=S symbol="digi" lat=42^37.14N long=071^20.83W power=50 height=20 gain=4 comment="Chelmsford MA"  
-C#PBEACON delay=21 every=30 overlay=S symbol="digi" lat=42^37.14N long=071^20.83W power=50 height=20 gain=4 comment="Chelmsford MA"  
-C
-C
-C# With UTM coordinates instead of latitude and longitude.
-C
-C#PBEACON delay=1 every=10 overlay=S symbol="digi" zone=19T easting=307477 northing=4720178 
-C
-C
-C#
-C# When the destination field is set to "SPEECH" the information part is
-C# converted to speech rather than transmitted as a data frame.
-C#
-C
-C#CBEACON dest="SPEECH" info="Club meeting tonight at 7 pm."
-C
-C# Similar for Morse code.  If SSID is specified, it is multiplied
-C# by 2 to get speed in words per minute (WPM).
-C
-C#CBEACON dest="MORSE-6" info="de MYCALL"
-C
-C
-C#
-C# Modify for your particular situation before removing 
-C# the # comment character from the beginning of appropriate lines above.
-C# 
-C
-C
-C#############################################################
-C#                                                           #
-C#               DIGIPEATER PROPERTIES                       #
-C#                                                           #
-C#############################################################
-C
-C#
-C# For most common situations, use something like this by removing
-C# the "#" from the beginning of the line below.  
-C#
-C
-C#DIGIPEAT 0 0 ^WIDE[3-7]-[1-7]$|^TEST$ ^WIDE[12]-[12]$ TRACE 
-C
-C# See User Guide for more explanation of what this means and how
-C# it can be customized for your particular needs.
-C 
-C# Filtering can be used to limit was is digipeated.
-C# For example, only weather weather reports, received on channel 0,
-C# will be retransmitted on channel 1.
-C#
-C
-C#FILTER 0 1 t/wn 
-C
-C
-C#############################################################
-C#                                                           #
-C#               INTERNET GATEWAY                            #
-C#                                                           #
-C#############################################################
-C
-C# First you need to specify the name of a Tier 2 server.  
-C# The current preferred way is to use one of these regional rotate addresses:
-C
-C#	noam.aprs2.net 		- for North America
-C#	soam.aprs2.net		- for South America
-C#	euro.aprs2.net		- for Europe and Africa
-C#	asia.aprs2.net 		- for Asia
-C#	aunz.aprs2.net		- for Oceania 
-C
-C#IGSERVER noam.aprs2.net
-C
-C# You also need to specify your login name and passcode. 
-C# Contact the author if you can't figure out how to generate the passcode.
-C 
-C#IGLOGIN WB2OSZ-5 123456
-C
-C# That's all you need for a receive only IGate which relays
-C# messages from the local radio channel to the global servers.
-C
-C# Some might want to send an IGate client position directly to a server
-C# without sending it over the air and relying on someone else to 
-C# forward it to an IGate server.  This is done by using sendto=IG rather
-C# than a radio channel number. Overlay R for receive only, T for two way.
-C
-C#PBEACON sendto=IG delay=0:30 every=60:00 symbol="igate" overlay=R lat=42^37.14N long=071^20.83W 
-C#PBEACON sendto=IG delay=0:30 every=60:00 symbol="igate" overlay=T lat=42^37.14N long=071^20.83W 
-C
-C
-C# To relay messages from the Internet to radio, you need to add
-C# one more option with the transmit channel number and a VIA path.
-C
-C#IGTXVIA 0 WIDE1-1
-C
-C# You might want to apply a filter for what packets will be obtained from the server.
-C# Read about filters here:  http://www.aprs-is.net/javaprsfilter.aspx
-C# Example, positions and objects within 50 km of my location:
-C
-C#IGFILTER m/50 
-C
-C# That is known as a server-side filter.  It is processed by the IGate server.
-C# You can also apply local filtering to limit what will be transmitted on the 
-C# RF side.  For example, transmit only "messages" on channel 0 and weather 
-C# reports on channel 1. 
-C
-C#FILTER IG 0 t/m
-C#FILTER IG 1 t/wn
-C
-C# Finally, we don't want to flood the radio channel.  
-C# The IGate function will limit the number of packets transmitted 
-C# during 1 minute and 5 minute intervals.   If a limit would 
-C# be exceeded, the packet is dropped and message is displayed in red.
-C
-CIGTXLIMIT 6 10
-C
-C
-C#############################################################
-C#                                                           #
-C#               APRStt GATEWAY                              #
-C#                                                           #
-C#############################################################
-C
-C#
-C# Dire Wolf can receive DTMF (commonly known as Touch Tone)
-C# messages and convert them to packet objects.
-C#
-C# See separate "APRStt-Implementation-Notes" document for details.
-C#
-C
-C#
-C# Sample gateway configuration based on:
-C#
-C#	http://www.aprs.org/aprstt/aprstt-coding24.txt
-C#	http://www.aprs.org/aprs-jamboree-2013.html
-C#
-C
-C# Define specific points.
-C
-CTTPOINT  B01  37^55.37N  81^7.86W  			
-CTTPOINT  B7495088  42.605237  -71.34456		
-CTTPOINT  B934  42.605237  -71.34456			
-C
-CTTPOINT B901  42.661279  -71.364452 
-CTTPOINT B902  42.660411  -71.364419 
-CTTPOINT B903  42.659046  -71.364452 
-CTTPOINT B904  42.657578  -71.364602 
-C
-C
-C# For location at given bearing and distance from starting point.
-C
-CTTVECTOR  B5bbbddd  37^55.37N  81^7.86W  0.01  mi
-C
-C# For location specified by x, y coordinates.
-C
-CTTGRID   Byyyxxx    37^50.00N  81^00.00W  37^59.99N  81^09.99W   
-C
-C# UTM location for Lowell-Dracut-Tyngsborough State Forest.
-C
-CTTUTM  B6xxxyyy  19T  10  300000  4720000
-C
-C
-C
-C# Location for the corral.
-C
-CTTCORRAL   37^55.50N  81^7.00W  0^0.02N
-C
-C# Compact messages - Fixed locations xx and object yyy where 
-C#   	Object numbers 100 - 199	= bicycle	
-C#	Object numbers 200 - 299	= fire truck
-C#	Others				= dog
-C
-CTTMACRO  xx1yy  B9xx*AB166*AA2B4C5B3B0A1yy
-CTTMACRO  xx2yy  B9xx*AB170*AA3C4C7C3B0A2yy
-CTTMACRO  xxyyy  B9xx*AB180*AA3A6C4A0Ayyy
-C
-CTTMACRO  z  Cz
-C
-C# Receive on channel 0, Transmit object reports on channel 1 with optional via path.
-C# You probably want to put in a transmit delay on the APRStt channel so it
-C# it doesn't start sending a response before the user releases PTT.
-C# This is in 10 ms units so 100 means 1000 ms = 1 second.
-C
-C#TTOBJ 0 1 WIDE1-1
-C#CHANNEL 0
-C#DWAIT 100
-C
-C# Advertise gateway position with beacon.
-C
-C# OBEACON DELAY=0:15 EVERY=10:00 VIA=WIDE1-1 OBJNAME=WB2OSZ-tt SYMBOL=APRStt LAT=42^37.14N LONG=71^20.83W COMMENT="APRStt Gateway"  
-C
-C
-C# Sample speech responses.
-C# Default is Morse code "R" for received OK and "?" for all errors.
-C
-C#TTERR  OK               SPEECH  Message Received.
-C#TTERR  D_MSG            SPEECH  D not implemented.
-C#TTERR  INTERNAL         SPEECH  Internal error.
-C#TTERR  MACRO_NOMATCH    SPEECH  No definition for digit sequence.
-C#TTERR  BAD_CHECKSUM     SPEECH  Bad checksum on call.
-C#TTERR  INVALID_CALL     SPEECH  Invalid callsign.
-C#TTERR  INVALID_OBJNAME  SPEECH  Invalid object name.
-C#TTERR  INVALID_SYMBOL   SPEECH  Invalid symbol.
-C#TTERR  INVALID_LOC      SPEECH  Invalid location.
-C#TTERR  NO_CALL          SPEECH  No call or object name.
-C#TTERR  SATSQ            SPEECH  Satellite square must be 4 digits.
-C#TTERR  SUFFIX_NO_CALL   SPEECH  Send full call before using suffix.
-C
\ No newline at end of file
diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt
new file mode 100644
index 00000000..071db62a
--- /dev/null
+++ b/man/CMakeLists.txt
@@ -0,0 +1,13 @@
+if(NOT (WIN32 OR CYGWIN))
+  install(FILES "${CUSTOM_MAN_DIR}/aclients.1" DESTINATION ${INSTALL_MAN_DIR})
+  install(FILES "${CUSTOM_MAN_DIR}/atest.1" DESTINATION ${INSTALL_MAN_DIR})
+  install(FILES "${CUSTOM_MAN_DIR}/decode_aprs.1" DESTINATION ${INSTALL_MAN_DIR})
+  install(FILES "${CUSTOM_MAN_DIR}/direwolf.1" DESTINATION ${INSTALL_MAN_DIR})
+  install(FILES "${CUSTOM_MAN_DIR}/gen_packets.1" DESTINATION ${INSTALL_MAN_DIR})
+  install(FILES "${CUSTOM_MAN_DIR}/kissutil.1" DESTINATION ${INSTALL_MAN_DIR})
+  install(FILES "${CUSTOM_MAN_DIR}/ll2utm.1" DESTINATION ${INSTALL_MAN_DIR})
+  install(FILES "${CUSTOM_MAN_DIR}/log2gpx.1" DESTINATION ${INSTALL_MAN_DIR})
+  install(FILES "${CUSTOM_MAN_DIR}/text2tt.1" DESTINATION ${INSTALL_MAN_DIR})
+  install(FILES "${CUSTOM_MAN_DIR}/tt2text.1" DESTINATION ${INSTALL_MAN_DIR})
+  install(FILES "${CUSTOM_MAN_DIR}/utm2ll.1" DESTINATION ${INSTALL_MAN_DIR})
+endif(NOT (WIN32 OR CYGWIN))
diff --git a/man1/aclients.1 b/man/aclients.1
similarity index 100%
rename from man1/aclients.1
rename to man/aclients.1
diff --git a/man1/atest.1 b/man/atest.1
similarity index 100%
rename from man1/atest.1
rename to man/atest.1
diff --git a/man1/decode_aprs.1 b/man/decode_aprs.1
similarity index 100%
rename from man1/decode_aprs.1
rename to man/decode_aprs.1
diff --git a/man1/direwolf.1 b/man/direwolf.1
similarity index 100%
rename from man1/direwolf.1
rename to man/direwolf.1
diff --git a/man1/gen_packets.1 b/man/gen_packets.1
similarity index 100%
rename from man1/gen_packets.1
rename to man/gen_packets.1
diff --git a/man1/kissutil.1 b/man/kissutil.1
similarity index 100%
rename from man1/kissutil.1
rename to man/kissutil.1
diff --git a/man1/ll2utm.1 b/man/ll2utm.1
similarity index 100%
rename from man1/ll2utm.1
rename to man/ll2utm.1
diff --git a/man1/log2gpx.1 b/man/log2gpx.1
similarity index 100%
rename from man1/log2gpx.1
rename to man/log2gpx.1
diff --git a/man1/text2tt.1 b/man/text2tt.1
similarity index 100%
rename from man1/text2tt.1
rename to man/text2tt.1
diff --git a/man1/tt2text.1 b/man/tt2text.1
similarity index 100%
rename from man1/tt2text.1
rename to man/tt2text.1
diff --git a/man1/utm2ll.1 b/man/utm2ll.1
similarity index 100%
rename from man1/utm2ll.1
rename to man/utm2ll.1
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
new file mode 100644
index 00000000..886e5b17
--- /dev/null
+++ b/scripts/CMakeLists.txt
@@ -0,0 +1,6 @@
+
+if(NOT (WIN32 OR CYGWIN))
+  install(PROGRAMS "${CUSTOM_SCRIPTS_DIR}/dwespeak.sh" DESTINATION ${INSTALL_BIN_DIR})
+  install(PROGRAMS "${CUSTOM_SCRIPTS_DIR}/dw-start.sh" DESTINATION ${INSTALL_SCRIPTS_DIR})
+  add_subdirectory(telemetry-toolkit)
+endif()
diff --git a/dw-start.sh b/scripts/dw-start.sh
similarity index 100%
rename from dw-start.sh
rename to scripts/dw-start.sh
diff --git a/dwespeak.bat b/scripts/dwespeak.bat
similarity index 100%
rename from dwespeak.bat
rename to scripts/dwespeak.bat
diff --git a/dwespeak.sh b/scripts/dwespeak.sh
old mode 100644
new mode 100755
similarity index 100%
rename from dwespeak.sh
rename to scripts/dwespeak.sh
diff --git a/scripts/telemetry-toolkit/CMakeLists.txt b/scripts/telemetry-toolkit/CMakeLists.txt
new file mode 100644
index 00000000..46f8e61c
--- /dev/null
+++ b/scripts/telemetry-toolkit/CMakeLists.txt
@@ -0,0 +1,13 @@
+install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-balloon.pl" DESTINATION ${INSTALL_BIN_DIR})
+install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-bits.pl" DESTINATION ${INSTALL_BIN_DIR})
+install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-data.pl" DESTINATION ${INSTALL_BIN_DIR})
+install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-data91.pl" DESTINATION ${INSTALL_BIN_DIR})
+install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-eqns.pl" DESTINATION ${INSTALL_BIN_DIR})
+install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-parm.pl" DESTINATION ${INSTALL_BIN_DIR})
+install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-seq.sh" DESTINATION ${INSTALL_BIN_DIR})
+install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-unit.pl" DESTINATION ${INSTALL_BIN_DIR})
+install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-volts.py" DESTINATION ${INSTALL_BIN_DIR})
+
+install(FILES "${CUSTOM_TELEMETRY_DIR}/telem-m0xer-3.txt" DESTINATION ${INSTALL_CONF_DIR})
+install(FILES "${CUSTOM_TELEMETRY_DIR}/telem-balloon.conf" DESTINATION ${INSTALL_CONF_DIR})
+install(FILES "${CUSTOM_TELEMETRY_DIR}/telem-volts.conf" DESTINATION ${INSTALL_CONF_DIR})
diff --git a/telemetry-toolkit/telem-balloon.conf b/scripts/telemetry-toolkit/telem-balloon.conf
similarity index 100%
rename from telemetry-toolkit/telem-balloon.conf
rename to scripts/telemetry-toolkit/telem-balloon.conf
diff --git a/telemetry-toolkit/telem-balloon.pl b/scripts/telemetry-toolkit/telem-balloon.pl
similarity index 100%
rename from telemetry-toolkit/telem-balloon.pl
rename to scripts/telemetry-toolkit/telem-balloon.pl
diff --git a/telemetry-toolkit/telem-bits.pl b/scripts/telemetry-toolkit/telem-bits.pl
similarity index 100%
rename from telemetry-toolkit/telem-bits.pl
rename to scripts/telemetry-toolkit/telem-bits.pl
diff --git a/telemetry-toolkit/telem-data.pl b/scripts/telemetry-toolkit/telem-data.pl
similarity index 100%
rename from telemetry-toolkit/telem-data.pl
rename to scripts/telemetry-toolkit/telem-data.pl
diff --git a/telemetry-toolkit/telem-data91.pl b/scripts/telemetry-toolkit/telem-data91.pl
similarity index 100%
rename from telemetry-toolkit/telem-data91.pl
rename to scripts/telemetry-toolkit/telem-data91.pl
diff --git a/telemetry-toolkit/telem-eqns.pl b/scripts/telemetry-toolkit/telem-eqns.pl
similarity index 100%
rename from telemetry-toolkit/telem-eqns.pl
rename to scripts/telemetry-toolkit/telem-eqns.pl
diff --git a/telemetry-toolkit/telem-m0xer-3.txt b/scripts/telemetry-toolkit/telem-m0xer-3.txt
similarity index 100%
rename from telemetry-toolkit/telem-m0xer-3.txt
rename to scripts/telemetry-toolkit/telem-m0xer-3.txt
diff --git a/telemetry-toolkit/telem-parm.pl b/scripts/telemetry-toolkit/telem-parm.pl
similarity index 100%
rename from telemetry-toolkit/telem-parm.pl
rename to scripts/telemetry-toolkit/telem-parm.pl
diff --git a/telemetry-toolkit/telem-seq.sh b/scripts/telemetry-toolkit/telem-seq.sh
similarity index 100%
rename from telemetry-toolkit/telem-seq.sh
rename to scripts/telemetry-toolkit/telem-seq.sh
diff --git a/telemetry-toolkit/telem-unit.pl b/scripts/telemetry-toolkit/telem-unit.pl
similarity index 100%
rename from telemetry-toolkit/telem-unit.pl
rename to scripts/telemetry-toolkit/telem-unit.pl
diff --git a/telemetry-toolkit/telem-volts.conf b/scripts/telemetry-toolkit/telem-volts.conf
similarity index 100%
rename from telemetry-toolkit/telem-volts.conf
rename to scripts/telemetry-toolkit/telem-volts.conf
diff --git a/telemetry-toolkit/telem-volts.py b/scripts/telemetry-toolkit/telem-volts.py
similarity index 100%
rename from telemetry-toolkit/telem-volts.py
rename to scripts/telemetry-toolkit/telem-volts.py
diff --git a/search_sdks.sh b/search_sdks.sh
deleted file mode 100755
index e131be45..00000000
--- a/search_sdks.sh
+++ /dev/null
@@ -1,110 +0,0 @@
-#!/bin/bash
-#
-# This file is part of Dire Wolf, an amateur radio packet TNC.
-#
-# Bash script to search for SDKs on various MacOSX versions.
-#
-# Copyright (C) 2015 Robert Stiles
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-
-FILENAME="./use_this_sdk"
-selected_sdk=""
-valid_flag=0
-system_sdk=""
-
-if [ -f $FILENAME ]; then
-    selected_sdk=`cat $FILENAME`
-    if [ -d $selected_sdk ]; then
-        valid_flag=1
-    fi
-fi
-
-if [ $valid_flag -eq "0" ]; then
-    echo " " >&2
-    echo " " >&2
-    echo "Searching for SDKs.... (Wait for results)" >&2
-    echo " " >&2
-    echo "Enter the number and press Enter/Return Key" >&2
-    echo " " >&2
-    echo " " >&2
-
-    prompt="Select SDK to use:"
-
-    loc1=( $(find /Applications/Xcode.app -type l -name "MacOSX10.*.sdk") )
-    loc2=( $(find /Developer/SDKs -maxdepth 1 -type d -name "MacOSX10.*.sdk") )
-
-    options=("${loc1[@]}" "${loc2[@]}")
-
-    if [ "${#options[@]}" -lt "2" ]; then
-        echo "$options"
-    fi
-
-    PS3="$prompt "
-    select opt in "${options[@]}" "Do not use any SDK" ; do
-        if (( REPLY == 1 + ${#options[@]} )) ; then
-            echo " "
-            break
-        elif (( REPLY > 0 && REPLY <= ${#options[@]} )) ; then
-            selected_sdk="$opt"
-            break
-        fi
-    done
-
-    if [ ! -z "$selected_sdk" ]; then
-        echo "$selected_sdk" > $FILENAME
-    else
-        echo " " > $FILENAME
-    fi
-fi
-
-if [ ! -z "$selected_sdk" ]; then
-    temp_str="$selected_sdk"
-    min_str=""
-    flag=true
-
-    # Search for the last MacOSX in the string.
-    while [ "${#temp_str}" -gt 4 ]; do
-        temp_str="${temp_str#*MacOSX}"
-        temp_str="${temp_str%%.sdk}"
-        min_str="$temp_str"
-        temp_str="${temp_str:1}"
-    done
-
-    # Remove the "u" if 10.4u Universal SDK is used.
-    min_str="${min_str%%u}"
-    min_str="${min_str:-10.14}"
-
-    system_sdk="-isystem ${selected_sdk} -mmacosx-version-min=${min_str}"
-else
-    system_sdk=" "
-fi
-
-echo " " >&2
-echo "*******************************************************************" >&2
-
-if [ -z "${system_sdk}" ]; then
-    echo "SDK Selected: None" >&2
-else
-    echo "SDK Selected: ${system_sdk}" >&2
-fi
-
-echo "To change SDK version execute 'make clean' followed by 'make'." >&2
-echo "*******************************************************************" >&2
-echo " " >&2
-
-echo ${system_sdk}
-
-
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 00000000..b9906057
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,472 @@
+# global includes
+# not ideal but not so slow
+# otherwise use target_include_directories
+include_directories(
+  ${GPSD_INCLUDE_DIRS}
+  ${HAMLIB_INCLUDE_DIRS}
+  ${ALSA_INCLUDE_DIRS}
+  ${UDEV_INCLUDE_DIRS}
+  ${PORTAUDIO_INCLUDE_DIRS}
+  ${CUSTOM_GEOTRANZ_DIR}
+  )
+
+if(WIN32 OR CYGWIN)
+  include_directories(
+    ${CUSTOM_REGEX_DIR}
+  )
+endif()
+
+# build gen_fff to create fsk_fast_filter.h
+# optimization for slow processors
+list(APPEND gen_fff_SOURCES
+  demod_afsk.c
+  dsp.c
+  textcolor.c
+  )
+
+add_executable(gen_fff
+  ${gen_fff_SOURCES}
+  )
+
+set_target_properties(gen_fff
+  PROPERTIES COMPILE_FLAGS "-DGEN_FFF"
+  )
+
+add_custom_command(TARGET gen_fff
+  POST_BUILD
+  COMMAND gen_fff > fsk_fast_filter.h
+  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+  )
+
+
+# direwolf
+list(APPEND direwolf_SOURCES
+  direwolf.c
+  aprs_tt.c
+  audio_stats.c
+  ax25_link.c
+  ax25_pad.c
+  ax25_pad2.c
+  beacon.c
+  config.c
+  decode_aprs.c
+  dedupe.c
+  demod_9600.c
+  demod_afsk.c
+  demod_psk.c
+  demod.c
+  digipeater.c
+  cdigipeater.c
+  dlq.c
+  dsp.c
+  dtime_now.c
+  dtmf.c
+  dwgps.c
+  encode_aprs.c
+  encode_aprs.c
+  fcs_calc.c
+  fcs_calc.c
+  gen_tone.c
+  hdlc_rec.c
+  hdlc_rec2.c
+  hdlc_send.c
+  igate.c
+  kiss_frame.c
+  kiss.c
+  kissserial.c
+  kissnet.c
+  latlong.c
+  latlong.c
+  log.c
+  morse.c
+  multi_modem.c
+  waypoint.c
+  serial_port.c
+  pfilter.c
+  ptt.c
+  rdq.c
+  recv.c
+  rrbb.c
+  server.c
+  symbols.c
+  telemetry.c
+  textcolor.c
+  tq.c
+  tt_text.c
+  tt_user.c
+  xid.c
+  xmit.c
+  dwgps.c
+  dwgpsnmea.c
+  dwgpsd.c
+  mheard.c
+  )
+
+if(LINUX)
+  list(APPEND direwolf_SOURCES
+    audio.c
+    )
+  if(UDEV_FOUND)
+    list(APPEND direwolf_SOURCES
+      cm108.c
+      )
+  endif()
+  elseif(WIN32 OR CYGWIN) # windows
+    list(APPEND direwolf_SOURCES
+      audio_win.c
+
+      # icon
+      # require plain gcc binary or link
+      #${CMAKE_SOURCE_DIR}/cmake/cpack/direwolf.rc
+      )
+    list(REMOVE_ITEM direwolf_SOURCES
+      dwgpsd.c
+      )
+  else() # macOS freebsd openbsd
+    list(APPEND direwolf_SOURCES
+      audio_portaudio.c
+      )
+endif()
+
+add_executable(direwolf
+  ${direwolf_SOURCES}
+  )
+
+add_dependencies(direwolf gen_fff)
+
+target_link_libraries(direwolf
+  ${GEOTRANZ_LIBRARIES}
+  ${MISC_LIBRARIES}
+  ${REGEX_LIBRARIES}
+  Threads::Threads
+  ${GPSD_LIBRARIES}
+  ${HAMLIB_LIBRARIES}
+  ${ALSA_LIBRARIES}
+  ${UDEV_LIBRARIES}
+  ${PORTAUDIO_LIBRARIES}
+  )
+
+if(WIN32 OR CYGWIN)
+  set_target_properties(direwolf
+    PROPERTIES COMPILE_FLAGS "-DUSE_REGEX_STATIC"
+    )
+  target_link_libraries(direwolf winmm ws2_32)
+endif()
+
+# decode_aprs
+list(APPEND decode_aprs_SOURCES
+  decode_aprs.c
+  kiss_frame.c
+  ax25_pad.c
+  dwgpsnmea.c
+  dwgps.c
+  dwgpsd.c
+  serial_port.c
+  symbols.c
+  textcolor.c
+  fcs_calc.c
+  latlong.c
+  log.c
+  telemetry.c
+  tt_text.c
+  )
+
+if(WIN32 OR CYGWIN)
+  list(REMOVE_ITEM decode_aprs_SOURCES
+    dwgpsd.c
+    )
+endif()
+
+add_executable(decode_aprs
+  ${decode_aprs_SOURCES}
+  )
+
+add_dependencies(decode_aprs gen_fff)
+
+set_target_properties(decode_aprs
+  PROPERTIES COMPILE_FLAGS "-DDECAMAIN -DUSE_REGEX_STATIC"
+  )
+
+target_link_libraries(decode_aprs
+  ${MISC_LIBRARIES}
+  ${REGEX_LIBRARIES}
+  Threads::Threads
+  ${GPSD_LIBRARIES}
+  )
+
+
+# Convert between text and touch tone representation.
+# text2tt
+list(APPEND text2tt_SOURCES
+  tt_text.c
+  )
+
+add_executable(text2tt
+  ${text2tt_SOURCES}
+  )
+
+set_target_properties(text2tt
+  PROPERTIES COMPILE_FLAGS "-DENC_MAIN"
+  )
+
+target_link_libraries(text2tt
+  ${MISC_LIBRARIES}
+  )
+
+# tt2text
+list(APPEND tt2text_SOURCES
+  tt_text.c
+  )
+
+add_executable(tt2text
+  ${tt2text_SOURCES}
+  )
+
+set_target_properties(tt2text
+  PROPERTIES COMPILE_FLAGS "-DDEC_MAIN"
+  )
+
+target_link_libraries(tt2text
+  ${MISC_LIBRARIES}
+  )
+
+
+# Convert between Latitude/Longitude and UTM coordinates.
+# ll2utm
+list(APPEND ll2utm_SOURCES
+  ll2utm.c
+  textcolor.c
+  )
+
+add_executable(ll2utm
+  ${ll2utm_SOURCES}
+  )
+
+target_link_libraries(ll2utm
+  ${GEOTRANZ_LIBRARIES}
+  ${MISC_LIBRARIES}
+  )
+
+# utm2ll
+list(APPEND utm2ll_SOURCES
+  utm2ll.c
+  textcolor.c
+  )
+
+add_executable(utm2ll
+  ${utm2ll_SOURCES}
+  )
+
+target_link_libraries(utm2ll
+  ${GEOTRANZ_LIBRARIES}
+  ${MISC_LIBRARIES}
+  )
+
+
+# Convert from log file to GPX.
+# log2gpx
+list(APPEND log2gpx_SOURCES
+  log2gpx.c
+  textcolor.c
+  )
+
+add_executable(log2gpx
+  ${log2gpx_SOURCES}
+  )
+
+target_link_libraries(log2gpx
+  ${MISC_LIBRARIES}
+  )
+
+
+# Test application to generate sound.
+# gen_packets
+list(APPEND gen_packets_SOURCES
+  gen_packets.c
+  ax25_pad.c
+  hdlc_send.c
+  fcs_calc.c
+  gen_tone.c
+  morse.c
+  dtmf.c
+  textcolor.c
+  dsp.c
+  )
+
+add_executable(gen_packets
+  ${gen_packets_SOURCES}
+  )
+
+target_link_libraries(gen_packets
+  ${MISC_LIBRARIES}
+  )
+
+
+# Unit test for AFSK demodulator
+# atest
+list(APPEND atest_SOURCES
+  atest.c
+  demod.c
+  demod_afsk.c
+  demod_psk.c
+  demod_9600.c
+  dsp.c
+  hdlc_rec.c
+  hdlc_rec2.c
+  multi_modem.c
+  rrbb.c
+  fcs_calc.c
+  ax25_pad.c
+  decode_aprs.c
+  dwgpsnmea.c
+  dwgps.c
+  dwgpsd.c
+  serial_port.c
+  telemetry.c
+  dtime_now.c
+  latlong.c
+  symbols.c
+  tt_text.c
+  textcolor.c
+  )
+
+if(WIN32 OR CYGWIN)
+  list(REMOVE_ITEM atest_SOURCES
+    dwgpsd.c
+    )
+endif()
+
+add_executable(atest
+  ${atest_SOURCES}
+  )
+
+add_dependencies(atest gen_fff)
+
+target_link_libraries(atest
+  ${MISC_LIBRARIES}
+  ${GPSD_LIBRARIES}
+  ${REGEX_LIBRARIES}
+  Threads::Threads
+  )
+
+if(WIN32 OR CYGWIN)
+  set_target_properties(atest
+    PROPERTIES COMPILE_FLAGS "-DUSE_REGEX_STATIC"
+    )
+endif()
+
+
+# Multiple AGWPE network or serial port clients to test TNCs side by side.
+# aclients
+list(APPEND aclients_SOURCES
+  aclients.c
+  ax25_pad.c
+  fcs_calc.c
+  textcolor.c
+  )
+
+add_executable(aclients
+  ${aclients_SOURCES}
+  )
+
+target_link_libraries(aclients
+  ${MISC_LIBRARIES}
+  Threads::Threads
+  )
+
+if(WIN32 OR CYGWIN)
+  target_link_libraries(aclients ws2_32)
+endif()
+
+
+# Talk to a KISS TNC.
+# Note:  kiss_frame.c has conditional compilation on KISSUTIL.
+# kissutil
+list(APPEND kissutil_SOURCES
+  kissutil.c
+  kiss_frame.c
+  ax25_pad.c
+  fcs_calc.c
+  textcolor.c
+  serial_port.c
+  dtime_now.c
+  dwsock.c
+  )
+
+add_executable(kissutil
+  ${kissutil_SOURCES}
+  )
+
+set_target_properties(kissutil
+  PROPERTIES COMPILE_FLAGS "-DKISSUTIL"
+  )
+
+target_link_libraries(kissutil
+  ${MISC_LIBRARIES}
+  Threads::Threads
+  )
+
+if(WIN32 OR CYGWIN)
+  target_link_libraries(kissutil ws2_32)
+endif()
+
+
+# List USB audio adapters than can use GPIO for PTT.
+# cm108
+if(UDEV_FOUND)
+  list(APPEND cm108_SOURCES
+    cm108.c
+    textcolor.c
+    )
+
+  add_executable(cm108
+    ${cm108_SOURCES}
+    )
+
+  set_target_properties(cm108
+    PROPERTIES COMPILE_FLAGS "-DCM108_MAIN"
+    )
+
+  target_link_libraries(cm108
+    ${MISC_LIBRARIES}
+    ${UDEV_LIBRARIES}
+    )
+endif()
+
+
+# Touch Tone to Speech sample application.
+# ttcalc
+list(APPEND ttcalc_SOURCES
+  ttcalc.c
+  ax25_pad.c
+  fcs_calc.c
+  textcolor.c
+  )
+
+add_executable(ttcalc
+  ${ttcalc_SOURCES}
+  )
+
+target_link_libraries(ttcalc
+  ${MISC_LIBRARIES}
+  )
+
+if(WIN32 OR CYGWIN)
+  target_link_libraries(ttcalc ws2_32)
+endif()
+
+install(TARGETS direwolf DESTINATION ${INSTALL_BIN_DIR})
+install(TARGETS decode_aprs DESTINATION ${INSTALL_BIN_DIR})
+install(TARGETS text2tt DESTINATION ${INSTALL_BIN_DIR})
+install(TARGETS tt2text DESTINATION ${INSTALL_BIN_DIR})
+install(TARGETS ll2utm DESTINATION ${INSTALL_BIN_DIR})
+install(TARGETS utm2ll DESTINATION ${INSTALL_BIN_DIR})
+install(TARGETS aclients DESTINATION ${INSTALL_BIN_DIR})
+install(TARGETS log2gpx DESTINATION ${INSTALL_BIN_DIR})
+install(TARGETS gen_packets DESTINATION ${INSTALL_BIN_DIR})
+install(TARGETS atest DESTINATION ${INSTALL_BIN_DIR})
+install(TARGETS ttcalc DESTINATION ${INSTALL_BIN_DIR})
+install(TARGETS kissutil DESTINATION ${INSTALL_BIN_DIR})
+if(UDEV_FOUND)
+  install(TARGETS cm108 DESTINATION ${INSTALL_BIN_DIR})
+endif()
diff --git a/aclients.c b/src/aclients.c
similarity index 100%
rename from aclients.c
rename to src/aclients.c
diff --git a/aprs_tt.c b/src/aprs_tt.c
similarity index 100%
rename from aprs_tt.c
rename to src/aprs_tt.c
diff --git a/aprs_tt.h b/src/aprs_tt.h
similarity index 100%
rename from aprs_tt.h
rename to src/aprs_tt.h
diff --git a/atest.c b/src/atest.c
similarity index 100%
rename from atest.c
rename to src/atest.c
diff --git a/audio.c b/src/audio.c
similarity index 100%
rename from audio.c
rename to src/audio.c
diff --git a/audio.h b/src/audio.h
similarity index 100%
rename from audio.h
rename to src/audio.h
diff --git a/audio_portaudio.c b/src/audio_portaudio.c
similarity index 100%
rename from audio_portaudio.c
rename to src/audio_portaudio.c
diff --git a/audio_stats.c b/src/audio_stats.c
similarity index 100%
rename from audio_stats.c
rename to src/audio_stats.c
diff --git a/audio_stats.h b/src/audio_stats.h
similarity index 100%
rename from audio_stats.h
rename to src/audio_stats.h
diff --git a/audio_win.c b/src/audio_win.c
similarity index 100%
rename from audio_win.c
rename to src/audio_win.c
diff --git a/ax25_link.c b/src/ax25_link.c
similarity index 100%
rename from ax25_link.c
rename to src/ax25_link.c
diff --git a/ax25_link.h b/src/ax25_link.h
similarity index 100%
rename from ax25_link.h
rename to src/ax25_link.h
diff --git a/ax25_pad.c b/src/ax25_pad.c
similarity index 100%
rename from ax25_pad.c
rename to src/ax25_pad.c
diff --git a/ax25_pad.h b/src/ax25_pad.h
similarity index 100%
rename from ax25_pad.h
rename to src/ax25_pad.h
diff --git a/ax25_pad2.c b/src/ax25_pad2.c
similarity index 100%
rename from ax25_pad2.c
rename to src/ax25_pad2.c
diff --git a/ax25_pad2.h b/src/ax25_pad2.h
similarity index 100%
rename from ax25_pad2.h
rename to src/ax25_pad2.h
diff --git a/beacon.c b/src/beacon.c
similarity index 99%
rename from beacon.c
rename to src/beacon.c
index 0bd5e98b..07ea0d0e 100644
--- a/beacon.c
+++ b/src/beacon.c
@@ -59,7 +59,6 @@
 #include "mheard.h"
 
 
-
 /*
  * Save pointers to configuration settings.
  */
diff --git a/beacon.h b/src/beacon.h
similarity index 100%
rename from beacon.h
rename to src/beacon.h
diff --git a/cdigipeater.c b/src/cdigipeater.c
similarity index 100%
rename from cdigipeater.c
rename to src/cdigipeater.c
diff --git a/cdigipeater.h b/src/cdigipeater.h
similarity index 100%
rename from cdigipeater.h
rename to src/cdigipeater.h
diff --git a/cm108.c b/src/cm108.c
similarity index 100%
rename from cm108.c
rename to src/cm108.c
diff --git a/cm108.h b/src/cm108.h
similarity index 100%
rename from cm108.h
rename to src/cm108.h
diff --git a/config.c b/src/config.c
similarity index 100%
rename from config.c
rename to src/config.c
diff --git a/config.h b/src/config.h
similarity index 100%
rename from config.h
rename to src/config.h
diff --git a/decode_aprs.c b/src/decode_aprs.c
similarity index 99%
rename from decode_aprs.c
rename to src/decode_aprs.c
index 167ad5db..ca50721c 100644
--- a/decode_aprs.c
+++ b/src/decode_aprs.c
@@ -3751,6 +3751,7 @@ static int num_tocalls = 0;
 
 static const char *search_locations[] = {
 	(const char *) "tocalls.txt",
+	(const char *) "../data/tocalls.txt",
 #ifndef __WIN32__
 	(const char *) "/usr/local/share/direwolf/tocalls.txt",
 	(const char *) "/usr/share/direwolf/tocalls.txt",
diff --git a/decode_aprs.h b/src/decode_aprs.h
similarity index 100%
rename from decode_aprs.h
rename to src/decode_aprs.h
diff --git a/dedupe.c b/src/dedupe.c
similarity index 100%
rename from dedupe.c
rename to src/dedupe.c
diff --git a/dedupe.h b/src/dedupe.h
similarity index 100%
rename from dedupe.h
rename to src/dedupe.h
diff --git a/demod.c b/src/demod.c
similarity index 100%
rename from demod.c
rename to src/demod.c
diff --git a/demod.h b/src/demod.h
similarity index 100%
rename from demod.h
rename to src/demod.h
diff --git a/demod_9600.c b/src/demod_9600.c
similarity index 100%
rename from demod_9600.c
rename to src/demod_9600.c
diff --git a/demod_9600.h b/src/demod_9600.h
similarity index 100%
rename from demod_9600.h
rename to src/demod_9600.h
diff --git a/demod_afsk.c b/src/demod_afsk.c
similarity index 100%
rename from demod_afsk.c
rename to src/demod_afsk.c
diff --git a/demod_afsk.h b/src/demod_afsk.h
similarity index 100%
rename from demod_afsk.h
rename to src/demod_afsk.h
diff --git a/demod_psk.c b/src/demod_psk.c
similarity index 100%
rename from demod_psk.c
rename to src/demod_psk.c
diff --git a/demod_psk.h b/src/demod_psk.h
similarity index 100%
rename from demod_psk.h
rename to src/demod_psk.h
diff --git a/digipeater.c b/src/digipeater.c
similarity index 100%
rename from digipeater.c
rename to src/digipeater.c
diff --git a/digipeater.h b/src/digipeater.h
similarity index 100%
rename from digipeater.h
rename to src/digipeater.h
diff --git a/direwolf.c b/src/direwolf.c
similarity index 100%
rename from direwolf.c
rename to src/direwolf.c
diff --git a/direwolf.h b/src/direwolf.h
similarity index 99%
rename from direwolf.h
rename to src/direwolf.h
index 6df28ad5..efc329ba 100644
--- a/direwolf.h
+++ b/src/direwolf.h
@@ -113,7 +113,6 @@
 #define SLEEP_MS(n) usleep((n)*1000)
 #endif
 
-
 #if __WIN32__
 
 #define PTW32_STATIC_LIB
@@ -124,7 +123,7 @@
 #define _POSIX_C_SOURCE 1
 
 #else
-#include <pthread.h>
+ #include <pthread.h>
 #endif
 
 
diff --git a/dlq.c b/src/dlq.c
similarity index 100%
rename from dlq.c
rename to src/dlq.c
diff --git a/dlq.h b/src/dlq.h
similarity index 100%
rename from dlq.h
rename to src/dlq.h
diff --git a/dsp.c b/src/dsp.c
similarity index 100%
rename from dsp.c
rename to src/dsp.c
diff --git a/dsp.h b/src/dsp.h
similarity index 100%
rename from dsp.h
rename to src/dsp.h
diff --git a/dtime_now.c b/src/dtime_now.c
similarity index 99%
rename from dtime_now.c
rename to src/dtime_now.c
index 380f6e9b..af7b98a2 100644
--- a/dtime_now.c
+++ b/src/dtime_now.c
@@ -84,7 +84,6 @@ double dtime_now (void)
 }
 
 
-
 /*------------------------------------------------------------------
  *
  * Name:	timestamp_now
diff --git a/dtime_now.h b/src/dtime_now.h
similarity index 100%
rename from dtime_now.h
rename to src/dtime_now.h
diff --git a/dtmf.c b/src/dtmf.c
similarity index 100%
rename from dtmf.c
rename to src/dtmf.c
diff --git a/dtmf.h b/src/dtmf.h
similarity index 100%
rename from dtmf.h
rename to src/dtmf.h
diff --git a/dwgps.c b/src/dwgps.c
similarity index 100%
rename from dwgps.c
rename to src/dwgps.c
diff --git a/dwgps.h b/src/dwgps.h
similarity index 100%
rename from dwgps.h
rename to src/dwgps.h
diff --git a/dwgpsd.c b/src/dwgpsd.c
similarity index 100%
rename from dwgpsd.c
rename to src/dwgpsd.c
diff --git a/dwgpsd.h b/src/dwgpsd.h
similarity index 100%
rename from dwgpsd.h
rename to src/dwgpsd.h
diff --git a/dwgpsnmea.c b/src/dwgpsnmea.c
similarity index 100%
rename from dwgpsnmea.c
rename to src/dwgpsnmea.c
diff --git a/dwgpsnmea.h b/src/dwgpsnmea.h
similarity index 100%
rename from dwgpsnmea.h
rename to src/dwgpsnmea.h
diff --git a/dwsock.c b/src/dwsock.c
similarity index 100%
rename from dwsock.c
rename to src/dwsock.c
diff --git a/dwsock.h b/src/dwsock.h
similarity index 100%
rename from dwsock.h
rename to src/dwsock.h
diff --git a/encode_aprs.c b/src/encode_aprs.c
similarity index 100%
rename from encode_aprs.c
rename to src/encode_aprs.c
diff --git a/encode_aprs.h b/src/encode_aprs.h
similarity index 100%
rename from encode_aprs.h
rename to src/encode_aprs.h
diff --git a/fcs_calc.c b/src/fcs_calc.c
similarity index 100%
rename from fcs_calc.c
rename to src/fcs_calc.c
diff --git a/fcs_calc.h b/src/fcs_calc.h
similarity index 100%
rename from fcs_calc.h
rename to src/fcs_calc.h
diff --git a/fsk_demod_agc.h b/src/fsk_demod_agc.h
similarity index 100%
rename from fsk_demod_agc.h
rename to src/fsk_demod_agc.h
diff --git a/fsk_demod_state.h b/src/fsk_demod_state.h
similarity index 100%
rename from fsk_demod_state.h
rename to src/fsk_demod_state.h
diff --git a/fsk_filters.h b/src/fsk_filters.h
similarity index 100%
rename from fsk_filters.h
rename to src/fsk_filters.h
diff --git a/fsk_gen_filter.h b/src/fsk_gen_filter.h
similarity index 100%
rename from fsk_gen_filter.h
rename to src/fsk_gen_filter.h
diff --git a/gen_packets.c b/src/gen_packets.c
similarity index 100%
rename from gen_packets.c
rename to src/gen_packets.c
diff --git a/gen_tone.c b/src/gen_tone.c
similarity index 100%
rename from gen_tone.c
rename to src/gen_tone.c
diff --git a/gen_tone.h b/src/gen_tone.h
similarity index 100%
rename from gen_tone.h
rename to src/gen_tone.h
diff --git a/grm_sym.h b/src/grm_sym.h
similarity index 100%
rename from grm_sym.h
rename to src/grm_sym.h
diff --git a/hdlc_rec.c b/src/hdlc_rec.c
similarity index 100%
rename from hdlc_rec.c
rename to src/hdlc_rec.c
diff --git a/hdlc_rec.h b/src/hdlc_rec.h
similarity index 100%
rename from hdlc_rec.h
rename to src/hdlc_rec.h
diff --git a/hdlc_rec2.c b/src/hdlc_rec2.c
similarity index 100%
rename from hdlc_rec2.c
rename to src/hdlc_rec2.c
diff --git a/hdlc_rec2.h b/src/hdlc_rec2.h
similarity index 100%
rename from hdlc_rec2.h
rename to src/hdlc_rec2.h
diff --git a/hdlc_send.c b/src/hdlc_send.c
similarity index 100%
rename from hdlc_send.c
rename to src/hdlc_send.c
diff --git a/hdlc_send.h b/src/hdlc_send.h
similarity index 100%
rename from hdlc_send.h
rename to src/hdlc_send.h
diff --git a/igate.c b/src/igate.c
similarity index 99%
rename from igate.c
rename to src/igate.c
index c9582cec..aa9f8c10 100644
--- a/igate.c
+++ b/src/igate.c
@@ -209,7 +209,7 @@ int main (int argc, char *argv[])
 	packet_t pp;
 
 	memset (&audio_config, 0, sizeof(audio_config));
-	audio_config.adev[0].num_chans = 2;
+	audio_config.adev[0].num_channels = 2;
 	strlcpy (audio_config.achan[0].mycall, "WB2OSZ-1", sizeof(audio_config.achan[0].mycall));
 	strlcpy (audio_config.achan[1].mycall, "WB2OSZ-2", sizeof(audio_config.achan[0].mycall));
 
@@ -228,7 +228,7 @@ int main (int argc, char *argv[])
 
 	memset (&digi_config, 0, sizeof(digi_config));
 
-	igate_init(&igate_config, &digi_config);
+	igate_init(&audio_config, &igate_config, &digi_config, 0);
 
 	while (igate_sock == -1) {
 	  SLEEP_SEC(1);
@@ -269,7 +269,7 @@ int main (int argc, char *argv[])
 	  SLEEP_SEC (20);
 	  text_color_set(DW_COLOR_INFO);
 	  dw_printf ("Send received packet\n");
-	  send_msg_to_server ("W1ABC>APRS:?", strlen("W1ABC>APRS:?");
+	  send_msg_to_server ("W1ABC>APRS:?", strlen("W1ABC>APRS:?"));
 	}
 #endif
 	return 0;
diff --git a/igate.h b/src/igate.h
similarity index 100%
rename from igate.h
rename to src/igate.h
diff --git a/kiss.c b/src/kiss.c
similarity index 100%
rename from kiss.c
rename to src/kiss.c
diff --git a/kiss.h b/src/kiss.h
similarity index 100%
rename from kiss.h
rename to src/kiss.h
diff --git a/kiss_frame.c b/src/kiss_frame.c
similarity index 100%
rename from kiss_frame.c
rename to src/kiss_frame.c
diff --git a/kiss_frame.h b/src/kiss_frame.h
similarity index 100%
rename from kiss_frame.h
rename to src/kiss_frame.h
diff --git a/kissnet.c b/src/kissnet.c
similarity index 100%
rename from kissnet.c
rename to src/kissnet.c
diff --git a/kissnet.h b/src/kissnet.h
similarity index 100%
rename from kissnet.h
rename to src/kissnet.h
diff --git a/kissserial.c b/src/kissserial.c
similarity index 100%
rename from kissserial.c
rename to src/kissserial.c
diff --git a/kissserial.h b/src/kissserial.h
similarity index 100%
rename from kissserial.h
rename to src/kissserial.h
diff --git a/kissutil.c b/src/kissutil.c
similarity index 100%
rename from kissutil.c
rename to src/kissutil.c
diff --git a/latlong.c b/src/latlong.c
similarity index 100%
rename from latlong.c
rename to src/latlong.c
diff --git a/latlong.h b/src/latlong.h
similarity index 100%
rename from latlong.h
rename to src/latlong.h
diff --git a/ll2utm.c b/src/ll2utm.c
similarity index 100%
rename from ll2utm.c
rename to src/ll2utm.c
diff --git a/log.c b/src/log.c
similarity index 100%
rename from log.c
rename to src/log.c
diff --git a/log.h b/src/log.h
similarity index 100%
rename from log.h
rename to src/log.h
diff --git a/log2gpx.c b/src/log2gpx.c
similarity index 100%
rename from log2gpx.c
rename to src/log2gpx.c
diff --git a/mgn_icon.h b/src/mgn_icon.h
similarity index 100%
rename from mgn_icon.h
rename to src/mgn_icon.h
diff --git a/mheard.c b/src/mheard.c
similarity index 100%
rename from mheard.c
rename to src/mheard.c
diff --git a/mheard.h b/src/mheard.h
similarity index 100%
rename from mheard.h
rename to src/mheard.h
diff --git a/morse.c b/src/morse.c
similarity index 100%
rename from morse.c
rename to src/morse.c
diff --git a/morse.h b/src/morse.h
similarity index 100%
rename from morse.h
rename to src/morse.h
diff --git a/multi_modem.c b/src/multi_modem.c
similarity index 100%
rename from multi_modem.c
rename to src/multi_modem.c
diff --git a/multi_modem.h b/src/multi_modem.h
similarity index 100%
rename from multi_modem.h
rename to src/multi_modem.h
diff --git a/pfilter.c b/src/pfilter.c
similarity index 100%
rename from pfilter.c
rename to src/pfilter.c
diff --git a/pfilter.h b/src/pfilter.h
similarity index 100%
rename from pfilter.h
rename to src/pfilter.h
diff --git a/ptt.c b/src/ptt.c
similarity index 100%
rename from ptt.c
rename to src/ptt.c
diff --git a/ptt.h b/src/ptt.h
similarity index 100%
rename from ptt.h
rename to src/ptt.h
diff --git a/rdq.c b/src/rdq.c
similarity index 100%
rename from rdq.c
rename to src/rdq.c
diff --git a/rdq.h b/src/rdq.h
similarity index 100%
rename from rdq.h
rename to src/rdq.h
diff --git a/recv.c b/src/recv.c
similarity index 100%
rename from recv.c
rename to src/recv.c
diff --git a/recv.h b/src/recv.h
similarity index 100%
rename from recv.h
rename to src/recv.h
diff --git a/redecode.h b/src/redecode.h
similarity index 100%
rename from redecode.h
rename to src/redecode.h
diff --git a/rpack.h b/src/rpack.h
similarity index 100%
rename from rpack.h
rename to src/rpack.h
diff --git a/rrbb.c b/src/rrbb.c
similarity index 100%
rename from rrbb.c
rename to src/rrbb.c
diff --git a/rrbb.h b/src/rrbb.h
similarity index 100%
rename from rrbb.h
rename to src/rrbb.h
diff --git a/serial_port.c b/src/serial_port.c
similarity index 100%
rename from serial_port.c
rename to src/serial_port.c
diff --git a/serial_port.h b/src/serial_port.h
similarity index 100%
rename from serial_port.h
rename to src/serial_port.h
diff --git a/server.c b/src/server.c
similarity index 100%
rename from server.c
rename to src/server.c
diff --git a/server.h b/src/server.h
similarity index 100%
rename from server.h
rename to src/server.h
diff --git a/symbols.c b/src/symbols.c
similarity index 99%
rename from symbols.c
rename to src/symbols.c
index 208c3276..448fbcc1 100644
--- a/symbols.c
+++ b/src/symbols.c
@@ -265,6 +265,8 @@ static const struct {
 
 static const char *search_locations[] = {
 	(const char *) "symbols-new.txt",
+	(const char *) "data/symbols-new.txt",
+	(const char *) "../data/symbols-new.txt",
 #ifndef __WIN32__
 	(const char *) "/usr/local/share/direwolf/symbols-new.txt",
 	(const char *) "/usr/share/direwolf/symbols-new.txt",
@@ -1059,4 +1061,4 @@ int main (int argc, char *argv[])
 
 #endif
 
-/* end symbols.c */
\ No newline at end of file
+/* end symbols.c */
diff --git a/symbols.h b/src/symbols.h
similarity index 100%
rename from symbols.h
rename to src/symbols.h
diff --git a/telemetry.c b/src/telemetry.c
similarity index 100%
rename from telemetry.c
rename to src/telemetry.c
diff --git a/telemetry.h b/src/telemetry.h
similarity index 100%
rename from telemetry.h
rename to src/telemetry.h
diff --git a/textcolor.c b/src/textcolor.c
similarity index 100%
rename from textcolor.c
rename to src/textcolor.c
diff --git a/textcolor.h b/src/textcolor.h
similarity index 100%
rename from textcolor.h
rename to src/textcolor.h
diff --git a/tq.c b/src/tq.c
similarity index 100%
rename from tq.c
rename to src/tq.c
diff --git a/tq.h b/src/tq.h
similarity index 100%
rename from tq.h
rename to src/tq.h
diff --git a/tt_text.c b/src/tt_text.c
similarity index 100%
rename from tt_text.c
rename to src/tt_text.c
diff --git a/tt_text.h b/src/tt_text.h
similarity index 100%
rename from tt_text.h
rename to src/tt_text.h
diff --git a/tt_user.c b/src/tt_user.c
similarity index 100%
rename from tt_user.c
rename to src/tt_user.c
diff --git a/tt_user.h b/src/tt_user.h
similarity index 100%
rename from tt_user.h
rename to src/tt_user.h
diff --git a/ttcalc.c b/src/ttcalc.c
similarity index 100%
rename from ttcalc.c
rename to src/ttcalc.c
diff --git a/tune.h b/src/tune.h
similarity index 100%
rename from tune.h
rename to src/tune.h
diff --git a/utm2ll.c b/src/utm2ll.c
similarity index 100%
rename from utm2ll.c
rename to src/utm2ll.c
diff --git a/version.h b/src/version.h
similarity index 71%
rename from version.h
rename to src/version.h
index a99ae46e..0c72d45d 100644
--- a/version.h
+++ b/src/version.h
@@ -3,6 +3,6 @@
 
 #define APP_TOCALL "APDW"		// Assigned by WB4APR in tocalls.txt
 
-#define MAJOR_VERSION 1
-#define MINOR_VERSION 6
+//#define MAJOR_VERSION 1
+//#define MINOR_VERSION 6
 //#define EXTRA_VERSION "Beta Test"
diff --git a/walk96.c b/src/walk96.c
similarity index 97%
rename from walk96.c
rename to src/walk96.c
index dfad612f..9fc791f8 100644
--- a/walk96.c
+++ b/src/walk96.c
@@ -86,7 +86,7 @@ int main (int argc, char *argv[])
 	// USB GPS happens to be COM22
 
 	memset (&config, 0, sizeof(config));
-	strlcpy (config.gpsnmea_port, "COM22", sizeof(config.nmea_port));
+	strlcpy (config.gpsnmea_port, "COM22", sizeof(config.gpsnmea_port));
 
 	dwgps_init (&config, debug_gps);
 
@@ -152,7 +152,7 @@ static void walk96 (int fix, double lat, double lon, float knots, float course,
 
 
 	info_len = encode_position (messaging, compressed,
-		lat, lon, (int)(DW_METERS_TO_FEET(alt)), 
+		lat, lon, 0, (int)(DW_METERS_TO_FEET(alt)), 
 		'/', '=',
 		G_UNKNOWN, G_UNKNOWN, G_UNKNOWN, "",	// PHGd
 		(int)roundf(course), (int)roundf(knots),
diff --git a/waypoint.c b/src/waypoint.c
similarity index 100%
rename from waypoint.c
rename to src/waypoint.c
diff --git a/waypoint.h b/src/waypoint.h
similarity index 100%
rename from waypoint.h
rename to src/waypoint.h
diff --git a/xid.c b/src/xid.c
similarity index 100%
rename from xid.c
rename to src/xid.c
diff --git a/xid.h b/src/xid.h
similarity index 100%
rename from xid.h
rename to src/xid.h
diff --git a/xmit.c b/src/xmit.c
similarity index 100%
rename from xmit.c
rename to src/xmit.c
diff --git a/xmit.h b/src/xmit.h
similarity index 100%
rename from xmit.h
rename to src/xmit.h
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644
index 00000000..3562dd0b
--- /dev/null
+++ b/test/CMakeLists.txt
@@ -0,0 +1,649 @@
+# this is a trick to avoid more complication
+# because configure_file() is done a configuration time
+set(CUSTOM_TEST_BINARY_DIR "${CMAKE_BINARY_DIR}/test")
+set(GEN_PACKETS_BIN "${CMAKE_BINARY_DIR}/src/gen_packets${CMAKE_EXECUTABLE_SUFFIX}")
+set(ATEST_BIN "${CMAKE_BINARY_DIR}/src/atest${CMAKE_EXECUTABLE_SUFFIX}")
+
+if(WIN32)
+  set(CUSTOM_SCRIPT_SUFFIX ".bat")
+else()
+  set(CUSTOM_SCRIPT_SUFFIX "")
+endif()
+
+set(TEST_CHECK-MODEM1200_FILE "check-modem1200")
+set(TEST_CHECK-MODEM300_FILE "check-modem300")
+set(TEST_CHECK-MODEM9600_FILE "check-modem9600")
+set(TEST_CHECK-MODEM19200_FILE "check-modem19200")
+set(TEST_CHECK-MODEM2400-a_FILE "check-modem2400-a")
+set(TEST_CHECK-MODEM2400-b_FILE "check-modem2400-b")
+set(TEST_CHECK-MODEM2400-g_FILE "check-modem2400-g")
+set(TEST_CHECK-MODEM4800_FILE "check-modem4800")
+
+# generate the scripts that run the tests
+configure_file(
+  "${CUSTOM_TEST_SCRIPTS_DIR}/${TEST_CHECK-MODEM1200_FILE}"
+  "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM1200_FILE}${CUSTOM_SCRIPT_SUFFIX}"
+  @ONLY
+  )
+
+configure_file(
+  "${CUSTOM_TEST_SCRIPTS_DIR}/${TEST_CHECK-MODEM300_FILE}"
+  "${CUSTOM_TEST_BINARY_DIR}${CUSTOM_SCRIPT_SUFFIX}"
+  @ONLY
+  )
+
+configure_file(
+  "${CUSTOM_TEST_SCRIPTS_DIR}/${TEST_CHECK-MODEM9600_FILE}"
+  "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM9600_FILE}${CUSTOM_SCRIPT_SUFFIX}"
+  @ONLY
+  )
+
+configure_file(
+  "${CUSTOM_TEST_SCRIPTS_DIR}/${TEST_CHECK-MODEM19200_FILE}"
+  "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM19200_FILE}${CUSTOM_SCRIPT_SUFFIX}"
+  @ONLY
+  )
+
+configure_file(
+  "${CUSTOM_TEST_SCRIPTS_DIR}/${TEST_CHECK-MODEM2400-a_FILE}"
+  "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM2400-a_FILE}${CUSTOM_SCRIPT_SUFFIX}"
+  @ONLY
+  )
+
+configure_file(
+  "${CUSTOM_TEST_SCRIPTS_DIR}/${TEST_CHECK-MODEM2400-b_FILE}"
+  "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM2400-b_FILE}${CUSTOM_SCRIPT_SUFFIX}"
+  @ONLY
+  )
+
+configure_file(
+  "${CUSTOM_TEST_SCRIPTS_DIR}/${TEST_CHECK-MODEM2400-g_FILE}"
+  "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM2400-g_FILE}${CUSTOM_SCRIPT_SUFFIX}"
+  @ONLY
+  )
+
+configure_file(
+  "${CUSTOM_TEST_SCRIPTS_DIR}/${TEST_CHECK-MODEM4800_FILE}"
+  "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM4800_FILE}${CUSTOM_SCRIPT_SUFFIX}"
+  @ONLY
+  )
+
+
+# global includes
+# not ideal but not so slow
+# otherwise use target_include_directories
+include_directories(
+  ${CUSTOM_SRC_DIR}
+  ${GPSD_INCLUDE_DIRS}
+  ${HAMLIB_INCLUDE_DIRS}
+  ${ALSA_INCLUDE_DIRS}
+  ${UDEV_INCLUDE_DIRS}
+  ${PORTAUDIO_INCLUDE_DIRS}
+  ${CUSTOM_GEOTRANZ_DIR}
+  ${CMAKE_BINARY_DIR}/src
+  )
+
+if(WIN32 OR CYGWIN)
+  include_directories(
+    ${CUSTOM_REGEX_DIR}
+  )
+endif()
+
+
+# Unit test for demodulators
+list(APPEND atest9_SOURCES
+  ${CUSTOM_SRC_DIR}/atest.c
+  ${CUSTOM_SRC_DIR}/demod.c
+  ${CUSTOM_SRC_DIR}/dsp.c
+  ${CUSTOM_SRC_DIR}/demod_afsk.c
+  ${CUSTOM_SRC_DIR}/demod_psk.c
+  ${CUSTOM_SRC_DIR}/demod_9600.c
+  ${CUSTOM_SRC_DIR}/hdlc_rec.c
+  ${CUSTOM_SRC_DIR}/hdlc_rec2.c
+  ${CUSTOM_SRC_DIR}/multi_modem.c
+  ${CUSTOM_SRC_DIR}/rrbb.c
+  ${CUSTOM_SRC_DIR}/fcs_calc.c
+  ${CUSTOM_SRC_DIR}/ax25_pad.c
+  ${CUSTOM_SRC_DIR}/decode_aprs.c
+  ${CUSTOM_SRC_DIR}/dwgpsnmea.c
+  ${CUSTOM_SRC_DIR}/dwgps.c
+  ${CUSTOM_SRC_DIR}/dwgpsd.c
+  ${CUSTOM_SRC_DIR}/serial_port.c
+  ${CUSTOM_SRC_DIR}/latlong.c
+  ${CUSTOM_SRC_DIR}/symbols.c
+  ${CUSTOM_SRC_DIR}/textcolor.c
+  ${CUSTOM_SRC_DIR}/telemetry.c
+  ${CUSTOM_SRC_DIR}/dtime_now.c
+  ${CUSTOM_SRC_DIR}/tt_text.c
+  )
+
+if(WIN32 OR CYGWIN)
+  list(REMOVE_ITEM atest9_SOURCES
+    ${CUSTOM_SRC_DIR}/dwgpsd.c
+    )
+endif()
+
+add_executable(atest9
+  ${atest9_SOURCES}
+  )
+
+add_dependencies(atest9 gen_fff)
+
+target_link_libraries(atest9
+  ${MISC_LIBRARIES}
+  ${REGEX_LIBRARIES}
+  ${GPSD_LIBRARIES}
+  Threads::Threads
+  )
+
+if(WIN32 OR CYGWIN)
+  set_target_properties(atest9
+    PROPERTIES COMPILE_FLAGS "-DUSE_REGEX_STATIC"
+    )
+  target_link_libraries(atest9 ws2_32)
+endif()
+
+
+# Unit test for inner digipeater algorithm
+list(APPEND dtest_SOURCES
+  ${CUSTOM_SRC_DIR}/digipeater.c
+  ${CUSTOM_SRC_DIR}/dedupe.c
+  ${CUSTOM_SRC_DIR}/pfilter.c
+  ${CUSTOM_SRC_DIR}/ax25_pad.c
+  ${CUSTOM_SRC_DIR}/fcs_calc.c
+  ${CUSTOM_SRC_DIR}/tq.c
+  ${CUSTOM_SRC_DIR}/textcolor.c
+  ${CUSTOM_SRC_DIR}/decode_aprs.c
+  ${CUSTOM_SRC_DIR}/dwgpsnmea.c
+  ${CUSTOM_SRC_DIR}/dwgps.c
+  ${CUSTOM_SRC_DIR}/dwgpsd.c
+  ${CUSTOM_SRC_DIR}/serial_port.c
+  ${CUSTOM_SRC_DIR}/latlong.c
+  ${CUSTOM_SRC_DIR}/telemetry.c
+  ${CUSTOM_SRC_DIR}/symbols.c
+  ${CUSTOM_SRC_DIR}/tt_text.c
+  )
+
+if(WIN32 OR CYGWIN)
+  list(REMOVE_ITEM dtest_SOURCES
+    ${CUSTOM_SRC_DIR}/dwgpsd.c
+    )
+endif()
+
+add_executable(dtest
+  ${dtest_SOURCES}
+  )
+
+set_target_properties(dtest
+  PROPERTIES COMPILE_FLAGS "-DDIGITEST -DUSE_REGEX_STATIC"
+  )
+
+target_link_libraries(dtest
+  ${MISC_LIBRARIES}
+  ${REGEX_LIBRARIES}
+  ${GPSD_LIBRARIES}
+  Threads::Threads
+  )
+
+if(WIN32 OR CYGWIN)
+  target_link_libraries(dtest ws2_32)
+endif()
+
+
+# Unit test for APRStt tone seqence parsing.
+list(APPEND ttest_SOURCES
+  ${CUSTOM_SRC_DIR}/aprs_tt.c
+  ${CUSTOM_SRC_DIR}/tt_text.c
+  ${CUSTOM_SRC_DIR}/latlong.c
+  ${CUSTOM_SRC_DIR}/textcolor.c
+  )
+
+add_executable(ttest
+  ${ttest_SOURCES}
+  )
+
+set_target_properties(ttest
+  PROPERTIES COMPILE_FLAGS "-DTT_MAIN"
+  )
+
+target_link_libraries(ttest
+  ${MISC_LIBRARIES}
+  ${GEOTRANZ_LIBRARIES}
+  )
+
+
+# Unit test for APRStt tone sequence / text conversions.
+list(APPEND tttexttest_SOURCES
+  ${CUSTOM_SRC_DIR}/tt_text.c
+  ${CUSTOM_SRC_DIR}/textcolor.c
+  )
+
+add_executable(tttexttest
+  ${tttexttest_SOURCES}
+  )
+
+set_target_properties(tttexttest
+  PROPERTIES COMPILE_FLAGS "-DTTT_TEST"
+  )
+
+target_link_libraries(tttexttest
+  ${MISC_LIBRARIES}
+  )
+
+
+# Unit test for Packet Filtering.
+list(APPEND pftest_SOURCES
+  ${CUSTOM_SRC_DIR}/pfilter.c
+  ${CUSTOM_SRC_DIR}/ax25_pad.c
+  ${CUSTOM_SRC_DIR}/textcolor.c
+  ${CUSTOM_SRC_DIR}/fcs_calc.c
+  ${CUSTOM_SRC_DIR}/decode_aprs.c
+  ${CUSTOM_SRC_DIR}/dwgpsnmea.c
+  ${CUSTOM_SRC_DIR}/dwgps.c
+  ${CUSTOM_SRC_DIR}/dwgpsd.c
+  ${CUSTOM_SRC_DIR}/serial_port.c
+  ${CUSTOM_SRC_DIR}/latlong.c
+  ${CUSTOM_SRC_DIR}/symbols.c
+  ${CUSTOM_SRC_DIR}/telemetry.c
+  ${CUSTOM_SRC_DIR}/tt_text.c
+  )
+
+if(WIN32 OR CYGWIN)
+  list(REMOVE_ITEM pftest_SOURCES
+    ${CUSTOM_SRC_DIR}/dwgpsd.c
+    )
+endif()
+
+add_executable(pftest
+  ${pftest_SOURCES}
+  )
+
+set_target_properties(pftest
+  PROPERTIES COMPILE_FLAGS "-DPFTEST -DUSE_REGEX_STATIC"
+  )
+
+target_link_libraries(pftest
+  ${MISC_LIBRARIES}
+  ${REGEX_LIBRARIES}
+  ${GPSD_LIBRARIES}
+  Threads::Threads
+  )
+
+if(WIN32 OR CYGWIN)
+  target_link_libraries(pftest ws2_32)
+endif()
+
+# Unit test for telemetry decoding.
+list(APPEND tlmtest_SOURCES
+  ${CUSTOM_SRC_DIR}/telemetry.c
+  ${CUSTOM_SRC_DIR}/ax25_pad.c
+  ${CUSTOM_SRC_DIR}/fcs_calc.c
+  ${CUSTOM_SRC_DIR}/textcolor.c
+  )
+
+if(WIN32 OR CYGWIN)
+  list(REMOVE_ITEM tlmtest_SOURCES
+    ${CUSTOM_SRC_DIR}/dwgpsd.c
+    )
+endif()
+
+add_executable(tlmtest
+  ${tlmtest_SOURCES}
+  )
+
+set_target_properties(tlmtest
+  PROPERTIES COMPILE_FLAGS "-DTEST -DUSE_REGEX_STATIC"
+  )
+
+target_link_libraries(tlmtest
+  ${MISC_LIBRARIES}
+  ${REGEX_LIBRARIES}
+  )
+
+if(WIN32 OR CYGWIN)
+  target_link_libraries(tlmtest ws2_32)
+endif()
+
+
+# Unit test for location coordinate conversion.
+list(APPEND lltest_SOURCES
+  ${CUSTOM_SRC_DIR}/latlong.c
+  ${CUSTOM_SRC_DIR}/textcolor.c
+  )
+
+add_executable(lltest
+  ${lltest_SOURCES}
+  )
+
+set_target_properties(lltest
+  PROPERTIES COMPILE_FLAGS "-DLLTEST"
+  )
+
+target_link_libraries(lltest
+  ${MISC_LIBRARIES}
+  )
+
+
+# Unit test for encoding position & object report.
+list(APPEND enctest_SOURCES
+  ${CUSTOM_SRC_DIR}/encode_aprs.c
+  ${CUSTOM_SRC_DIR}/latlong.c
+  ${CUSTOM_SRC_DIR}/textcolor.c
+  )
+
+add_executable(enctest
+  ${enctest_SOURCES}
+  )
+
+set_target_properties(enctest
+  PROPERTIES COMPILE_FLAGS "-DEN_MAIN"
+  )
+
+target_link_libraries(enctest
+  ${MISC_LIBRARIES}
+  )
+
+
+# Unit test for KISS encapsulation.
+list(APPEND kisstest_SOURCES
+  ${CUSTOM_SRC_DIR}/kiss_frame.c
+  )
+
+add_executable(kisstest
+  ${kisstest_SOURCES}
+  )
+
+set_target_properties(kisstest
+  PROPERTIES COMPILE_FLAGS "-DKISSTEST"
+  )
+
+
+# Unit test for constructing frames besides UI.
+list(APPEND pad2test_SOURCES
+  ${CUSTOM_SRC_DIR}/ax25_pad2.c
+  ${CUSTOM_SRC_DIR}/ax25_pad.c
+  ${CUSTOM_SRC_DIR}/fcs_calc.c
+  ${CUSTOM_SRC_DIR}/textcolor.c
+  )
+
+add_executable(pad2test
+  ${pad2test_SOURCES}
+  )
+
+set_target_properties(pad2test
+  PROPERTIES COMPILE_FLAGS "-DPAD2TEST -DUSE_REGEX_STATIC"
+  )
+
+target_link_libraries(pad2test
+  ${MISC_LIBRARIES}
+  ${REGEX_LIBRARIES}
+  )
+
+if(WIN32 OR CYGWIN)
+  target_link_libraries(pad2test ws2_32)
+endif()
+
+
+# Unit Test for XID frame encode/decode.
+list(APPEND xidtest_SOURCES
+  ${CUSTOM_SRC_DIR}/xid.c
+  ${CUSTOM_SRC_DIR}/textcolor.c
+  )
+
+add_executable(xidtest
+  ${xidtest_SOURCES}
+  )
+
+set_target_properties(xidtest
+  PROPERTIES COMPILE_FLAGS "-DXIDTEST"
+  )
+
+target_link_libraries(xidtest
+  ${MISC_LIBRARIES}
+  )
+
+
+# Unit Test for DTMF encode/decode.
+list(APPEND dtmftest_SOURCES
+  ${CUSTOM_SRC_DIR}/dtmf.c
+  ${CUSTOM_SRC_DIR}/textcolor.c
+  )
+
+add_executable(dtmftest
+  ${dtmftest_SOURCES}
+  )
+
+set_target_properties(dtmftest
+  PROPERTIES COMPILE_FLAGS "-DDTMF_TEST"
+  )
+
+
+# doing ctest on previous programs
+add_test(dtest dtest)
+add_test(ttest ttest)
+add_test(tttexttest tttexttest)
+add_test(pftest pftest)
+add_test(tlmtest tlmtest)
+add_test(lltest lltest)
+add_test(enctest enctest)
+add_test(kisstest kisstest)
+add_test(pad2test pad2test)
+add_test(xidtest xidtest)
+add_test(dtmftest dtmftest)
+
+add_test(check-modem1200 "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM1200_FILE}${CUSTOM_SCRIPT_SUFFIX}")
+add_test(check-modem300 "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM300_FILE}${CUSTOM_SCRIPT_SUFFIX}")
+add_test(check-modem9600 "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM9600_FILE}${CUSTOM_SCRIPT_SUFFIX}")
+add_test(check-modem19200 "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM19200_FILE}${CUSTOM_SCRIPT_SUFFIX}")
+add_test(check-modem2400-a "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM2400-a_FILE}${CUSTOM_SCRIPT_SUFFIX}")
+add_test(check-modem2400-b "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM2400-b_FILE}${CUSTOM_SCRIPT_SUFFIX}")
+add_test(check-modem2400-g "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM2400-g_FILE}${CUSTOM_SCRIPT_SUFFIX}")
+add_test(check-modem4800 "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM4800_FILE}${CUSTOM_SCRIPT_SUFFIX}")
+
+# TODO  miss the audio file
+# ./atest9 -B 9600 ../walkabout9600.wav | grep "packets decoded in" >atest.out
+
+
+#  -----------------------------  Manual tests and experiments  ---------------------------
+if(OPTIONAL_TEST)
+
+  # Unit test for IGate
+  list(APPEND itest_SOURCES
+    ${CUSTOM_SRC_DIR}/igate.c
+    ${CUSTOM_SRC_DIR}/ax25_pad.c
+    ${CUSTOM_SRC_DIR}/fcs_calc.c
+    ${CUSTOM_SRC_DIR}/mheard.c
+    ${CUSTOM_SRC_DIR}/pfilter.c
+    ${CUSTOM_SRC_DIR}/telemetry.c
+    ${CUSTOM_SRC_DIR}/decode_aprs.c
+    ${CUSTOM_SRC_DIR}/dwgpsnmea.c
+    ${CUSTOM_SRC_DIR}/dwgps.c
+    ${CUSTOM_SRC_DIR}/dwgpsd.c
+    ${CUSTOM_SRC_DIR}/serial_port.c
+    ${CUSTOM_SRC_DIR}/textcolor.c
+    ${CUSTOM_SRC_DIR}/dtime_now.c
+    ${CUSTOM_SRC_DIR}/latlong.c
+    ${CUSTOM_SRC_DIR}/tt_text.c
+    ${CUSTOM_SRC_DIR}/symbols.c
+    )
+
+  if(WIN32 OR CYGWIN)
+    list(REMOVE_ITEM itest_SOURCES
+      ${CUSTOM_SRC_DIR}/dwgpsd.c
+      )
+  endif()
+
+  add_executable(itest
+    ${itest_SOURCES}
+    )
+
+  set_target_properties(itest
+    PROPERTIES COMPILE_FLAGS "-DITEST"
+    )
+
+  target_link_libraries(itest
+    ${MISC_LIBRARIES}
+    ${GPSD_LIBRARIES}
+    Threads::Threads
+    )
+
+  if(WIN32 OR CYGWIN)
+    target_link_libraries(itest ws2_32)
+  endif()
+
+
+  # For demodulator tweaking experiments.
+  list(APPEND testagc_SOURCES
+    ${CUSTOM_SRC_DIR}/atest.c
+    ${CUSTOM_SRC_DIR}/demod.c
+    ${CUSTOM_SRC_DIR}/dsp.c
+    ${CUSTOM_SRC_DIR}/demod_afsk.c
+    ${CUSTOM_SRC_DIR}/demod_psk.c
+    ${CUSTOM_SRC_DIR}/demod_9600.c
+    ${CUSTOM_SRC_DIR}/hdlc_rec.c
+    ${CUSTOM_SRC_DIR}/hdlc_rec2.c
+    ${CUSTOM_SRC_DIR}/multi_modem.c
+    ${CUSTOM_SRC_DIR}/rrbb.c
+    ${CUSTOM_SRC_DIR}/fcs_calc.c
+    ${CUSTOM_SRC_DIR}/ax25_pad.c
+    ${CUSTOM_SRC_DIR}/decode_aprs.c
+    ${CUSTOM_SRC_DIR}/dwgpsnmea.c
+    ${CUSTOM_SRC_DIR}/dwgps.c
+    ${CUSTOM_SRC_DIR}/dwgpsd.c
+    ${CUSTOM_SRC_DIR}/serial_port.c
+    ${CUSTOM_SRC_DIR}/telemetry.c
+    ${CUSTOM_SRC_DIR}/dtime_now.c
+    ${CUSTOM_SRC_DIR}/latlong.c
+    ${CUSTOM_SRC_DIR}/tt_text.c
+    ${CUSTOM_SRC_DIR}/symbols.c
+    ${CUSTOM_SRC_DIR}/textcolor.c
+    )
+
+  if(WIN32 OR CYGWIN)
+    list(REMOVE_ITEM testagc_SOURCES
+      ${CUSTOM_SRC_DIR}/dwgpsd.c
+      )
+  endif()
+
+  add_executable(testagc
+    ${testagc_SOURCES}
+    )
+
+  add_dependencies(testagc gen_fff)
+
+  target_link_libraries(testagc
+    ${MISC_LIBRARIES}
+    ${GPSD_LIBRARIES}
+    Threads::Threads
+    )
+
+  if(WIN32 OR CYGWIN)
+    target_link_libraries(testagc ws2_32)
+  endif()
+
+
+  # Send GPS location to KISS TNC each second.
+  list(APPEND walk96_SOURCES
+    ${CUSTOM_SRC_DIR}/walk96.c
+    ${CUSTOM_SRC_DIR}/dwgps.c
+    ${CUSTOM_SRC_DIR}/dwgpsnmea.c
+    ${CUSTOM_SRC_DIR}/dwgpsd.c
+    ${CUSTOM_SRC_DIR}/kiss_frame.c
+    ${CUSTOM_SRC_DIR}/latlong.c
+    ${CUSTOM_SRC_DIR}/encode_aprs.c
+    ${CUSTOM_SRC_DIR}/serial_port.c
+    ${CUSTOM_SRC_DIR}/textcolor.c
+    ${CUSTOM_SRC_DIR}/ax25_pad.c
+    ${CUSTOM_SRC_DIR}/fcs_calc.c
+    ${CUSTOM_SRC_DIR}/xmit.c
+    ${CUSTOM_SRC_DIR}/xid.c
+    ${CUSTOM_SRC_DIR}/hdlc_send.c
+    ${CUSTOM_SRC_DIR}/gen_tone.c
+    ${CUSTOM_SRC_DIR}/ptt.c
+    ${CUSTOM_SRC_DIR}/tq.c
+    ${CUSTOM_SRC_DIR}/hdlc_rec.c
+    ${CUSTOM_SRC_DIR}/hdlc_rec2.c
+    ${CUSTOM_SRC_DIR}/rrbb.c
+    ${CUSTOM_SRC_DIR}/dsp.c
+    ${CUSTOM_SRC_DIR}/multi_modem.c
+    ${CUSTOM_SRC_DIR}/demod.c
+    ${CUSTOM_SRC_DIR}/demod_afsk.c
+    ${CUSTOM_SRC_DIR}/demod_psk.c
+    ${CUSTOM_SRC_DIR}/demod_9600.c
+    ${CUSTOM_SRC_DIR}/rdq.c
+    ${CUSTOM_SRC_DIR}/server.c
+    ${CUSTOM_SRC_DIR}/morse.c
+    ${CUSTOM_SRC_DIR}/dtmf.c
+    ${CUSTOM_SRC_DIR}/audio_stats.c
+    ${CUSTOM_SRC_DIR}/dtime_now.c
+    ${CUSTOM_SRC_DIR}/dlq.c
+    )
+
+  if(LINUX)
+    list(APPEND walk96_SOURCES
+      ${CUSTOM_SRC_DIR}/audio.c
+      )
+    if(UDEV_FOUND)
+      list(APPEND walk96_SOURCES
+        ${CUSTOM_SRC_DIR}/cm108.c
+        )
+    endif()
+  elseif(WIN32 OR CYGWIN) # windows
+    list(APPEND walk96_SOURCES
+      ${CUSTOM_SRC_DIR}/audio_win.c
+      )
+    list(REMOVE_ITEM walk96_SOURCES
+      ${CUSTOM_SRC_DIR}/dwgpsd.c
+      )
+  else() # macOS freebsd openbsd
+    list(APPEND walk96_SOURCES
+      ${CUSTOM_SRC_DIR}/audio_portaudio.c
+      )
+  endif()
+
+  add_executable(walk96
+    ${walk96_SOURCES}
+    )
+
+  set_target_properties(walk96
+    PROPERTIES COMPILE_FLAGS "-DWALK96 -DUSE_REGEX_STATIC"
+    )
+
+  target_link_libraries(walk96
+    ${MISC_LIBRARIES}
+    ${REGEX_LIBRARIES}
+    ${GPSD_LIBRARIES}
+    ${HAMLIB_LIBRARIES}
+    ${ALSA_LIBRARIES}
+    ${PORTAUDIO_LIBRARIES}
+    ${UDEV_LIBRARIES}
+    Threads::Threads
+    )
+
+  if(WIN32 OR CYGWIN)
+    target_link_libraries(walk96 ws2_32)
+  endif()
+
+
+  # TODO  miss the audio file
+
+  # testagc
+  # ./atest -P H+ -F 0 ../01_Track_1.wav ../02_Track_2.wav | grep "packets decoded in" >atest.out
+
+  # testagc3
+  # ./gen_packets -B 300 -n 100 -o noisy3.wav
+  # ./atest3 -B 300 -P D -D 3 noisy3.wav | grep "packets decoded in" >atest.out
+
+  # testagc96
+  # ./gen_packets -B 9600 -n 100 -o noisy96.wav
+  # ./atest96 -B 9600 ../walkabout9600c.wav noisy96.wav zzz16.wav zzz16.wav zzz16.wav zzz8.wav zzz8.wav zzz8.wav | grep "packets decoded in" >atest.out
+
+  # testagc24
+  # ./atest24 -B 2400 test2400.wav | grep "packets decoded in" >atest.out
+
+  # testagc24mfj
+  # ./atest24mfj -F 1 -B 2400 ../ref-doc/MFJ-2400-PSK/2k4_short.wav
+
+  # testagc48
+  # ./atest48 -B 4800 test4800.wav | grep "packets decoded in" >atest.out
+endif()  # OPTIONAL_TEST
diff --git a/test/scripts/check-modem1200 b/test/scripts/check-modem1200
new file mode 100755
index 00000000..2b975871
--- /dev/null
+++ b/test/scripts/check-modem1200
@@ -0,0 +1,5 @@
+@CUSTOM_SHELL_SHABANG@
+
+@GEN_PACKETS_BIN@ -n 100 -o test12.wav
+@ATEST_BIN@ -F0 -PE -L64 -G72 test12.wav
+@ATEST_BIN@ -F1 -PE -L70 -G75 test12.wav
diff --git a/test/scripts/check-modem19200 b/test/scripts/check-modem19200
new file mode 100755
index 00000000..8d08a8e6
--- /dev/null
+++ b/test/scripts/check-modem19200
@@ -0,0 +1,7 @@
+@CUSTOM_SHELL_SHABANG@
+
+@GEN_PACKETS_BIN@ -r 96000 -B19200 -a 170 -o test19.wav
+@ATEST_BIN@ -B19200 -F0 -L4 test19.wav
+@GEN_PACKETS_BIN@ -r 96000 -B19200 -n 100 -o test19.wav
+@ATEST_BIN@ -B19200 -F0 -L60 -G64 test19.wav
+@ATEST_BIN@ -B19200 -F1 -L64 -G68 test19.wav
diff --git a/test/scripts/check-modem2400-a b/test/scripts/check-modem2400-a
new file mode 100755
index 00000000..1faa7d14
--- /dev/null
+++ b/test/scripts/check-modem2400-a
@@ -0,0 +1,5 @@
+@CUSTOM_SHELL_SHABANG@
+
+@GEN_PACKETS_BIN@ -B2400 -j -n 100 -o test24-a.wav
+@ATEST_BIN@ -B2400 -j -F0 -L76 -G80 test24-a.wav
+@ATEST_BIN@ -B2400 -j -F1 -L84 -G88 test24-a.wav
diff --git a/test/scripts/check-modem2400-b b/test/scripts/check-modem2400-b
new file mode 100755
index 00000000..01479b71
--- /dev/null
+++ b/test/scripts/check-modem2400-b
@@ -0,0 +1,5 @@
+@CUSTOM_SHELL_SHABANG@
+
+@GEN_PACKETS_BIN@ -B2400 -J -n 100 -o test24-b.wav
+@ATEST_BIN@ -B2400 -J -F0 -L79 -G83 test24-b.wav
+@ATEST_BIN@ -B2400 -J -F1 -L87 -G91 test24-b.wav
diff --git a/test/scripts/check-modem2400-g b/test/scripts/check-modem2400-g
new file mode 100755
index 00000000..b5053703
--- /dev/null
+++ b/test/scripts/check-modem2400-g
@@ -0,0 +1,4 @@
+@CUSTOM_SHELL_SHABANG@
+
+@GEN_PACKETS_BIN@ -B2400 -g -n 100 -o test24-g.wav
+@ATEST_BIN@ -B2400 -g -F0 -L99 -G100 test24-g.wav
diff --git a/test/scripts/check-modem300 b/test/scripts/check-modem300
new file mode 100755
index 00000000..da37dd2b
--- /dev/null
+++ b/test/scripts/check-modem300
@@ -0,0 +1,5 @@
+@CUSTOM_SHELL_SHABANG@
+
+@GEN_PACKETS_BIN@ -B300 -n 100 -o test3.wav
+@ATEST_BIN@ -B300 -F0 -L68 -G69 test3.wav
+@ATEST_BIN@ -B300 -F1 -L71 -G75 test3.wav
diff --git a/test/scripts/check-modem4800 b/test/scripts/check-modem4800
new file mode 100755
index 00000000..2ad033d5
--- /dev/null
+++ b/test/scripts/check-modem4800
@@ -0,0 +1,5 @@
+@CUSTOM_SHELL_SHABANG@
+
+@GEN_PACKETS_BIN@ -B4800 -n 100 -o test48.wav
+@ATEST_BIN@ -B4800 -F0 -L70 -G74 test48.wav
+@ATEST_BIN@ -B4800 -F1 -L79 -G84 test48.wav
diff --git a/test/scripts/check-modem9600 b/test/scripts/check-modem9600
new file mode 100755
index 00000000..fa5f6583
--- /dev/null
+++ b/test/scripts/check-modem9600
@@ -0,0 +1,7 @@
+@CUSTOM_SHELL_SHABANG@
+
+@GEN_PACKETS_BIN@ -B9600 -a 170 -o test96.wav
+@ATEST_BIN@ -B9600 -F0 -L4 -G4 test96.wav
+@GEN_PACKETS_BIN@ -B9600 -n 100 -o test96.wav
+@ATEST_BIN@ -B9600 -F0 -L61 -G65 test96.wav
+@ATEST_BIN@ -B9600 -F1 -L62 -G66 test96.wav