-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathMakefile
More file actions
1310 lines (1179 loc) · 38.4 KB
/
Makefile
File metadata and controls
1310 lines (1179 loc) · 38.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#######################################################################################
# Copyright (C) 2025,2026
# Heiko Amft, DL1BZ (Project deskHPSDR)
#
# All code published unter the GPLv3
#
#######################################################################################
#
# IMPORTANT NOTE:
#
# DO NEVER EDIT THIS MAKEFILE, edit and use make.config.deskhpsdr INSTEAD !
#
# Copy the following content into the file make.config.deskhpsdr and set the options
# you need or want
#
#######################################################################################
TCI ?= ON
GPIO ?= OFF
MIDI ?= ON
SATURN ?= OFF
USBOZY ?= OFF
SOAPYSDR ?= OFF
STEMLAB ?= OFF
TTS ?= OFF
AUDIO ?= PULSE
ATU ?= OFF
COPYMODE ?= OFF
AUTOGAIN ?= OFF
REGION1 ?= OFF
EQ12 ?= OFF
AH4IOB ?= OFF
DEVEL ?= OFF
TAHOEFIX ?= ON
#################################################################################################################
#
# Explanation of compile time options
#
# TCI | If ON, compile with TCI support (needs OpenSSL)
# GPIO | If ON, compile with GPIO support (RaspPi only, needs libgpiod)
# MIDI | If ON, compile with MIDI support
# TTS | If ON, compile with TTS support and activate TTS
# SATURN | If ON, compile with native SATURN/G2 XDMA support
# USBOZY | If ON, deskHPSDR can talk to legacy USB OZY radios (needs libusb-1.0)
# SOAPYSDR | If ON, deskHPSDR can talk to radios supported via SoapySDR-API library
# STEMLAB | If ON, deskHPSDR can start SDR app on RedPitay via Web interface (needs libcurl)
# AUDIO | If AUDIO=ALSA, use ALSA rather than PulseAudio on Linux (use PulseAudio recommend)
# ATU | If ON, acticate some special functions if using an external ATU
# COPYMODE | If ON, add some additional copy and restore of settings depend from selected mode
# AUTOGAIN | If ON (only if using a Hermes Lite 2 or similar), activate automatic regulation of RxPGA gain
# REGION1 | If ON, the band borders are set to IARU Region 1, if OFF US frequency borders active
# EQ12 | If ON, use 12-band EQ instead of 10-band EQ
# AH4IOB | If ON, enable support for AH-4 compatible ATU using the Hermes Lite 2 IO board
# DEVEL | ONLY FOR INTERNAL DEVELOPER USE AND TESTING ! Leave it ever OFF please !
# TAHOEFIX | If ON, a fix for macOS 26 Tahoe will be activated (macOS only)
#
# If you want to use a non-default compile time option, write them
# into a file "make.config.deskhpsdr". So, for example, if you want to
# disable GPIO and have AUDIO=ALSA, create a file make.config.deskhpsdr in
# the deskhpsdr directory with two lines that read
#
# GPIO=OFF
# AUDIO=ALSA
#
#################################################################################################################
# ------------------------------------------------------------------
# User config bootstrap:
# If make.config.deskhpsdr is missing, copy from template BEFORE include.
# ------------------------------------------------------------------
CONFIG_FILE := make.config.deskhpsdr
CONFIG_TEMPLATE := make.config.deskhpsdr.template
ifeq ($(wildcard $(CONFIG_FILE)),)
ifneq ($(wildcard $(CONFIG_TEMPLATE)),)
$(info Creating $(CONFIG_FILE) from $(CONFIG_TEMPLATE) ...)
$(shell cp -n "$(CONFIG_TEMPLATE)" "$(CONFIG_FILE)" >/dev/null 2>&1 || cp "$(CONFIG_TEMPLATE)" "$(CONFIG_FILE)")
else
$(warning Missing $(CONFIG_FILE) and also missing $(CONFIG_TEMPLATE) - using defaults only.)
endif
endif
-include make.config.deskhpsdr
# get the OS Name
UNAME_S := $(shell uname -s)
CURRDIR := $(shell pwd)
UNAME_R := $(shell uname -r | sed 's/\..*//')
ARCH := $(shell uname -m)
# Desktop directory (Linux may be localized, e.g. "Schreibtisch")
DESKTOP_DIR ?= $(HOME)/Desktop
ifeq ($(UNAME_S),Linux)
DESKTOP_DIR := $(shell command -v xdg-user-dir >/dev/null 2>&1 && xdg-user-dir DESKTOP || echo "$(HOME)/Desktop")
endif
PKG_CONFIG ?= pkg-config
.DEFAULT_GOAL := all
LWS := $(shell $(PKG_CONFIG) --exists "libwebsockets >= 4.0" && echo yes || echo no)
ifeq ($(LWS),yes)
$(info libwebsockets exists, continue build process...)
else
$(info libwebsockets not found: libwebsockets NOT installed, but required now.)
$(info Please install libwebsockets first!)
$(info Linux package: libwebsockets-dev)
$(info macOS Homebrew package: libwebsockets)
$(error Stopping build: install libwebsockets (e.g. via apt if Linux or brew install if macOS) and retry.)
endif
ifeq ($(UNAME_S), Linux)
WK41 := $(shell $(PKG_CONFIG) --exists webkit2gtk-4.1 && echo yes)
WK40 := $(shell $(PKG_CONFIG) --exists webkit2gtk-4.0 && echo yes)
ifeq ($(WK41),yes)
$(info WebKitGTK 4.1 found, continue...)
else ifeq ($(WK40),yes)
$(info WebKitGTK 4.0 found, continue...)
else
$(info WebKitGTK not found: webkit2gtk-4.1 or webkit2gtk-4.0 are NOT installed, but required now.)
$(info Please install WebKitGTK (webkit2gtk) first!)
$(info Debian Bookworm has package: webkit2gtk-4.0)
$(info Debian Trixie has package: webkit2gtk-4.1)
$(error Stopping build: install WebKitGTK (e.g. via apt) and retry.)
endif
endif
# Get git commit version and date
GIT_DATE := $(firstword $(shell git --no-pager show --date=short --format="%ai" --name-only))
GIT_VERSION := $(shell git describe --abbrev=0 --tags --always)
GIT_COMMIT := $(shell git log --pretty=format:"%h" -1)
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
#
# Compile with warning level set to maximum. Note the check against "unintendend" fallthroughs
# in switch statements must be requested explicitly.
# Turn off complaints about deprecated functions (new GTK functions are marked deprecated in each
# release) and against unused parameters (those regularly occur in GTK callbacks).
#
ifeq ($(GDB), ON)
CFLAGS?= -g -O0 -DG_ENABLE_DEBUG
else
CFLAGS?= -O3
endif
# clang detection (macOS: CC may be "cc" but still clang)
IS_CLANG := $(shell $(CC) --version 2>/dev/null | head -n 1 | grep -qi clang && echo 1 || echo 0)
# clang-only: ensure lrint is emitted as intrinsic (TX-IQ hotpath)
# Apply only to transmitter.o to avoid side-effects in other modules.
ifeq ($(IS_CLANG),1)
src/transmitter.o: CFLAGS += \
-fno-math-errno \
-fno-trapping-math \
-fdenormal-fp-math=positive-zero
endif
# global compiler directives
CFLAGS += -Wall -Wextra -Wimplicit-fallthrough -Wno-unused-parameter -Wno-deprecated-declarations -Wcast-align
# only for code check
# CFLAGS += -Wstrict-prototypes -Wold-style-definition
# ifneq (,$(findstring arm,$(ARCH)))
# CFLAGS += -Wformat=2 -Wshadow -Wpointer-arith -Wcast-qual -Wnull-dereference -Wshorten-64-to-32 -Wvla
# endif
# ifneq (,$(findstring aarch64,$(ARCH)))
# CFLAGS += -Wformat=2 -Wshadow -Wpointer-arith -Wcast-qual -Wnull-dereference -Wshorten-64-to-32 -Wvla
# endif
LINK?=$(CC)
ifeq ($(UNAME_S),Darwin)
ifeq ($(shell command -v brew >/dev/null 2>&1 && echo yes),)
$(error Homebrew (brew) is not installed – Please install Homebrew (brew) first !)
endif
BREW_PREFIX := $(shell command -v brew >/dev/null 2>&1 && brew --prefix)
BREW_LIBDIR := $(BREW_PREFIX)/lib
BREW_PCDIR := $(BREW_LIBDIR)/pkgconfig
BREW_INCDIR := $(BREW_PREFIX)/include
# SDKROOT := $(shell xcrun --sdk macosx --show-sdk-path)
# ARCH_FLAGS := -arch arm64 -arch x86_64
# CFLAGS += -mmacosx-version-min=13.0 $(ARCH_FLAGS) -isysroot $(SDKROOT) -I./src -I/usr/local/include
# LDFLAGS += -mmacosx-version-min=13.0 $(ARCH_FLAGS) -isysroot $(SDKROOT)
# LDFLAGS += -Wl,-rpath,/usr/local/lib
ifneq ($(BREW_PREFIX),)
export PKG_CONFIG_PATH := $(BREW_PCDIR):$(PKG_CONFIG_PATH)
LDFLAGS += -Wl,-rpath,/usr/local/lib -Wl,-rpath,$(BREW_LIBDIR)
endif
# CFLAGS += -mmacosx-version-min=13.0
# LINK += -mmacosx-version-min=13.0
endif
ifeq ($(UNAME_S),Linux)
LDFLAGS += -Wl,--enable-new-dtags -Wl,-rpath,/usr/local/lib
endif
#
# The "official" way to compile+link with pthreads is now to use the -pthread option
# *both* for the compile and the link step.
#
CFLAGS+=-pthread -I./src
LINK+=-pthread
##############################################################################
# CPP_DEFINES and CPP_SOURCES are "filled" with all possible options,
# so that everything is processed when running "cppcheck".
##############################################################################
CPP_DEFINES=
CPP_SOURCES=
CPP_INCLUDE=
ifeq ($(UNAME_S),Darwin)
FFTW_CFLAGS := -I$(BREW_INCDIR)
FFTW_LIBS := $(BREW_LIBDIR)/libfftw3.a $(BREW_LIBDIR)/libfftw3f.a
else
FFTW_CFLAGS := $(shell pkg-config --cflags fftw3 fftw3f)
FFTW_LIBS := $(shell pkg-config --libs fftw3 fftw3f)
endif
WDSP_INCLUDE=-I./wdsp-1.29 $(FFTW_CFLAGS)
WDSP_LIBS=wdsp-1.29/libwdsp.a \
wdsp-libs/lib/librnnoise.a \
wdsp-libs/lib/libspecbleach.a \
$(FFTW_LIBS)
SOLAR_INCLUDE=-I./libsolar
SOLAR_LIBS=libsolar/libsolar.a `$(PKG_CONFIG) --libs libcurl libxml-2.0`
TELNET_INCLUDE=-I./libtelnet
TELNET_LIBS=libtelnet/libtelnet.a
##############################################################################
#
# Add support for extended noise reduction
#
##############################################################################
CPP_INCLUDE +=$(WDSP_INCLUDE)
CPP_INCLUDE +=$(SOLAR_INCLUDE)
CPP_INCLUDE +=$(TELNET_INCLUDE)
##############################################################################
#
# Settings for optional features, to be requested by un-commenting lines above
#
##############################################################################
##############################################################################
#
# disable GPIO and SATURN for MacOS, simply because it is not there
#
##############################################################################
ifeq ($(UNAME_S), Darwin)
override GPIO := OFF
override SATURN := OFF
override WAYLAND := OFF
endif
ifeq ($(UNAME_S), Linux)
GPIOD_VERSION := $(shell pkg-config --modversion libgpiod 2>/dev/null)
GPIOD_MAJOR := $(word 1,$(subst ., ,$(GPIOD_VERSION)))
ifeq ($(GPIOD_MAJOR),2)
override GPIO := OFF
$(info libgpiod V2 detected. This is not supported, disable GPIO support...)
endif
ifeq ($(GPIO),ON)
ifeq ($(GPIOD_MAJOR),1)
$(info libgpiod V1 detected. Compile with GPIO support)
else
override GPIO := OFF
endif
endif
endif
##############################################################################
#
# Add modules for MIDI if requested.
# Note these are different for Linux/MacOS
#
##############################################################################
ifeq ($(UNAME_S),Darwin)
override MIDI := ON
endif
ifeq ($(MIDI),ON)
MIDI_OPTIONS=-DMIDI
MIDI_HEADERS= src/midi_layer.h src/midi_menu.h src/alsa_midi.h
ifeq ($(UNAME_S), Darwin)
MIDI_SOURCES= src/mac_midi.c src/midi2.c src/midi3.c src/midi_menu.c
MIDI_OBJS= src/mac_midi.o src/midi2.o src/midi3.o src/midi_menu.o
MIDI_LIBS= -framework CoreMIDI -framework Foundation
endif
ifeq ($(UNAME_S), Linux)
MIDI_SOURCES= src/alsa_midi.c src/midi2.c src/midi3.c src/midi_menu.c
MIDI_OBJS= src/alsa_midi.o src/midi2.o src/midi3.o src/midi_menu.o
MIDI_LIBS= -lasound
endif
endif
CPP_DEFINES += -DMIDI
CPP_SOURCES += src/mac_midi.c src/midi2.c src/midi3.c src/midi_menu.c
CPP_SOURCES += src/alsa_midi.c src/midi2.c src/midi3.c src/midi_menu.c
##############################################################################
#
# Stuff for text-to-speech, if requested
#
##############################################################################
ifeq ($(TTS),ON)
TTS_OPTIONS=-DTTS
TTS_HEADERS= src/tts.h src/MacTTS.h
ifeq ($(UNAME_S), Darwin)
TTS_SOURCES= src/tts.c src/MacTTS.m
TTS_OBJS= src/tts.o src/MacTTS.o
TTS_LIBS= -framework Foundation -framework AVFoundation
endif
ifeq ($(UNAME_S), Linux)
TTS_OPTIONS=-DTTS
TTS_HEADERS= src/tts.h src/MacTTS.h
TTS_SOURCES= src/tts.c
TTS_OBJS= src/tts.o
endif
endif
CPP_DEFINES += -DTTS
CPP_SOURCES += src/tts.c
##############################################################################
#
# Add libraries for Saturn support, if requested
#
##############################################################################
ifeq ($(SATURN),ON)
SATURN_OPTIONS=-DSATURN
SATURN_SOURCES= \
src/saturndrivers.c \
src/saturnregisters.c \
src/saturnserver.c \
src/saturnmain.c \
src/saturn_menu.c
SATURN_HEADERS= \
src/saturndrivers.h \
src/saturnregisters.h \
src/saturnserver.h \
src/saturnmain.h \
src/saturn_menu.h
SATURN_OBJS= \
src/saturndrivers.o \
src/saturnregisters.o \
src/saturnserver.o \
src/saturnmain.o \
src/saturn_menu.o
endif
CPP_DEFINES += -DSATURN
CPP_SOURCES += src/saturndrivers.c src/saturnregisters.c src/saturnserver.c
CPP_SOURCES += src/saturnmain.c src/saturn_menu.c
##############################################################################
#
# Add libraries for USB OZY support, if requested
#
##############################################################################
ifeq ($(USBOZY),ON)
USBOZY_OPTIONS=-DUSBOZY
USBOZY_INCLUDE=`$(PKG_CONFIG) --cflags libusb-1.0`
USBOZY_LIBS=`$(PKG_CONFIG) --libs libusb-1.0`
USBOZY_SOURCES= \
src/ozyio.c
USBOZY_HEADERS= \
src/ozyio.h
USBOZY_OBJS= \
src/ozyio.o
endif
CPP_DEFINES += -DUSBOZY
CPP_SOURCES += src/ozyio.c
CPP_INCLUDE += `$(PKG_CONFIG) --cflags libusb-1.0`
##############################################################################
#
# Add libraries for SoapySDR support, if requested
#
##############################################################################
ifeq ($(SOAPYSDR),ON)
SOAPYSDR_OPTIONS=-DSOAPYSDR
ifeq ($(UNAME_S), Darwin)
SOAPYSDR_LIBS=`$(PKG_CONFIG) --libs soapysdr`
SOAPYSDR_INCLUDE=`$(PKG_CONFIG) --cflags soapysdr`
else
SOAPYSDR_INCLUDE= -I/usr/local/include
SOAPYSDR_LIBS= -L/usr/local/lib -lSoapySDR
endif
SOAPYSDR_SOURCES= \
src/soapy_discovery.c \
src/soapy_protocol.c
SOAPYSDR_HEADERS= \
src/soapy_discovery.h \
src/soapy_protocol.h
SOAPYSDR_OBJS= \
src/soapy_discovery.o \
src/soapy_protocol.o
endif
CPP_DEFINES += -DSOAPYSDR
CPP_SOURCES += src/soapy_discovery.c src/soapy_protocol.c
ifeq ($(UNAME_S), Darwin)
CPP_INCLUDE +=`$(PKG_CONFIG) --cflags soapysdr`
else
CPP_INCLUDE += -I/usr/local/include
endif
##############################################################################
#
# Add libraries for GPIO support, if requested
#
##############################################################################
ifeq ($(GPIO),ON)
GPIO_OPTIONS=-DGPIO
ifeq ($(GPIOD_VERSION),1.2)
GPIO_OPTIONS += -DOLD_GPIOD
endif
GPIO_LIBS=-lgpiod -li2c
endif
CPP_DEFINES += -DGPIO
##############################################################################
#
# Activate code for RedPitaya (Stemlab/Hamlab/plain vanilla), if requested
# This code detects the RedPitaya by its WWW interface and starts the SDR
# application.
# If the RedPitaya auto-starts the SDR application upon system start,
# this option is not needed!
#
##############################################################################
ifeq ($(STEMLAB), ON)
STEMLAB_OPTIONS=-DSTEMLAB_DISCOVERY
STEMLAB_INCLUDE=`$(PKG_CONFIG) --cflags libcurl`
STEMLAB_LIBS=`$(PKG_CONFIG) --libs libcurl`
STEMLAB_SOURCES=src/stemlab_discovery.c
STEMLAB_HEADERS=src/stemlab_discovery.h
STEMLAB_OBJS=src/stemlab_discovery.o
endif
CPP_DEFINES += -DSTEMLAB_DISCOVERY
CPP_SOURCES += src/stemlab_discovery.c
CPP_INCLUDE += `$(PKG_CONFIG) --cflags libcurl`
##############################################################################
#
# Activate additional code
#
##############################################################################
ifeq ($(ATU), ON)
ATU_OPTIONS=-D__HAVEATU__
endif
CPP_DEFINES += -D__HAVEATU__
ifeq ($(COPYMODE), ON)
COPYMODE_OPTIONS=-D__CPYMODE__
endif
CPP_DEFINES += -D__CPYMODE__
ifeq ($(AUTOGAIN), ON)
AUTOGAIN_OPTIONS=-D__AUTOG__
endif
CPP_DEFINES += -D__AUTOG__
ifeq ($(DEVEL), ON)
DEVEL_OPTIONS=-D__DVL__
endif
CPP_DEFINES += -D__DVL__
ifeq ($(REGION1), ON)
REG1_OPTIONS=-D__REG1__
endif
CPP_DEFINES += -D__REG1__
ifeq ($(EQ12), ON)
EQ12_OPTIONS=-D__EQ12__
endif
CPP_DEFINES += -D__EQ12__
ifeq ($(AH4IOB), ON)
AH4IOB_OPTIONS=-D__AH4IOB__
endif
CPP_DEFINES += -D__AH4IOB__
# if OS is Linux, but TAHOEFIX is set, remove this
ifeq ($(UNAME_S), Linux)
override TAHOEFIX := OFF
endif
# only if using macOS 26 Tahoe, fix a SDR detection issue
ifeq ($(TAHOEFIX), ON)
TAHOEFIX_OPTIONS=-D__TAHOEFIX__
endif
CPP_DEFINES += -D__TAHOEFIX__
ifeq ($(WAYLAND), ON)
WAYLAND_OPTIONS=-D__WAYLAND__
endif
CPP_DEFINES += -D__WAYLAND__
##############################################################################
#
# Options for audio module
# - MacOS: only PORTAUDIO
# - Linux: either PULSEAUDIO (default) or ALSA (upon request)
#
##############################################################################
ifeq ($(UNAME_S), Darwin)
override AUDIO := PORTAUDIO
endif
ifeq ($(UNAME_S), Linux)
ifneq ($(AUDIO) , ALSA)
override AUDIO := PULSE
endif
endif
##############################################################################
#
# Add libraries for using PulseAudio, if requested
#
##############################################################################
ifeq ($(AUDIO), PULSE)
AUDIO_OPTIONS=-DPULSEAUDIO
AUDIO_INCLUDE=
ifeq ($(UNAME_S), Linux)
AUDIO_LIBS=-lpulse-simple -lpulse -lpulse-mainloop-glib
endif
ifeq ($(UNAME_S), Darwin)
AUDIO_LIBS=-lpulse-simple -lpulse
endif
AUDIO_SOURCES=src/pulseaudio.c
AUDIO_OBJS=src/pulseaudio.o
endif
CPP_DEFINES += -DPULSEAUDIO
CPP_SOURCES += src/pulseaudio.c
##############################################################################
#
# Add libraries for using ALSA, if requested
#
##############################################################################
ifeq ($(AUDIO), ALSA)
AUDIO_OPTIONS=-DALSA
AUDIO_INCLUDE=
AUDIO_LIBS=-lasound
AUDIO_SOURCES=src/audio.c
AUDIO_OBJS=src/audio.o
endif
CPP_DEFINES += -DALSA
CPP_SOURCES += src/audio.c
##############################################################################
#
# Add libraries for using PortAudio, if requested
#
##############################################################################
ifeq ($(AUDIO), PORTAUDIO)
AUDIO_OPTIONS=-DPORTAUDIO -DPA_USE_COREAUDIO
AUDIO_INCLUDE=`$(PKG_CONFIG) --cflags portaudio-2.0`
# AUDIO_LIBS=`$(PKG_CONFIG) --libs portaudio-2.0`
AUDIO_LIBS=$(BREW_LIBDIR)/libportaudio.a \
-framework CoreAudio \
-framework AudioToolbox \
-framework AudioUnit \
-framework CoreFoundation \
-framework CoreServices \
-framework CoreMIDI
AUDIO_SOURCES=src/portaudio.c
AUDIO_OBJS=src/portaudio.o
endif
CPP_DEFINES += -DPORTAUDIO
CPP_SOURCES += src/portaudio.c
ifeq ($(UNAME_S), Darwin)
# does not exist on RaspPi
CPP_INCLUDE += `$(PKG_CONFIG) --cflags portaudio-2.0`
endif
##############################################################################
#
# Add TCI support, if requested
#
##############################################################################
ifeq ($(TCI), ON)
TCI_OPTIONS=-DTCI
TCI_INCLUDE=`$(PKG_CONFIG) --cflags openssl` `$(PKG_CONFIG) --cflags libwebsockets`
ifeq ($(UNAME_S), Darwin)
TCI_LIBS=$(BREW_LIBDIR)/libwebsockets.a $(BREW_LIBDIR)/libssl.a $(BREW_LIBDIR)/libcrypto.a
else
TCI_LIBS=`$(PKG_CONFIG) --libs openssl` `$(PKG_CONFIG) --libs libwebsockets`
endif
TCI_SOURCES=src/tci.c
TCI_OBJS=src/tci.o
endif
CPP_INCLUDE += `$(PKG_CONFIG) --cflags openssl` `$(PKG_CONFIG) --cflags libwebsockets`
CPP_DEFINES += -DTCI
CPP_SOURCES += src/tci.c
##############################################################################
#
# End of "libraries for optional features" section
#
##############################################################################
##############################################################################
#
# Includes and Libraries for the graphical user interface (GTK)
#
##############################################################################
# ifeq ($(UNAME_S), Linux)
# WEBKIT_PKG := $(shell $(PKG_CONFIG) --exists webkit2gtk-4.1 && echo webkit2gtk-4.1 || echo webkit2gtk-4.0)
# GTK_INCLUDE := $(shell $(PKG_CONFIG) --cflags gtk+-3.0 glib-2.0 gio-2.0 $(WEBKIT_PKG))
# GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-3.0 glib-2.0 gio-2.0 $(WEBKIT_PKG))
# endif
# ifeq ($(UNAME_S), Darwin)
# GTK_INCLUDE := $(shell $(PKG_CONFIG) --cflags gtk+-3.0 glib-2.0 gio-2.0)
# GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-3.0 glib-2.0 gio-2.0)
# endif
ifeq ($(UNAME_S), Linux)
# WebKit-Version automatisch ermitteln: 4.1 (Trixie) oder Fallback 4.0 (Bookworm)
WEBKIT_PKG := $(shell $(PKG_CONFIG) --exists webkit2gtk-4.1 && echo webkit2gtk-4.1 || echo webkit2gtk-4.0)
GTK_INCLUDE=`$(PKG_CONFIG) --cflags gtk+-3.0 glib-2.0 gio-2.0 $(WEBKIT_PKG)`
GTK_LIBS=`$(PKG_CONFIG) --libs gtk+-3.0 glib-2.0 gio-2.0 $(WEBKIT_PKG)`
endif
ifeq ($(UNAME_S), Darwin)
GTK_INCLUDE=`$(PKG_CONFIG) --cflags gtk+-3.0 glib-2.0 gio-2.0`
GTK_LIBS=`$(PKG_CONFIG) --libs gtk+-3.0 glib-2.0 gio-2.0`
endif
CPP_INCLUDE += $(GTK_INCLUDE)
##############################################################################
#
# Includes and Libraries for JSON-C
#
##############################################################################
JSON_INCLUDE=`$(PKG_CONFIG) --cflags json-c`
# JSON_LIBS=`$(PKG_CONFIG) --libs json-c`
ifeq ($(UNAME_S),Darwin)
JSON_LIBS=$(BREW_LIBDIR)/libjson-c.a
else
JSON_LIBS=`$(PKG_CONFIG) --libs json-c`
endif
CPP_INCLUDE += $(JSON_INCLUDE)
##############################################################################
#
# Specify additional OS-dependent system libraries
#
##############################################################################
ifeq ($(UNAME_S), Linux)
SYS_LIBS=-lrt
endif
ifeq ($(UNAME_S), Darwin)
SYS_LIBS=-framework IOKit -framework Cocoa -framework WebKit
endif
##############################################################################
#
# All the command-line options to compile the *.c files
#
##############################################################################
OPTIONS=$(MIDI_OPTIONS) $(USBOZY_OPTIONS) \
$(GPIO_OPTIONS) $(SOAPYSDR_OPTIONS) \
$(ANDROMEDA_OPTIONS) \
$(SATURN_OPTIONS) \
$(STEMLAB_OPTIONS) \
$(TTS_OPTIONS) \
$(DESKTOP_OPTIONS) \
$(ATU_OPTIONS) \
$(COPYMODE_OPTIONS) \
$(AH4IOB_OPTIONS) \
$(AUTOGAIN_OPTIONS) \
$(DEVEL_OPTIONS) \
$(REG1_OPTIONS) \
$(EQ12_OPTIONS) \
$(WAYLAND_OPTIONS) \
$(TAHOEFIX_OPTIONS) \
$(AUDIO_OPTIONS) $(TCI_OPTIONS) \
-DGIT_DATE='"$(GIT_DATE)"' -DGIT_VERSION='"$(GIT_VERSION)"' -DGIT_COMMIT='"$(GIT_COMMIT)"' -DGIT_BRANCH='"$(GIT_BRANCH)"'
INCLUDES=$(GTK_INCLUDE) $(WDSP_INCLUDE) $(SOLAR_INCLUDE) $(TELNET_INCLUDE) $(AUDIO_INCLUDE) $(STEMLAB_INCLUDE) $(TCI_INCLUDE) $(JSON_INCLUDE)
COMPILE=$(CC) $(CFLAGS) $(OPTIONS) $(INCLUDES)
.c.o:
ifeq ($(GDB), ON)
$(COMPILE) -g -c -o $@ $<
else
$(COMPILE) -c -o $@ $<
endif
.m.o:
ifeq ($(GDB), ON)
$(COMPILE) -g -c -o $@ $<
else
$(COMPILE) -c -o $@ $<
endif
%.o: %.mm
ifeq ($(GDB), ON)
$(COMPILE) -g -c -o $@ $<
else
$(COMPILE) -c -o $@ $<
endif
##############################################################################
#
# All the libraries we need to link with (including WDSP, libm, $(SYS_LIBS))
#
##############################################################################
LIBS= $(AUDIO_LIBS) $(USBOZY_LIBS) $(GTK_LIBS) $(GPIO_LIBS) $(SOAPYSDR_LIBS) $(STEMLAB_LIBS) \
$(MIDI_LIBS) $(TTS_LIBS) $(TCI_LIBS) $(JSON_LIBS) $(WDSP_LIBS) $(SOLAR_LIBS) $(TELNET_LIBS) -lm $(SYS_LIBS)
##############################################################################
#
# The main target, the deskhpsdr program
#
##############################################################################
PROGRAM=deskhpsdr
##############################################################################
#
# The core *.c files in alphabetical order
#
##############################################################################
SOURCES= \
src/MacOS.c \
src/about_menu.c \
src/actions.c \
src/action_dialog.c \
src/agc_menu.c \
src/ant_menu.c \
src/appearance.c \
src/band.c \
src/band_menu.c \
src/bandstack_menu.c \
src/css.c \
src/configure.c \
src/cw_menu.c \
src/discovered.c \
src/discovery.c \
src/display_menu.c \
src/diversity_menu.c \
src/dxcluster.c \
src/encoder_menu.c \
src/equalizer_menu.c \
src/exit_menu.c \
src/ext.c \
src/extras_menu.c \
src/fft_menu.c \
src/filter.c \
src/filter_menu.c \
src/gpio.c \
src/greyline.c \
src/i2c.c \
src/iambic.c \
src/led.c \
src/main.c \
src/message.c \
src/meter.c \
src/meter_menu.c \
src/mode.c \
src/mode_menu.c \
src/new_discovery.c \
src/new_menu.c \
src/new_protocol.c \
src/noise_menu.c \
src/nw_toolset.c \
src/oc_menu.c \
src/old_discovery.c \
src/old_protocol.c \
src/pa_menu.c \
src/property.c \
src/protocols.c \
src/ps_menu.c \
src/radio.c \
src/radio_menu.c \
src/receiver.c \
src/rigctl.c \
src/rigctl_menu.c \
src/rx_menu.c \
src/rx_panadapter.c \
src/screen_menu.c \
src/sintab.c \
src/sliders.c \
src/startup.c \
src/store.c \
src/store_menu.c \
src/switch_menu.c \
src/toolbar.c \
src/toolbar_menu.c \
src/toolset.c \
src/transmitter.c \
src/tx_menu.c \
src/tx_panadapter.c \
src/version.c \
src/vfo.c \
src/vfo_menu.c \
src/vox.c \
src/vox_menu.c \
src/voice_keyer.c \
src/waterfall.c \
src/xvtr_menu.c \
src/zoompan.c
##############################################################################
#
# The core *.h (header) files in alphabetical order
#
##############################################################################
HEADERS= \
src/MacOS.h \
src/about_menu.h \
src/actions.h \
src/action_dialog.h \
src/adc.h \
src/agc.h \
src/agc_menu.h \
src/alex.h \
src/ant_menu.h \
src/appearance.h \
src/band.h \
src/band_menu.h \
src/bandstack_menu.h \
src/bandstack.h \
src/channel.h \
src/configure.h \
src/css.h \
src/cw_menu.h \
src/dac.h \
src/discovered.h \
src/discovery.h \
src/display_menu.h \
src/diversity_menu.h \
src/dxcluster.h \
src/encoder_menu.h \
src/equalizer_menu.h \
src/exit_menu.h \
src/ext.h \
src/extras_menu.h \
src/fft_menu.h \
src/filter.h \
src/filter_menu.h \
src/gpio.h \
src/greyline.h \
src/iambic.h \
src/i2c.h \
src/led.h \
src/main.h \
src/message.h \
src/meter.h \
src/meter_menu.h \
src/mode.h \
src/mode_menu.h \
src/new_discovery.h \
src/new_menu.h \
src/new_protocol.h \
src/noise_menu.h \
src/nw_toolset.h \
src/oc_menu.h \
src/old_discovery.h \
src/old_protocol.h \
src/pa_menu.h \
src/property.h \
src/protocols.h \
src/ps_menu.h \
src/radio.h \
src/radio_menu.h \
src/receiver.h \
src/rigctl.h \
src/rigctl_menu.h \
src/rx_menu.h \
src/rx_panadapter.h \
src/screen_menu.h \
src/sintab.h \
src/sliders.h \
src/startup.h \
src/store.h \
src/store_menu.h \
src/switch_menu.h \
src/toolbar.h \
src/toolbar_menu.h \
src/toolset.h \
src/transmitter.h \
src/tx_menu.h \
src/tx_panadapter.h \
src/version.h \
src/vfo.h \
src/vfo_menu.h \
src/vox.h \
src/vox_menu.h \
src/voice_keyer.h \
src/waterfall.h \
src/xvtr_menu.h \
src/zoompan.h
##############################################################################
#
# The core *.o (object) files in alphabetical order
#
##############################################################################
OBJS= \
src/MacOS.o \
src/about_menu.o \
src/actions.o \
src/action_dialog.o \
src/agc_menu.o \
src/ant_menu.o \
src/appearance.o \
src/band.o \
src/band_menu.o \
src/bandstack_menu.o \
src/configure.o \
src/css.o \
src/cw_menu.o \
src/discovered.o \
src/discovery.o \
src/display_menu.o \
src/diversity_menu.o \
src/dxcluster.o \
src/encoder_menu.o \
src/equalizer_menu.o \
src/exit_menu.o \
src/ext.o \
src/extras_menu.o \
src/fft_menu.o \
src/filter.o \
src/filter_menu.o \
src/gpio.o \
src/greyline.o \
src/iambic.o \
src/i2c.o \
src/led.o \
src/main.o \
src/message.o \
src/meter.o \
src/meter_menu.o \
src/mode.o \
src/mode_menu.o \
src/new_discovery.o \
src/new_menu.o \
src/new_protocol.o \
src/noise_menu.o \
src/nw_toolset.o \
src/oc_menu.o \
src/old_discovery.o \
src/old_protocol.o \
src/pa_menu.o \
src/property.o \
src/protocols.o \
src/ps_menu.o \
src/radio.o \
src/radio_menu.o \
src/receiver.o \
src/rigctl.o \
src/rigctl_menu.o \
src/rx_menu.o \
src/rx_panadapter.o \
src/screen_menu.o \
src/sintab.o \
src/sliders.o \
src/startup.o \
src/store.o \
src/store_menu.o \
src/switch_menu.o \
src/toolbar.o \
src/toolbar_menu.o \
src/toolset.o \
src/transmitter.o \
src/tx_menu.o \
src/tx_panadapter.o \