From d0d3b5081f635cc37cd657aaf244ffebedc58ccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Pinkava?= Date: Mon, 14 Nov 2022 00:25:09 +0100 Subject: [PATCH 1/2] Move to CMake build system --- .github/workflows/ci.yml | 17 +- .gitignore | 2 +- CMakeLists.txt | 328 +++++++++++++++++++++++++++++++++++++++ INSTALL.txt | 2 +- Makefile.debug | 200 ------------------------ Makefile.linux | 200 ------------------------ Makefile.osx | 184 ---------------------- airspyd.c | 2 +- airspyhfd.c | 2 +- hid-libusb.c | 2 +- monitor.c | 2 +- opusd.c | 2 +- opussend.c | 2 +- pcmspawn.c | 5 +- 14 files changed, 348 insertions(+), 602 deletions(-) create mode 100644 CMakeLists.txt delete mode 100644 Makefile.debug delete mode 100644 Makefile.linux delete mode 100644 Makefile.osx diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf89cbb3..d138e43c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,15 +5,13 @@ on: [push, pull_request] jobs: ubuntu-build: name: Ubuntu CI - strategy: - matrix: - makefile: [Makefile.linux, Makefile.debug] runs-on: ubuntu-20.04 steps: - name: Install dependencies run: | sudo apt-get update -qq sudo apt-get install -y \ + cmake \ libusb-1.0-0-dev \ libncurses5-dev \ libfftw3-dev \ @@ -29,11 +27,11 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - name: Setup - run: ln -s ${{ matrix.makefile }} Makefile + run: cmake -S . -B build - name: Compile - run: make + run: make -C build - name: Install - run: sudo make install + run: sudo make -C build install macos-build: name: MacOS CI runs-on: macos-11.0 @@ -42,6 +40,7 @@ jobs: run: | brew update brew install \ + cmake \ glib \ libusb \ ncurses \ @@ -76,8 +75,8 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - name: Setup - run: ln -s Makefile.osx Makefile + run: cmake -S . -B build - name: Compile - run: make + run: make -C build - name: Install - run: sudo make install + run: sudo make -C build install diff --git a/.gitignore b/.gitignore index 3a3d959e..983e3dcf 100644 --- a/.gitignore +++ b/.gitignore @@ -2,12 +2,12 @@ *~ *.a *.o -Makefile .depend airspyd airspyhfd aprs aprsfeed +build/ control cwd funcubed diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..e7497b05 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,328 @@ +cmake_minimum_required(VERSION 3.10) + +project(ka9q-radio) + +set(UDEV_RULES_PATH + "/etc/udev/rules.d" + CACHE STRING + "Target directory for udev rule installation." +) + +set(CMAKE_C_STANDARD 11) +set(CMAKE_C_STANDARD_REQUIRED True) + +add_compile_options(-march=native -Wall) +add_compile_definitions(_GNU_SOURCE=1 NDEBUG=1) + +if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") +add_compile_options(-O0) +elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo") +else() +add_compile_options(-O3) +endif() + +include(GNUInstallDirs) +set(VARDIR "${CMAKE_INSTALL_PREFIX}${CMAKE_INSTALL_LOCALSTATEDIR}/${CMAKE_PROJECT_NAME}") + +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads REQUIRED) +link_libraries(Threads::Threads) + +find_library(FFTW3_THREADS_LIB NAMES fftw3f_threads REQUIRED) + +find_library(INIPARSER_LIB NAMES iniparser PATHS /opt/local/include/iniparser/ REQUIRED) +find_path(INIPARSER_INCLUDE_DIR iniparser.h PATH_SUFFIXES iniparser) + +find_library(PIGPIO_LIB NAMES pigpio) +find_path(PIGPIO_INCLUDE_DIR pigpio.h) + +find_library(SDRPLAY_API_LIB NAMES sdrplay_api) +find_path(SDRPLAY_API_H_PATH sdrplay_api.h) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(AVAHI avahi-client REQUIRED IMPORTED_TARGET) +pkg_check_modules(FFTW3 fftw3f REQUIRED IMPORTED_TARGET) +pkg_check_modules(LIBAIRSPY libairspy IMPORTED_TARGET) +pkg_check_modules(LIBAIRSPYHF libairspyhf IMPORTED_TARGET) +if(CMAKE_SYSTEM_NAME MATCHES "Linux") +pkg_check_modules(LIBBSD libbsd REQUIRED) +endif() +pkg_check_modules(LIBRTLSDR librtlsdr) +pkg_check_modules(LIBUSB libusb-1.0 IMPORTED_TARGET) +pkg_check_modules(OPUS opus IMPORTED_TARGET) +pkg_check_modules(PORTAUDIO portaudio-2.0 REQUIRED IMPORTED_TARGET) + +include_directories(${FFTW3_INCLUDE_DIRS} ${INIPARSER_INCLUDE_DIR}) + +pkg_check_modules(SYSTEMD "systemd") +if(SYSTEMD_FOUND AND "${SYSTEMD_UNITDIR}" STREQUAL "") + execute_process( + COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=systemdsystemunitdir systemd + OUTPUT_VARIABLE SYSTEMD_UNITDIR + ) + string(REGEX REPLACE "[ \t\n]+" "" SYSTEMD_UNITDIR "${SYSTEMD_UNITDIR}") +endif() + +set(CURSES_NEED_WIDE TRUE) +set(CURSES_NEED_NCURSES TRUE) +find_package(Curses) + +add_library(daemons_common OBJECT avahi.c config.c misc.c multicast.c status.c) +target_include_directories(daemons_common PUBLIC ${AVAHI_INCLUDE_DIRS} ${LIBBSD_INCLUDE_DIRS}) +set(DAEMONS_COMMON_LIBS PkgConfig::AVAHI ${INIPARSER_LIB} ${LIBBSD_LDFLAGS} m) + +## Daemons + +if(LIBAIRSPY_FOUND) + add_executable(airspyd airspyd.c $) + target_include_directories(airspyd PUBLIC ${LIBAIRSPY_INCLUDE_DIRS}) + target_link_libraries(airspyd ${DAEMONS_COMMON_LIBS} PkgConfig::LIBAIRSPY) + install(TARGETS airspyd RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}) +endif() + +if(LIBAIRSPYHF_FOUND) + add_executable(airspyhfd airspyhfd.c $) + target_include_directories(airspyhfd PUBLIC ${LIBAIRSPYHF_INCLUDE_DIRS}) + target_link_libraries(airspyhfd ${DAEMONS_COMMON_LIBS} PkgConfig::LIBAIRSPYHF) + install(TARGETS airspyhfd RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}) +endif() + +add_executable(aprs aprs.c ax25.c $) +target_include_directories(aprs PUBLIC) +target_link_libraries(aprs ${DAEMONS_COMMON_LIBS}) + +add_executable(aprsfeed aprsfeed.c ax25.c $) +target_include_directories(aprsfeed PUBLIC) +target_link_libraries(aprsfeed ${DAEMONS_COMMON_LIBS}) + +add_executable(cwd cwd.c morse.c osc.c $) +target_include_directories(cwd PUBLIC) +target_link_libraries(cwd ${DAEMONS_COMMON_LIBS}) + +if(LIBUSB_FOUND) + include(FindIconv) + add_executable(funcubed fcd.c funcubed.c hid-libusb.c $) + target_include_directories(funcubed PUBLIC ${Iconv_INCLUDE_DIRS} ${LIBUSB_INCLUDE_DIRS} ${PORTAUDIO_INCLUDE_DIRS} ) + target_link_libraries(funcubed ${DAEMONS_COMMON_LIBS} ${Iconv_LIBRARIES} PkgConfig::LIBUSB PkgConfig::PORTAUDIO) +endif() + +if(OPUS_FOUND) + add_executable(opusd opusd.c $) + target_include_directories(opusd PUBLIC ${OPUS_INCLUDE_DIRS}) + target_link_libraries(opusd ${DAEMONS_COMMON_LIBS} PkgConfig::OPUS) +endif() + +add_executable(packetd ax25.c filter.c osc.c packetd.c $) +target_include_directories(packetd PUBLIC ${FFTW3_INCLUDE_DIRS}) +target_link_libraries(packetd ${DAEMONS_COMMON_LIBS} ${FFTW3_THREADS_LIB} PkgConfig::FFTW3) + +add_executable(radiod audio.c decode_status.c filter.c fm.c iir.c linear.c main.c modes.c osc.c radio.c radio_status.c rtcp.c wfm.c $) +target_include_directories(radiod PUBLIC ${FFTW3_INCLUDE_DIRS}) +target_link_libraries(radiod ${DAEMONS_COMMON_LIBS} ${FFTW3_THREADS_LIB} PkgConfig::FFTW3) + +add_executable(rdsd filter.c rdsd.c $) +target_include_directories(rdsd PUBLIC ${FFTW3_INCLUDE_DIRS}) +target_link_libraries(rdsd ${DAEMONS_COMMON_LIBS} ${FFTW3_THREADS_LIB} PkgConfig::FFTW3) + +if(LIBRTLSDR_FOUND) + if(NOT APPLE) + add_executable(rtlsdrd rtlsdrd.c $) + target_include_directories(rtlsdrd PUBLIC ${LIBRTLSDR_INCLUDE_DIRS}) + target_link_libraries(rtlsdrd ${DAEMONS_COMMON_LIBS} ${LIBRTLSDR_LDFLAGS}) + install(TARGETS rtlsdrd RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}) + else() + message(WARNING "rtlsdrd build disabled on Mac OS X due to build issues") + endif() +endif() + +if(SDRPLAY_API_LIB) + add_executable(sdrplayd sdrplayd.c $) + target_include_directories(sdrplayd PUBLIC ${SDRPLAY_API_H_PATH}) + target_link_libraries(sdrplayd ${DAEMONS_COMMON_LIBS} ${SDRPLAY_API_LIB}) + install(TARGETS sdrplayd RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}) +endif() + +add_executable(stereod filter.c stereod.c $) +target_link_libraries(stereod ${DAEMONS_COMMON_LIBS} ${FFTW3_THREADS_LIB} PkgConfig::FFTW3) + +install( + TARGETS + aprs + aprsfeed + cwd + funcubed + opusd + packetd + radiod + rdsd + stereod + RUNTIME + DESTINATION ${CMAKE_INSTALL_SBINDIR} +) + +## CLI utils + +add_executable(control bandplan.c config.c control.c decode_status.c misc.c modes.c multicast.c status.c) +target_include_directories(control PUBLIC ${CURSES_INCLUDE_DIRS} ${FFTW3_INCLUDE_DIRS} ${LIBBSD_INCLUDE_DIRS}) +target_link_libraries(control ${CURSES_LIBRARIES} ${FFTW3_THREADS_LIB} PkgConfig::FFTW3 ${INIPARSER_LIB} ${LIBBSD_LDFLAGS} m) + +add_executable(iqplay attr.c avahi.c iqplay.c misc.c multicast.c status.c) +target_include_directories(iqplay PUBLIC ${AVAHI_INCLUDE_DIRS} ${LIBBSD_INCLUDE_DIRS}) +target_link_libraries(iqplay PkgConfig::AVAHI ${LIBBSD_LDFLAGS} m) + +add_executable(iqrecord attr.c decode_status.c iqrecord.c multicast.c status.c) +target_include_directories(iqrecord PUBLIC ${FFTW3_INCLUDE_DIRS} ${LIBBSD_INCLUDE_DIRS}) +target_link_libraries(iqrecord ${FFTW3_THREADS_LIB} PkgConfig::FFTW3 ${LIBBSD_LDFLAGS} m) + +add_executable(metadump dump.c metadump.c misc.c multicast.c status.c) +target_include_directories(metadump PUBLIC ${FFTW3_INCLUDE_DIRS} ${LIBBSD_INCLUDE_DIRS}) +target_link_libraries(metadump ${FFTW3_THREADS_LIB} PkgConfig::FFTW3 ${LIBBSD_LDFLAGS} m) + +add_executable(modulate filter.c misc.c modulate.c osc.c) +target_include_directories(modulate PUBLIC ${FFTW3_INCLUDE_DIRS}) +target_link_libraries(modulate ${FFTW3_THREADS_LIB} PkgConfig::FFTW3 m) + +add_executable(monitor config.c iir.c misc.c monitor.c morse.c multicast.c osc.c) +target_include_directories(monitor PUBLIC ${CURSES_INCLUDE_DIRS} ${LIBBSD_INCLUDE_DIRS} ${OPUS_INCLUDE_DIRS} ${PORTAUDIO_INCLUDE_DIRS}) +target_link_libraries(monitor ${CURSES_LIBRARIES} ${INIPARSER_LIB} ${LIBBSD_LDFLAGS} PkgConfig::OPUS PkgConfig::PORTAUDIO m) + +add_executable(opussend multicast.c opussend.c) +target_include_directories(opussend PUBLIC ${LIBBSD_INCLUDE_DIRS} ${OPUS_INCLUDE_DIRS} ${PORTAUDIO_INCLUDE_DIRS}) +target_link_libraries(opussend ${LIBBSD_LDFLAGS} PkgConfig::OPUS PkgConfig::PORTAUDIO m) + +add_executable(pcmcat multicast.c pcmcat.c) +target_include_directories(pcmcat PUBLIC ${LIBBSD_INCLUDE_DIRS}) +target_link_libraries(pcmcat ${LIBBSD_LDFLAGS}) + +add_executable(pcmrecord attr.c multicast.c pcmrecord.c) +target_include_directories(pcmrecord PUBLIC ${LIBBSD_INCLUDE_DIRS}) +target_link_libraries(pcmrecord ${LIBBSD_LDFLAGS}) + +add_executable(pcmsend multicast.c pcmsend.c) +target_include_directories(pcmsend PUBLIC ${LIBBSD_INCLUDE_DIRS} ${PORTAUDIO_INCLUDE_DIRS}) +target_link_libraries(pcmsend ${LIBBSD_LDFLAGS} PkgConfig::PORTAUDIO) + +add_executable(pcmspawn multicast.c pcmspawn.c status.c) +target_include_directories(pcmspawn PUBLIC ${LIBBSD_INCLUDE_DIRS}) +target_link_libraries(pcmspawn ${LIBBSD_LDFLAGS}) + +add_executable(pl filter.c misc.c multicast.c osc.c pl.c) +target_include_directories(pl PUBLIC ${FFTW3_INCLUDE_DIRS} ${LIBBSD_INCLUDE_DIRS}) +target_link_libraries(pl ${FFTW3_THREADS_LIB} PkgConfig::FFTW3 ${LIBBSD_LDFLAGS} m) + +add_executable(show-pkt multicast.c show-pkt.c status.c) +target_include_directories(show-pkt PUBLIC ${CURSES_INCLUDE_DIRS} ${LIBBSD_INCLUDE_DIRS}) +target_link_libraries(show-pkt ${CURSES_LIBRARIES} ${LIBBSD_LDFLAGS}) + +add_executable(setfilt multicast.c setfilt.c status.c) +target_include_directories(setfilt PUBLIC ${LIBBSD_INCLUDE_DIRS}) +target_link_libraries(setfilt ${LIBBSD_LDFLAGS}) + +if(PIGPIO_INCLUDE_DIR) + # TODO: Not tested. + add_executable(set_xcvr config.c set_xcvr.c) + target_include_directories(set_xcvr PUBLIC ${PIGPIO_INCLUDE_DIR}) + target_link_libraries(set_xcvr ${INIPARSER_LIB} m) +endif() + +add_executable(show-sig multicast.c show-sig.c status.c) +target_include_directories(show-sig PUBLIC ${CURSES_INCLUDE_DIRS} ${LIBBSD_INCLUDE_DIRS}) +target_link_libraries(show-sig ${CURSES_LIBRARIES} ${LIBBSD_LDFLAGS} m) + +add_executable(tune misc.c multicast.c status.c tune.c) +target_include_directories(tune PUBLIC ${LIBBSD_INCLUDE_DIRS}) +target_link_libraries(tune ${LIBBSD_LDFLAGS} m) + +add_executable(wspr-decoded attr.c multicast.c wspr-decoded.c) +target_include_directories(wspr-decoded PUBLIC ${LIBBSD_INCLUDE_DIRS}) +target_link_libraries(wspr-decoded ${LIBBSD_LDFLAGS}) + +## Other + +install(FILES bandplan.txt help.txt modes.conf id.txt monitor-help.txt DESTINATION share/${CMAKE_PROJECT_NAME}) +if(${SYSTEMD_UNITDIR}) + install(FILES + airspyd@.service + airspyhfd@.service + aprsfeed.service + cwd.service + funcubed@.service + hackrf@.service + horusdemod.service + opusd@.service + packetd.service + radiod@.service + rdsd.service + recordings@.service + sdrplayd@.service + stereod.service + wspr-decoded.service + DESTINATION ${SYSTEMD_UNITDIR}) +endif() + +if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + install(FILES + 20-rtlsdr.rules + 52-airspy.rules + 52-airspyhf.rules + 66-hackrf.rules + 68-funcube-dongle-proplus.rules + 68-funcube-dongle.rules + DESTINATION ${UDEV_RULES_PATH} + COMPONENT "udev_rules" + ) + + install(FILES + airspyd.conf + aprs.conf + funcubed.conf + horus.conf + opusd@aviation.conf + opusd@fm.conf + opusd@hf.conf + opusd@hfdl.conf + opusd@kpbs.conf + opusd@ksds.conf + opusd@packet.conf + packetd.conf + radiod@aviation.conf + radiod@fm.conf + radiod@hf.conf + radiod@horus.conf + radiod@nws.conf + radiod@repeater.conf + radiod@sonde.conf + radiod@10m.conf + radiod@125cm.conf + radiod@2m.conf + radiod@6m.conf + radiod@70cm.conf + rdsd.conf + recordings@aviation.conf + recordings@fm.conf + recordings@hf.conf + recordings@pictures.conf + stereod.conf + wspr-decoded.conf + DESTINATION "/${CMAKE_INSTALL_SYSCONFDIR}/radio" + ) + + install(FILES aprsfeed.rotate DESTINATION "/${CMAKE_INSTALL_SYSCONFDIR}/logrotate.d") + install(FILES airspy-blacklist.conf DESTINATION "/${CMAKE_INSTALL_SYSCONFDIR}/modprobe.d") + install(FILES 98-sockbuf.conf DESTINATION "/${CMAKE_INSTALL_SYSCONFDIR}/sysctl.d") + install(FILES start-ka9q-horus.sh DESTINATION ${CMAKE_INSTALL_SBINDIR}) + + install(CODE " + set(CMAKE_EXECUTE_PROCESS_COMMAND_ECHO STDOUT) + execute_process(COMMAND mkdir -p /etc/fftw /etc/radio ${VARDIR} CMDECHO_ERROR_VARIABLE) + execute_process(COMMAND /usr/sbin/adduser --quiet --system --group radio CMDECHO_ERROR_VARIABLE) + execute_process(COMMAND /usr/sbin/adduser --quiet --system --ingroup radio airspy CMDECHO_ERROR_VARIABLE) + execute_process(COMMAND /usr/sbin/adduser --quiet --system --ingroup radio funcube CMDECHO_ERROR_VARIABLE) + execute_process(COMMAND /usr/sbin/adduser --quiet --system --ingroup radio recordings CMDECHO_ERROR_VARIABLE) + execute_process(COMMAND /usr/sbin/adduser --quiet --system --ingroup radio aprsfeed CMDECHO_ERROR_VARIABLE) + execute_process(COMMAND chgrp radio /etc/fftw /etc/radio ${VARDIR} CMDECHO_ERROR_VARIABLE) + execute_process(COMMAND chmod g+ws /etc/fftw /etc/radio ${VARDIR} CMDECHO_ERROR_VARIABLE) + execute_process(COMMAND systemctl daemon-reload CMDECHO_ERROR_VARIABLE) + " + ) +endif() diff --git a/INSTALL.txt b/INSTALL.txt index c957f2e9..c4dc7ca3 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -25,7 +25,7 @@ libopus-dev Then: -$ ln -s Makefile.linux Makefile +$ cmake . $ make $ sudo make install diff --git a/Makefile.debug b/Makefile.debug deleted file mode 100644 index 552a7035..00000000 --- a/Makefile.debug +++ /dev/null @@ -1,200 +0,0 @@ -# $Id: Makefile.linux,v 1.111 2022/10/25 03:32:55 karn Exp $ - -# for production -#DOPTS = -DNDEBUG=1 -O3 -# for debugging -DOPTS=-g - -COPTS=-march=native -std=gnu11 -pthread -Wall -funsafe-math-optimizations -D_GNU_SOURCE=1 - -# Get local versions (e.g., of librtlsdr) -#LDOPTS=-L/usr/local/lib -LDOPTS=-g -L/usr/local/lib - -INCLUDES+=-I/usr/include/iniparser/ -CFLAGS=$(DOPTS) $(COPTS) $(INCLUDES) -BINDIR=/usr/local/bin -LIBDIR=/usr/local/share/ka9q-radio -DAEMONDIR=/usr/local/sbin -VARDIR=/var/lib/ka9q-radio -LDLIBS=-lpthread -lbsd -lm - -#DAEMONS=aprs aprsfeed funcubed opusd packetd radiod airspyd airspyhfd stereod rdsd rtlsdrd sdrplayd -DAEMONS=aprs aprsfeed cwd funcubed opusd packetd radiod airspyd airspyhfd stereod rdsd rtlsdrd - -EXECS=iqplay iqrecord modulate monitor opussend pcmsend pcmcat pcmrecord pcmspawn control metadump pl show-pkt show-sig tune wspr-decoded setfilt - -AFILES=bandplan.txt help.txt modes.conf id.txt monitor-help.txt - -SYSTEMD_FILES=airspyd@.service airspyhfd@.service cwd.service funcubed@.service hackrf@.service packetd.service radiod@.service aprsfeed.service opusd@.service recordings@.service stereod.service rdsd.service wspr-decoded.service horusdemod.service sdrplayd@.service - -UDEV_FILES=20-rtlsdr.rules 52-airspy.rules 52-airspyhf.rules 66-hackrf.rules 68-funcube-dongle-proplus.rules 68-funcube-dongle.rules - -CONF_FILES=funcubed.conf \ - opusd@hf.conf opusd@hfdl.conf opusd@fm.conf opusd@aviation.conf opusd@packet.conf opusd@kpbs.conf opusd@ksds.conf \ - stereod.conf rdsd.conf \ - radiod@10m.conf radiod@6m.conf radiod@fm.conf radiod@2m.conf radiod@125cm.conf radiod@70cm.conf radiod@hf.conf radiod@aviation.conf radiod@horus.conf radiod@nws.conf radiod@sonde.conf radiod@repeater.conf \ - recordings@hf.conf recordings@fm.conf recordings@aviation.conf recordings@pictures.conf \ - wspr-decoded.conf horus.conf airspyd.conf packetd.conf aprs.conf - -LOGROTATE_FILES = aprsfeed.rotate - -AIRSPY_FILES= - -BLACKLIST=airspy-blacklist.conf - -SRC=airspyd.c airspyhfd.c aprs.c aprsfeed.c attr.c audio.c avahi.c ax25.c bandplan.c config.c control.c cwd.c decimate.c decode_status.c dump.c fcd.c filter.c fm.c \ - tune.c funcubed.c iir.c iqplay.c iqrecord.c linear.c main.c metadump.c misc.c modes.c modulate.c monitor.c morse.c radio.c setfilt.c \ - show-sig.c radio_status.c multicast.c opusd.c pcmcat.c pcmsend.c osc.c packetd.c hid-libusb.c opussend.c show-pkt.c pcmrecord.c pl.c rdsd.c rtcp.c rtlsdrd.c pcmspawn.c \ - sdrplayd.c status.c stereod.c wfm.c wspr-decoded.c attr.h ax25.h bandplan.h conf.h config.h decimate.h \ - fcd.h fcdhidcmd.h filter.h hidapi.h iir.h misc.h morse.h multicast.h osc.h radio.h status.h - -all: depend $(DAEMONS) $(EXECS) $(AFILES) $(SYSTEMD_FILES) $(UDEV_FILES) $(CONF_FILES) $(LOGROTATE_FILES) $(AIRSPY_FILES) $(BLACKLIST) 98-sockbuf.conf start-ka9q-horus.sh - -# Don't overwrite existing config files in /etc/radio -install: $(DAEMONS) $(EXECS) $(AFILES) $(SYSTEMD_FILES) $(UDEV_FILES) $(CONF_FILES) $(AIRSPY_FILES) $(BLACKLIST) 98-sockbuf.conf start-ka9q-horus.sh - /usr/sbin/adduser --quiet --system --group radio - /usr/sbin/adduser --quiet --system --ingroup radio airspy - /usr/sbin/adduser --quiet --system --ingroup radio funcube - /usr/sbin/adduser --quiet --system --ingroup radio recordings - /usr/sbin/adduser --quiet --system --ingroup radio aprsfeed - install -o root -m 0755 -D --target-directory=/etc/sysctl.d 98-sockbuf.conf - install -o root -m 0755 -D --target-directory=$(DAEMONDIR) $(DAEMONS) start-ka9q-horus.sh - install -o root -m 0755 -D --target-directory=$(BINDIR) $(EXECS) - install -o root -m 0644 -D --target-directory=$(LIBDIR) $(AFILES) - install -o root -m 0644 -D --target-directory=/etc/systemd/system $(SYSTEMD_FILES) - install -o root -m 0644 -D --target-directory=/etc/udev/rules.d $(UDEV_FILES) - install -o root -m 0644 -D --target-directory=/etc/modprobe.d $(BLACKLIST) - install -o root -m 0644 -D --target-directory=/etc/logrotate.d $(LOGROTATE_FILES) - mkdir -p /etc/fftw /etc/radio $(VARDIR) /etc/radio/airspyd.conf.d - chgrp radio $(VARDIR) /etc/radio /etc/fftw - chmod g+ws $(VARDIR) /etc/radio /etc/fftw - cp -n -v --target-directory=/etc/radio $(CONF_FILES) -# cp -n -v --target-directory=/etc/radio/airspyd.conf.d $(AIRSPY_FILES) - systemctl daemon-reload - -clean: - rm -f *.o *.a .depend $(EXECS) $(DAEMONS) - - -depend: .depend - -.depend: $(SRC) - rm -f .depend - $(CC) $(CFLAGS) -MM $^ > .depend - --include .depend - -.PHONY: clean all install depend - -# Executables -set_xcvr: set_xcvr.o config.o - $(CC) $(LDOPTS) -o $@ $^ -lpigpio -liniparser -lm -lpthread -lrt - -airspyd: airspyd.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lairspy -lavahi-client -lavahi-common -lbsd -liniparser -lm -lpthread - -airspyhfd: airspyhfd.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lairspyhf -lavahi-client -lavahi-common -lbsd -liniparser -lm -lpthread - -aprs: aprs.o ax25.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lbsd -lpthread -lm - -aprsfeed: aprsfeed.o ax25.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lbsd -lpthread -lm - -control: control.o modes.o bandplan.o decode_status.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lfftw3f_threads -lfftw3f -lncursesw -liniparser -lbsd -lm -lpthread - -cwd: cwd.o morse.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lbsd -lpthread -lm - -rtlsdrd: rtlsdrd.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lrtlsdr -lavahi-client -lavahi-common -lbsd -lm -lpthread - -tune: tune.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lbsd -lm - -setfilt: setfilt.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lbsd -lm - -show-pkt: show-pkt.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lncursesw -lbsd -lm - -show-sig: show-sig.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lncursesw -lbsd -lm - -funcubed: funcubed.o status.o libradio.a libfcd.a - $(CC) $(LDOPTS) -o $@ $^ -lportaudio -lavahi-client -lavahi-common -lusb-1.0 -liniparser -lbsd -lm -lpthread - -hackrf: hackrf.o status.o decimate.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lhackrf -lbsd -lpthread -lm - -iqplay: iqplay.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lavahi-client -lavahi-common -lbsd -lpthread -lm - -iqrecord: iqrecord.o decode_status.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lbsd -lpthread -lm - -metadump: metadump.o dump.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lbsd -lpthread -lm - -modulate: modulate.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lfftw3f_threads -lfftw3f -lm -lpthread - -monitor: monitor.o morse.o config.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lopus -lportaudio -lncursesw -liniparser -lbsd -lm -lpthread - -opusd: opusd.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lopus -lavahi-client -lavahi-common -lbsd -lm -lpthread - -opussend: opussend.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lopus -lportaudio -lbsd -lm - -packetd: packetd.o ax25.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lbsd -lm -lpthread - -pcmcat: pcmcat.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lm -lbsd -lpthread - -pcmspawn: pcmspawn.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lm -lbsd -lpthread - -pcmrecord: pcmrecord.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lm -lbsd -lpthread - -pcmsend: pcmsend.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lportaudio -lbsd -lpthread - -pl: pl.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lfftw3f_threads -lfftw3f -lbsd -lm -lpthread - -radiod: main.o audio.o fm.o wfm.o linear.o radio.o rtcp.o radio_status.o modes.o decode_status.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lbsd -liniparser -lpthread -lm - -rdsd: rdsd.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lbsd -lm -lpthread - -sdrplayd: sdrplayd.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lsdrplay_api -lavahi-client -lavahi-common -lbsd -liniparser -lm -lpthread - - -stereod: stereod.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lbsd -lm -lpthread - -wspr-decoded: wspr-decoded.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lfftw3f_threads -lfftw3f -lbsd -lm -lpthread - - -# Binary libraries -libfcd.a: fcd.o hid-libusb.o - ar rv $@ $? - ranlib $@ - -# subroutines useful in more than one program -libradio.a: avahi.o attr.o filter.o iir.o status.o misc.o multicast.o osc.o config.o - ar rv $@ $? - ranlib $@ - - - diff --git a/Makefile.linux b/Makefile.linux deleted file mode 100644 index 0a79c12c..00000000 --- a/Makefile.linux +++ /dev/null @@ -1,200 +0,0 @@ -# $Id: Makefile.linux,v 1.111 2022/10/25 03:32:55 karn Exp $ - -# for production -DOPTS = -DNDEBUG=1 -O3 -# for debugging -#DOPTS=-g - -COPTS=-march=native -std=gnu11 -pthread -Wall -funsafe-math-optimizations -D_GNU_SOURCE=1 - -# Get local versions (e.g., of librtlsdr) -LDOPTS=-L/usr/local/lib -#LDOPTS=-g -L/usr/local/lib - -INCLUDES+=-I/usr/include/iniparser/ -CFLAGS=$(DOPTS) $(COPTS) $(INCLUDES) -BINDIR=/usr/local/bin -LIBDIR=/usr/local/share/ka9q-radio -DAEMONDIR=/usr/local/sbin -VARDIR=/var/lib/ka9q-radio -LDLIBS=-lpthread -lbsd -lm - -#DAEMONS=aprs aprsfeed funcubed opusd packetd radiod airspyd airspyhfd stereod rdsd rtlsdrd sdrplayd -DAEMONS=aprs aprsfeed cwd funcubed opusd packetd radiod airspyd airspyhfd stereod rdsd rtlsdrd - -EXECS=iqplay iqrecord modulate monitor opussend pcmsend pcmcat pcmrecord pcmspawn control metadump pl show-pkt show-sig tune wspr-decoded setfilt - -AFILES=bandplan.txt help.txt modes.conf id.txt monitor-help.txt - -SYSTEMD_FILES=airspyd@.service airspyhfd@.service cwd.service funcubed@.service hackrf@.service packetd.service radiod@.service aprsfeed.service opusd@.service recordings@.service stereod.service rdsd.service wspr-decoded.service horusdemod.service sdrplayd@.service - -UDEV_FILES=20-rtlsdr.rules 52-airspy.rules 52-airspyhf.rules 66-hackrf.rules 68-funcube-dongle-proplus.rules 68-funcube-dongle.rules - -CONF_FILES=funcubed.conf \ - opusd@hf.conf opusd@hfdl.conf opusd@fm.conf opusd@aviation.conf opusd@packet.conf opusd@kpbs.conf opusd@ksds.conf \ - stereod.conf rdsd.conf \ - radiod@10m.conf radiod@6m.conf radiod@fm.conf radiod@2m.conf radiod@125cm.conf radiod@70cm.conf radiod@hf.conf radiod@aviation.conf radiod@horus.conf radiod@nws.conf radiod@sonde.conf radiod@repeater.conf \ - recordings@hf.conf recordings@fm.conf recordings@aviation.conf recordings@pictures.conf \ - wspr-decoded.conf horus.conf airspyd.conf packetd.conf aprs.conf - -LOGROTATE_FILES = aprsfeed.rotate - -AIRSPY_FILES= - -BLACKLIST=airspy-blacklist.conf - -SRC=airspyd.c airspyhfd.c aprs.c aprsfeed.c attr.c audio.c avahi.c ax25.c bandplan.c config.c control.c cwd.c decimate.c decode_status.c dump.c fcd.c filter.c fm.c \ - tune.c funcubed.c iir.c iqplay.c iqrecord.c linear.c main.c metadump.c misc.c modes.c modulate.c monitor.c morse.c radio.c setfilt.c \ - show-sig.c radio_status.c multicast.c opusd.c pcmcat.c pcmsend.c osc.c packetd.c hid-libusb.c opussend.c show-pkt.c pcmrecord.c pl.c rdsd.c rtcp.c rtlsdrd.c pcmspawn.c \ - sdrplayd.c status.c stereod.c wfm.c wspr-decoded.c attr.h ax25.h bandplan.h conf.h config.h decimate.h \ - fcd.h fcdhidcmd.h filter.h hidapi.h iir.h misc.h morse.h multicast.h osc.h radio.h status.h - -all: depend $(DAEMONS) $(EXECS) $(AFILES) $(SYSTEMD_FILES) $(UDEV_FILES) $(CONF_FILES) $(LOGROTATE_FILES) $(AIRSPY_FILES) $(BLACKLIST) 98-sockbuf.conf start-ka9q-horus.sh - -# Don't overwrite existing config files in /etc/radio -install: $(DAEMONS) $(EXECS) $(AFILES) $(SYSTEMD_FILES) $(UDEV_FILES) $(CONF_FILES) $(AIRSPY_FILES) $(BLACKLIST) 98-sockbuf.conf start-ka9q-horus.sh - /usr/sbin/adduser --quiet --system --group radio - /usr/sbin/adduser --quiet --system --ingroup radio airspy - /usr/sbin/adduser --quiet --system --ingroup radio funcube - /usr/sbin/adduser --quiet --system --ingroup radio recordings - /usr/sbin/adduser --quiet --system --ingroup radio aprsfeed - install -o root -m 0755 -D --target-directory=/etc/sysctl.d 98-sockbuf.conf - install -o root -m 0755 -D --target-directory=$(DAEMONDIR) $(DAEMONS) start-ka9q-horus.sh - install -o root -m 0755 -D --target-directory=$(BINDIR) $(EXECS) - install -o root -m 0644 -D --target-directory=$(LIBDIR) $(AFILES) - install -o root -m 0644 -D --target-directory=/etc/systemd/system $(SYSTEMD_FILES) - install -o root -m 0644 -D --target-directory=/etc/udev/rules.d $(UDEV_FILES) - install -o root -m 0644 -D --target-directory=/etc/modprobe.d $(BLACKLIST) - install -o root -m 0644 -D --target-directory=/etc/logrotate.d $(LOGROTATE_FILES) - mkdir -p /etc/fftw /etc/radio $(VARDIR) /etc/radio/airspyd.conf.d - chgrp radio $(VARDIR) /etc/radio /etc/fftw - chmod g+ws $(VARDIR) /etc/radio /etc/fftw - cp -n -v --target-directory=/etc/radio $(CONF_FILES) -# cp -n -v --target-directory=/etc/radio/airspyd.conf.d $(AIRSPY_FILES) - systemctl daemon-reload - -clean: - rm -f *.o *.a .depend $(EXECS) $(DAEMONS) - - -depend: .depend - -.depend: $(SRC) - rm -f .depend - $(CC) $(CFLAGS) -MM $^ > .depend - --include .depend - -.PHONY: clean all install depend - -# Executables -set_xcvr: set_xcvr.o config.o - $(CC) $(LDOPTS) -o $@ $^ -lpigpio -liniparser -lm -lpthread -lrt - -airspyd: airspyd.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lairspy -lavahi-client -lavahi-common -lbsd -liniparser -lm -lpthread - -airspyhfd: airspyhfd.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lairspyhf -lavahi-client -lavahi-common -lbsd -liniparser -lm -lpthread - -aprs: aprs.o ax25.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lbsd -lpthread -lm - -aprsfeed: aprsfeed.o ax25.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lbsd -lpthread -lm - -control: control.o modes.o bandplan.o decode_status.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lfftw3f_threads -lfftw3f -lncursesw -liniparser -lbsd -lm -lpthread - -cwd: cwd.o morse.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lbsd -lpthread -lm - -rtlsdrd: rtlsdrd.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lrtlsdr -lavahi-client -lavahi-common -lbsd -lm -lpthread - -tune: tune.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lbsd -lm - -setfilt: setfilt.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lbsd -lm - -show-pkt: show-pkt.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lncursesw -lbsd -lm - -show-sig: show-sig.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lncursesw -lbsd -lm - -funcubed: funcubed.o status.o libradio.a libfcd.a - $(CC) $(LDOPTS) -o $@ $^ -lportaudio -lavahi-client -lavahi-common -lusb-1.0 -liniparser -lbsd -lm -lpthread - -hackrf: hackrf.o status.o decimate.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lhackrf -lbsd -lpthread -lm - -iqplay: iqplay.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lavahi-client -lavahi-common -lbsd -lpthread -lm - -iqrecord: iqrecord.o decode_status.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lbsd -lpthread -lm - -metadump: metadump.o dump.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lbsd -lpthread -lm - -modulate: modulate.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lfftw3f_threads -lfftw3f -lm -lpthread - -monitor: monitor.o morse.o config.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lopus -lportaudio -lncursesw -liniparser -lbsd -lm -lpthread - -opusd: opusd.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lopus -lavahi-client -lavahi-common -lbsd -lm -lpthread - -opussend: opussend.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lopus -lportaudio -lbsd -lm - -packetd: packetd.o ax25.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lbsd -lm -lpthread - -pcmcat: pcmcat.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lm -lbsd -lpthread - -pcmspawn: pcmspawn.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lm -lbsd -lpthread - -pcmrecord: pcmrecord.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lm -lbsd -lpthread - -pcmsend: pcmsend.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lportaudio -lbsd -lpthread - -pl: pl.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lfftw3f_threads -lfftw3f -lbsd -lm -lpthread - -radiod: main.o audio.o fm.o wfm.o linear.o radio.o rtcp.o radio_status.o modes.o decode_status.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lbsd -liniparser -lpthread -lm - -rdsd: rdsd.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lbsd -lm -lpthread - -sdrplayd: sdrplayd.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lsdrplay_api -lavahi-client -lavahi-common -lbsd -liniparser -lm -lpthread - - -stereod: stereod.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lbsd -lm -lpthread - -wspr-decoded: wspr-decoded.o libradio.a - $(CC) $(LDOPTS) -o $@ $^ -lfftw3f_threads -lfftw3f -lbsd -lm -lpthread - - -# Binary libraries -libfcd.a: fcd.o hid-libusb.o - ar rv $@ $? - ranlib $@ - -# subroutines useful in more than one program -libradio.a: avahi.o attr.o filter.o iir.o status.o misc.o multicast.o osc.o config.o - ar rv $@ $? - ranlib $@ - - - diff --git a/Makefile.osx b/Makefile.osx deleted file mode 100644 index 1b1289b7..00000000 --- a/Makefile.osx +++ /dev/null @@ -1,184 +0,0 @@ -# $Id: Makefile.osx,v 1.112 2022/08/17 22:01:58 karn Exp karn $ -CFLAGS=-g -DNDEBUG=1 -O3 -std=gnu11 -pthread -Wall -funsafe-math-optimizations `pkg-config --cflags fftw3` -I/opt/local/include/iniparser/ -#CFLAGS=-g -O3 -std=gnu11 -pthread -Wall -funsafe-math-optimizations `pkg-config --cflags fftw3` -BINDIR=/usr/local/bin -LIBDIR=/usr/local/share/ka9q-radio -LD_FLAGS=-lpthread -lm -EXECS=airspyd airspyhfd aprs aprsfeed cwd funcubed iqplay iqrecord modulate monitor opusd opussend packetd pcmrecord pcmsend pcmcat radiod control metadump pl show-pkt show-sig stereod rdsd tune wspr-decoded -AFILES=bandplan.txt help.txt modes.conf id.txt - -all: $(EXECS) $(AFILES) - -install: all - install -d $(LIBDIR) - install -d $(BINDIR) - install -o root -m 0755 $(EXECS) $(BINDIR) - install $(AFILES) $(LIBDIR) - -clean: - rm -f *.o *.a $(EXECS) - -# Executables -airspyd: airspyd.o libradio.a - $(CC) -g -o $@ $^ -lavahi-client -lavahi-common -lairspy -liniparser -lm -lpthread - -airspyhfd: airspyhfd.o libradio.a - $(CC) -g -o $@ $^ -lavahi-client -lavahi-common -lairspyhf -liniparser -lm -lpthread - -aprs: aprs.o libradio.a - $(CC) -g -o $@ $^ -lm - -aprsfeed: aprsfeed.o libradio.a - $(CC) -g -o $@ $^ -lm -lpthread - -control: control.o decode_status.o modes.o bandplan.o libradio.a - $(CC) -g -o $@ $^ -lfftw3f_threads -lfftw3f -lncurses -liniparser -lm -lpthread -lm - -cwd: cwd.o morse.o libradio.a - $(CC) -g -o $@ $^ -lm - -dmr: dmr.o libradio.a - $(CC) -g -o $@ $^ -lfftw3f_threads -lfftw3f -lm -lpthread - -funcubed: funcubed.o libradio.a libfcd.a - $(CC) -g -o $@ $^ -liniparser -lavahi-client -lavahi-common -lportaudio -lusb-1.0 -liconv -lm -lpthread - -hackrf: hackrf.o libradio.a - $(CC) -g -o $@ $^ -lhackrf -lm -lpthread - -iqplay: iqplay.o libradio.a - $(CC) -g -o $@ $^ -lavahi-client -lavahi-common -lm -lpthread - -iqrecord: iqrecord.o decode_status.o libradio.a - $(CC) -g -o $@ $^ -lm -lpthread - -metadump: metadump.o dump.o libradio.a - $(CC) -g -o $@ $^ -lm - -modulate: modulate.o libradio.a - $(CC) -g -o $@ $^ -lfftw3f_threads -lfftw3f -lm -lpthread - -monitor: monitor.o morse.o libradio.a - $(CC) -g -o $@ $^ -lopus -lportaudio -lfftw3f_threads -lfftw3f -lncurses -liniparser -lm -lpthread - -opusd: opusd.o libradio.a - $(CC) -g -o $@ $^ -lavahi-client -lavahi-common -lopus -lm -lpthread - -opussend: opussend.o libradio.a - $(CC) -g -o $@ $^ -lopus -lportaudio -lm -lpthread - -packetd: packetd.o libradio.a - $(CC) -g -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lm -lpthread - -pcmcat: pcmcat.o libradio.a - $(CC) -g -o $@ $^ -lm -lpthread - -pcmrecord: pcmrecord.o libradio.a - $(CC) -g -o $@ $^ -lm -lpthread - -pcmsend: pcmsend.o libradio.a - $(CC) -g -o $@ $^ -lportaudio -lm -lpthread - -pl: pl.o libradio.a - $(CC) -g -o $@ $^ -lfftw3f_threads -lfftw3f -lm -lpthread - -radiod: main.o radio.o audio.o fm.o wfm.o linear.o radio_status.o modes.o status.o decode_status.o libradio.a - $(CC) -g -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lncurses -liniparser -lm -lpthread - -rdsd: rdsd.o libradio.a - $(CC) -g -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lncurses -lm -lpthread - -show-pkt: show-pkt.o libradio.a - $(CC) -g -o $@ $^ -lfftw3f_threads -lfftw3f -lncurses -lm -lpthread -lm - -show-sig: show-sig.o libradio.a - $(CC) -g -o $@ $^ -lfftw3f_threads -lfftw3f -lncurses -lm -lpthread -lm - -stereod: stereod.o libradio.a - $(CC) -g -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lm -lpthread - -tune: tune.o libradio.a - $(CC) -g -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lm -lpthread - -wspr-decoded: wspr-decoded.o libradio.a - $(CC) -g -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lm -lpthread - -set_xcvr: set_xcvr.o - $(CC) -g -o $@ $^ -lpigpio -lpthread - - -# Binary libraries -libfcd.a: fcd.o hid-libusb.o - ar rv $@ $? - ranlib $@ - -# subroutines useful in more than one program -libradio.a: avahi.o attr.o ax25.o config.o decimate.o filter.o status.o misc.o multicast.o rtcp.o osc.o iir.o - ar rv $@ $? - ranlib $@ - -# Main programs -airspyd.o: airspyd.c misc.h multicast.h decimate.h status.h conf.h config.h -airspyhfd.o: airspyhfd.c misc.h multicast.h decimate.h status.h config.h -aprs.o: aprs.c ax25.h multicast.h misc.h -aprsfeed.o: aprsfeed.c ax25.h multicast.h misc.h -avahi.o: avahi.c misc.h -control.o: control.c osc.h misc.h filter.h bandplan.h multicast.h status.h radio.h -cwd.o: cwd.c misc.h multicast.h morse.h -funcubed.o: funcubed.c fcd.h fcdhidcmd.h hidapi.h misc.h multicast.h status.h conf.h -hackrf.o: hackrf.c misc.h multicast.h decimate.h status.h -iqplay.o: iqplay.c misc.h radio.h osc.h multicast.h attr.h status.h -iqrecord.o: iqrecord.c radio.h osc.h multicast.h attr.h -main.o: main.c radio.h osc.h filter.h misc.h multicast.h status.h conf.h -metadump.o: metadump.c multicast.h status.h misc.h -modulate.o: modulate.c misc.h filter.h radio.h osc.h conf.h -monitor.o: monitor.c misc.h multicast.h iir.h conf.h morse.h -opusd.o: opusd.c misc.h multicast.h iir.h status.h -opussend.o: opussend.c misc.h multicast.h -packetd.o: packetd.c filter.h misc.h multicast.h ax25.h osc.h status.h -pcmcat.o: pcmcat.c multicast.h -pcmrecord.o: pcmrecord.c attr.h multicast.h -pcmsend.o: pcmsend.c misc.h multicast.h -pl.o: pl.c multicast.h misc.h osc.h -show-sig.o: show-sig.c misc.h multicast.h status.h -show-pkt.o: show-pkt.c misc.h multicast.h status.h -tune.o: tune.c misc.h multicast.h status.h - -# Components of libfcd.a -fcd.o: fcd.c fcd.h hidapi.h fcdhidcmd.h -hid-libusb.o: hid-libusb.c hidapi.h - -# components of libradio.a -attr.o: attr.c attr.h -ax25.o: ax25.c ax25.h -decimate.o: decimate.c decimate.h -filter.o: filter.c misc.h filter.h -iir.o: iir.h iir.c -misc.o: misc.c misc.h -multicast.o: multicast.c multicast.h misc.h -osc.o: osc.c osc.h misc.h -rtcp.o: rtcp.c multicast.h -status.o: status.c status.h misc.h radio.h multicast.h osc.h filter.h - - -# modules used in only 1 or 2 main programs -audio.o: audio.c misc.h multicast.h osc.h filter.h radio.h status.h -bandplan.o: bandplan.c bandplan.h radio.h multicast.h osc.h status.h filter.h conf.h -decode_status.o: decode_status.c status.h radio.h misc.h multicast.h osc.h filter.h -dump.o: dump.c misc.h status.h -fm.o: fm.c misc.h filter.h radio.h osc.h multicast.h status.h iir.h -linear.o: linear.c misc.h filter.h radio.h osc.h multicast.h status.h -modes.o: modes.c radio.h osc.h misc.h multicast.h status.h filter.h -morse.o: morse.c morse.h -radio.o: radio.c radio.h osc.h filter.h misc.h multicast.h status.h -radio_status.o: radio_status.c status.h radio.h misc.h filter.h multicast.h osc.h -wfm.o: wfm.c misc.h filter.h radio.h osc.h multicast.h status.h iir.h - - - - - - - - - diff --git a/airspyd.c b/airspyd.c index 9a654f6d..776ac13a 100644 --- a/airspyd.c +++ b/airspyd.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/airspyhfd.c b/airspyhfd.c index 5b9d604d..eab6b3cd 100644 --- a/airspyhfd.c +++ b/airspyhfd.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/hid-libusb.c b/hid-libusb.c index 8a6ab2f2..f8f244be 100644 --- a/hid-libusb.c +++ b/hid-libusb.c @@ -51,7 +51,7 @@ #include /* GNU / LibUSB */ -#include +#include #include "iconv.h" #include "hidapi.h" diff --git a/monitor.c b/monitor.c index f85cd2eb..abccd2b5 100644 --- a/monitor.c +++ b/monitor.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/opusd.c b/opusd.c index 02170ca2..7484fe35 100644 --- a/opusd.c +++ b/opusd.c @@ -17,7 +17,7 @@ #if defined(linux) #include #endif -#include +#include #include #include #include diff --git a/opussend.c b/opussend.c index 339619cd..e89c4a41 100644 --- a/opussend.c +++ b/opussend.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/pcmspawn.c b/pcmspawn.c index c82592fa..e79c7c05 100644 --- a/pcmspawn.c +++ b/pcmspawn.c @@ -8,8 +8,11 @@ #include #include #include -#include +#if __linux__ #include +#else +#include +#endif #include #include #include From e9d57156c8ba963ab6ed358fe8444b57908f37b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Pinkava?= Date: Fri, 25 Nov 2022 01:20:44 +0100 Subject: [PATCH 2/2] fix --- CMakeLists.txt | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e7497b05..dec5acfd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,7 +52,7 @@ pkg_check_modules(LIBUSB libusb-1.0 IMPORTED_TARGET) pkg_check_modules(OPUS opus IMPORTED_TARGET) pkg_check_modules(PORTAUDIO portaudio-2.0 REQUIRED IMPORTED_TARGET) -include_directories(${FFTW3_INCLUDE_DIRS} ${INIPARSER_INCLUDE_DIR}) +include_directories(${LIBBSD_INCLUDE_DIRS} ${FFTW3_INCLUDE_DIRS} ${INIPARSER_INCLUDE_DIR}) pkg_check_modules(SYSTEMD "systemd") if(SYSTEMD_FOUND AND "${SYSTEMD_UNITDIR}" STREQUAL "") @@ -68,7 +68,7 @@ set(CURSES_NEED_NCURSES TRUE) find_package(Curses) add_library(daemons_common OBJECT avahi.c config.c misc.c multicast.c status.c) -target_include_directories(daemons_common PUBLIC ${AVAHI_INCLUDE_DIRS} ${LIBBSD_INCLUDE_DIRS}) +target_include_directories(daemons_common PUBLIC ${AVAHI_INCLUDE_DIRS}) set(DAEMONS_COMMON_LIBS PkgConfig::AVAHI ${INIPARSER_LIB} ${LIBBSD_LDFLAGS} m) ## Daemons @@ -113,15 +113,12 @@ if(OPUS_FOUND) endif() add_executable(packetd ax25.c filter.c osc.c packetd.c $) -target_include_directories(packetd PUBLIC ${FFTW3_INCLUDE_DIRS}) target_link_libraries(packetd ${DAEMONS_COMMON_LIBS} ${FFTW3_THREADS_LIB} PkgConfig::FFTW3) add_executable(radiod audio.c decode_status.c filter.c fm.c iir.c linear.c main.c modes.c osc.c radio.c radio_status.c rtcp.c wfm.c $) -target_include_directories(radiod PUBLIC ${FFTW3_INCLUDE_DIRS}) target_link_libraries(radiod ${DAEMONS_COMMON_LIBS} ${FFTW3_THREADS_LIB} PkgConfig::FFTW3) add_executable(rdsd filter.c rdsd.c $) -target_include_directories(rdsd PUBLIC ${FFTW3_INCLUDE_DIRS}) target_link_libraries(rdsd ${DAEMONS_COMMON_LIBS} ${FFTW3_THREADS_LIB} PkgConfig::FFTW3) if(LIBRTLSDR_FOUND) @@ -163,59 +160,51 @@ install( ## CLI utils add_executable(control bandplan.c config.c control.c decode_status.c misc.c modes.c multicast.c status.c) -target_include_directories(control PUBLIC ${CURSES_INCLUDE_DIRS} ${FFTW3_INCLUDE_DIRS} ${LIBBSD_INCLUDE_DIRS}) +target_include_directories(control PUBLIC ${CURSES_INCLUDE_DIRS}) target_link_libraries(control ${CURSES_LIBRARIES} ${FFTW3_THREADS_LIB} PkgConfig::FFTW3 ${INIPARSER_LIB} ${LIBBSD_LDFLAGS} m) add_executable(iqplay attr.c avahi.c iqplay.c misc.c multicast.c status.c) -target_include_directories(iqplay PUBLIC ${AVAHI_INCLUDE_DIRS} ${LIBBSD_INCLUDE_DIRS}) +target_include_directories(iqplay PUBLIC ${AVAHI_INCLUDE_DIRS}) target_link_libraries(iqplay PkgConfig::AVAHI ${LIBBSD_LDFLAGS} m) add_executable(iqrecord attr.c decode_status.c iqrecord.c multicast.c status.c) -target_include_directories(iqrecord PUBLIC ${FFTW3_INCLUDE_DIRS} ${LIBBSD_INCLUDE_DIRS}) target_link_libraries(iqrecord ${FFTW3_THREADS_LIB} PkgConfig::FFTW3 ${LIBBSD_LDFLAGS} m) add_executable(metadump dump.c metadump.c misc.c multicast.c status.c) -target_include_directories(metadump PUBLIC ${FFTW3_INCLUDE_DIRS} ${LIBBSD_INCLUDE_DIRS}) target_link_libraries(metadump ${FFTW3_THREADS_LIB} PkgConfig::FFTW3 ${LIBBSD_LDFLAGS} m) add_executable(modulate filter.c misc.c modulate.c osc.c) -target_include_directories(modulate PUBLIC ${FFTW3_INCLUDE_DIRS}) target_link_libraries(modulate ${FFTW3_THREADS_LIB} PkgConfig::FFTW3 m) add_executable(monitor config.c iir.c misc.c monitor.c morse.c multicast.c osc.c) -target_include_directories(monitor PUBLIC ${CURSES_INCLUDE_DIRS} ${LIBBSD_INCLUDE_DIRS} ${OPUS_INCLUDE_DIRS} ${PORTAUDIO_INCLUDE_DIRS}) +target_include_directories(monitor PUBLIC ${CURSES_INCLUDE_DIRS} ${OPUS_INCLUDE_DIRS} ${PORTAUDIO_INCLUDE_DIRS}) target_link_libraries(monitor ${CURSES_LIBRARIES} ${INIPARSER_LIB} ${LIBBSD_LDFLAGS} PkgConfig::OPUS PkgConfig::PORTAUDIO m) add_executable(opussend multicast.c opussend.c) -target_include_directories(opussend PUBLIC ${LIBBSD_INCLUDE_DIRS} ${OPUS_INCLUDE_DIRS} ${PORTAUDIO_INCLUDE_DIRS}) +target_include_directories(opussend PUBLIC ${OPUS_INCLUDE_DIRS} ${PORTAUDIO_INCLUDE_DIRS}) target_link_libraries(opussend ${LIBBSD_LDFLAGS} PkgConfig::OPUS PkgConfig::PORTAUDIO m) add_executable(pcmcat multicast.c pcmcat.c) -target_include_directories(pcmcat PUBLIC ${LIBBSD_INCLUDE_DIRS}) target_link_libraries(pcmcat ${LIBBSD_LDFLAGS}) add_executable(pcmrecord attr.c multicast.c pcmrecord.c) -target_include_directories(pcmrecord PUBLIC ${LIBBSD_INCLUDE_DIRS}) target_link_libraries(pcmrecord ${LIBBSD_LDFLAGS}) add_executable(pcmsend multicast.c pcmsend.c) -target_include_directories(pcmsend PUBLIC ${LIBBSD_INCLUDE_DIRS} ${PORTAUDIO_INCLUDE_DIRS}) +target_include_directories(pcmsend PUBLIC ${PORTAUDIO_INCLUDE_DIRS}) target_link_libraries(pcmsend ${LIBBSD_LDFLAGS} PkgConfig::PORTAUDIO) add_executable(pcmspawn multicast.c pcmspawn.c status.c) -target_include_directories(pcmspawn PUBLIC ${LIBBSD_INCLUDE_DIRS}) target_link_libraries(pcmspawn ${LIBBSD_LDFLAGS}) add_executable(pl filter.c misc.c multicast.c osc.c pl.c) -target_include_directories(pl PUBLIC ${FFTW3_INCLUDE_DIRS} ${LIBBSD_INCLUDE_DIRS}) target_link_libraries(pl ${FFTW3_THREADS_LIB} PkgConfig::FFTW3 ${LIBBSD_LDFLAGS} m) add_executable(show-pkt multicast.c show-pkt.c status.c) -target_include_directories(show-pkt PUBLIC ${CURSES_INCLUDE_DIRS} ${LIBBSD_INCLUDE_DIRS}) +target_include_directories(show-pkt PUBLIC ${CURSES_INCLUDE_DIRS}) target_link_libraries(show-pkt ${CURSES_LIBRARIES} ${LIBBSD_LDFLAGS}) add_executable(setfilt multicast.c setfilt.c status.c) -target_include_directories(setfilt PUBLIC ${LIBBSD_INCLUDE_DIRS}) target_link_libraries(setfilt ${LIBBSD_LDFLAGS}) if(PIGPIO_INCLUDE_DIR) @@ -226,15 +215,13 @@ if(PIGPIO_INCLUDE_DIR) endif() add_executable(show-sig multicast.c show-sig.c status.c) -target_include_directories(show-sig PUBLIC ${CURSES_INCLUDE_DIRS} ${LIBBSD_INCLUDE_DIRS}) +target_include_directories(show-sig PUBLIC ${CURSES_INCLUDE_DIRS}) target_link_libraries(show-sig ${CURSES_LIBRARIES} ${LIBBSD_LDFLAGS} m) add_executable(tune misc.c multicast.c status.c tune.c) -target_include_directories(tune PUBLIC ${LIBBSD_INCLUDE_DIRS}) target_link_libraries(tune ${LIBBSD_LDFLAGS} m) add_executable(wspr-decoded attr.c multicast.c wspr-decoded.c) -target_include_directories(wspr-decoded PUBLIC ${LIBBSD_INCLUDE_DIRS}) target_link_libraries(wspr-decoded ${LIBBSD_LDFLAGS}) ## Other