forked from g0orx/pihpsdr
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Makefile
1231 lines (1148 loc) · 48.2 KB
/
Makefile
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
#######################################################################################
# IMPORTANT NOTE:
# This file is no longer meant to be changed by the end user.
# To use non-default compile-time options please create a file4
# make.config.pihpsdr (see below)
#
#######################################################################################
#######################################################################################
#
# Default Compile-time options
#
#######################################################################################
GPIO=ON
MIDI=ON
SATURN=ON
USBOZY=OFF
SOAPYSDR=OFF
STEMLAB=OFF
EXTENDED_NR=
SERVER=OFF
AUDIO=PULSE
#######################################################################################
#
# Explanation of compile time options
#
# GPIO | If ON, compile with GPIO support (RaspPi only)
# MIDI | If ON, compile with MIDI support
# SATURN | If ON, compile with native SATURN/G2 XDMA support
# USBOZY | If ON, piHPSDR can talk to legacy USB OZY radios
# SOAPYSDR | If ON, piHPSDR can talk to radios via SoapySDR library
# STEMLAB | If ON, piHPSDR can start SDR app on RedPitay via Web interface
# EXTENDED_NR | If ON, piHPSDR can use extended noise reduction (VU3RDD WDSP version)
# SERVER | If ON, include client/server code (still far from being complete)
# AUDIO | If AUDIO=ALSA, use ALSA rather than PulseAudio on Linux
#
# If you want to use a non-default compile time option, write them
# into a file "make.pihpsdr.config". So, for example, if you want to
# disable GPIO and have AUDIO=ALSA, create a file make.config.pihpsdr in
# the pihpsdr directory with two lines that read
#
# GPIO=OFF
# AUDIO=ALSA
#
#######################################################################################
-include make.config.pihpsdr
# get the OS Name
UNAME_S := $(shell uname -s)
# 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 --dirty)
GIT_COMMIT := $(shell git log --pretty=format:"%h" -1)
#
# 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).
#
CFLAGS?= -O3 -Wall -Wextra -Wimplicit-fallthrough -Wno-unused-parameter -Wno-deprecated-declarations
LINK?= $(CC)
#
# 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
PKG_CONFIG = pkg-config
##############################################################################
# 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=
WDSP_INCLUDE=-I./wdsp
WDSP_LIBS=wdsp/libwdsp.a `$(PKG_CONFIG) --libs fftw3`
##############################################################################
#
# Add support for extended noise reduction, if requested
# This implies that one compiles against a wdsp.h e.g. in /usr/local/include,
# and links with a WDSP shared lib e.g. in /usr/local/lib
#
##############################################################################
ifeq ($(EXTENDED_NR), ON)
EXTNR_OPTIONS=-DEXTNR
WDSP_INCLUDE=
WDSP_LIBS=-lwdsp `$(PKG_CONFIG) --libs fftw3`
endif
CPP_DEFINES += -DEXTNR
CPP_INCLUDE +=$(WDSP_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)
GPIO=
SATURN=
endif
##############################################################################
#
# Add modules for MIDI if requested.
# Note these are different for Linux/MacOS
#
##############################################################################
ifeq ($(MIDI),ON)
MIDI_OPTIONS=-D MIDI
MIDI_HEADERS= midi.h midi_menu.h 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
##############################################################################
#
# Add libraries for Saturn support, if requested
#
##############################################################################
ifeq ($(SATURN),ON)
SATURN_OPTIONS=-D SATURN
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=-D USBOZY
USBOZY_LIBS=-lusb-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
##############################################################################
#
# Add libraries for SoapySDR support, if requested
#
##############################################################################
ifeq ($(SOAPYSDR),ON)
SOAPYSDR_OPTIONS=-D SOAPYSDR
SOAPYSDRLIBS=-lSoapySDR
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
##############################################################################
#
# Add libraries for GPIO support, if requested
#
##############################################################################
ifeq ($(GPIO),ON)
GPIO_OPTIONS=-D GPIO
GPIOD_VERSION=$(shell pkg-config --modversion libgpiod)
ifeq ($(GPIOD_VERSION),1.2)
GPIO_OPTIONS += -D OLD_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=-D STEMLAB_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 code for remote operation, if requested.
# This feature is not yet finished. If finished, it
# allows to run two instances of piHPSDR on two
# different computers, one interacting with the operator
# and the other talking to the radio, and both computers
# may be connected by a long-distance internet connection.
#
##############################################################################
ifeq ($(SERVER), ON)
SERVER_OPTIONS=-D CLIENT_SERVER
SERVER_SOURCES= \
src/client_server.c src/server_menu.c
SERVER_HEADERS= \
src/client_server.h src/server_menu.h
SERVER_OBJS= \
src/client_server.o src/server_menu.o
endif
CPP_DEFINES += -DCLIENT_SERVER
CPP_SOURCES += src/client_server.c src/server_menu.c
##############################################################################
#
# Options for audio module
# - MacOS: only PORTAUDIO
# - Linux: either PULSEAUDIO (default) or ALSA (upon request)
#
##############################################################################
ifeq ($(UNAME_S), Darwin)
AUDIO=PORTAUDIO
endif
ifeq ($(UNAME_S), Linux)
ifneq ($(AUDIO) , ALSA)
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
AUDIO_INCLUDE=`$(PKG_CONFIG) --cflags portaudio-2.0`
AUDIO_LIBS=`$(PKG_CONFIG) --libs portaudio-2.0`
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
##############################################################################
#
# End of "libraries for optional features" section
#
##############################################################################
##############################################################################
#
# Includes and Libraries for the graphical user interface (GTK)
#
##############################################################################
GTKINCLUDE=`$(PKG_CONFIG) --cflags gtk+-3.0`
GTKLIBS=`$(PKG_CONFIG) --libs gtk+-3.0`
CPP_INCLUDE += $(GTKINCLUDE)
##############################################################################
#
# Specify additional OS-dependent system libraries
#
##############################################################################
ifeq ($(UNAME_S), Linux)
SYSLIBS=-lrt
endif
ifeq ($(UNAME_S), Darwin)
SYSLIBS=-framework IOKit
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) \
$(SERVER_OPTIONS) \
$(AUDIO_OPTIONS) $(EXTNR_OPTIONS)\
-D GIT_DATE='"$(GIT_DATE)"' -D GIT_VERSION='"$(GIT_VERSION)"' -D GIT_COMMIT='"$(GIT_COMMIT)"'
INCLUDES=$(GTKINCLUDE) $(WDSP_INCLUDE) $(AUDIO_INCLUDE) $(STEMLAB_INCLUDE)
COMPILE=$(CC) $(CFLAGS) $(OPTIONS) $(INCLUDES)
.c.o:
$(COMPILE) -c -o $@ $<
##############################################################################
#
# All the libraries we need to link with (including WDSP, libm, $(SYSLIBS))
#
##############################################################################
LIBS= $(LDFLAGS) $(AUDIO_LIBS) $(USBOZY_LIBS) $(GTKLIBS) $(GPIO_LIBS) $(SOAPYSDRLIBS) $(STEMLAB_LIBS) \
$(MIDI_LIBS) $(WDSP_LIBS) -lm $(SYSLIBS)
##############################################################################
#
# The main target, the pihpsdr program
#
##############################################################################
PROGRAM=pihpsdr
##############################################################################
#
# 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/encoder_menu.c \
src/equalizer_menu.c \
src/exit_menu.c \
src/ext.c \
src/fft_menu.c \
src/filter.c \
src/filter_menu.c \
src/gpio.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/mystring.c \
src/new_discovery.c \
src/new_menu.c \
src/new_protocol.c \
src/noise_menu.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/transmitter.c \
src/tts.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/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/encoder_menu.h \
src/equalizer_menu.h \
src/exit_menu.h \
src/ext.h \
src/fft_menu.h \
src/filter.h \
src/filter_menu.h \
src/gpio.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/mystring.h \
src/new_discovery.h \
src/new_menu.h \
src/new_protocol.h \
src/noise_menu.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/transmitter.h \
src/tts.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/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/encoder_menu.o \
src/equalizer_menu.o \
src/exit_menu.o \
src/ext.o \
src/fft_menu.o \
src/filter.o \
src/filter_menu.o \
src/gpio.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/mystring.o \
src/new_discovery.o \
src/new_menu.o \
src/new_protocol.o \
src/noise_menu.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/transmitter.o \
src/tts.o \
src/tx_menu.o \
src/tx_panadapter.o \
src/version.o \
src/vfo.o \
src/vfo_menu.o \
src/vox.o \
src/vox_menu.o \
src/xvtr_menu.o \
src/waterfall.o \
src/zoompan.o
##############################################################################
#
# How to link the program
#
##############################################################################
$(PROGRAM): $(OBJS) $(AUDIO_OBJS) $(USBOZY_OBJS) $(SOAPYSDR_OBJS) \
$(MIDI_OBJS) $(STEMLAB_OBJS) $(SERVER_OBJS) $(SATURN_OBJS)
$(COMPILE) -c -o src/version.o src/version.c
ifneq (z$(WDSP_INCLUDE), z)
@+make -C wdsp
endif
$(LINK) -o $(PROGRAM) $(OBJS) $(AUDIO_OBJS) $(USBOZY_OBJS) $(SOAPYSDR_OBJS) \
$(MIDI_OBJS) $(STEMLAB_OBJS) $(SERVER_OBJS) $(SATURN_OBJS) $(LIBS)
##############################################################################
#
# "make check" invokes the cppcheck program to do a source-code checking.
#
# The "-pthread" compiler option is not valid for cppcheck and must be filtered out.
# Furthermore, we can add additional options to cppcheck in the variable CPP_OPTIONS
#
# Normally cppcheck complains about variables that could be declared "const".
# Suppress this warning for callback functions because adding "const" would need
# an API change in many cases.
#
# On MacOS, cppcheck usually cannot find the system include files so we suppress any
# warnings therefrom, as well as warnings for functions defined in some
# library but never called.
# Furthermore, we can use --check-level=exhaustive on MacOS
# since there we have new newest version (>2.11), while on RaspPi we still have
# older versions.
#
##############################################################################
CPP_INCLUDE:=$(shell echo $(CPP_INCLUDE) | sed -e "s/ -pthread/ /" )
CPP_OPTIONS= --inline-suppr --enable=all --suppress=unmatchedSuppression
ifeq ($(UNAME_S), Darwin)
CPP_OPTIONS += -D__APPLE__
CPP_OPTIONS += --check-level=exhaustive
CPP_OPTIONS += --suppress=missingIncludeSystem
CPP_OPTIONS += --suppress=unusedFunction
else
CPP_OPTIONS += -D__linux__
CPP_OPTIONS += --suppress=missingIncludeSystem
CPP_OPTIONS += --suppress=unusedFunction
endif
.PHONY: cppcheck
cppcheck:
cppcheck $(CPP_OPTIONS) $(CPP_INCLUDE) $(CPP_DEFINES) $(SOURCES) $(CPP_SOURCES)
.PHONY: clean
clean:
rm -f src/*.o
rm -f $(PROGRAM) hpsdrsim bootloader
rm -rf $(PROGRAM).app
@make -C release/LatexManual clean
@make -C wdsp clean
#############################################################################
#
# hpsdrsim is a cool program that emulates an SDR board with UDP and TCP
# facilities. It even feeds back the TX signal and distorts it, so that
# you can test PureSignal.
# This feature only works if the sample rate is 48000
#
#############################################################################
src/hpsdrsim.o: src/hpsdrsim.c src/hpsdrsim.h
$(CC) -c $(CFLAGS) -o src/hpsdrsim.o src/hpsdrsim.c
src/newhpsdrsim.o: src/newhpsdrsim.c src/hpsdrsim.h
$(CC) -c $(CFLAGS) -o src/newhpsdrsim.o src/newhpsdrsim.c
hpsdrsim: src/hpsdrsim.o src/newhpsdrsim.o
$(LINK) -o hpsdrsim src/hpsdrsim.o src/newhpsdrsim.o -lm
#############################################################################
#
# bootloader is a small command-line program that allows to
# set the radio's IP address and upload firmware through the
# ancient protocol. This program can only be run as root since
# this protocol requires "sniffing" at the Ethernet adapter
# (this "sniffing" is done via the pcap library)
#
#############################################################################
bootloader: src/bootloader.c
$(CC) -o bootloader src/bootloader.c -lpcap
#############################################################################
#
# Re-create the manual PDF from the manual LaTeX sources. This creates
# the PDF version of the manual in release/LaTexManual and DOES NOT over-
# write the manual in release.
# The PDF file in "release" is meant to be updated only once a year or so,
# because including frequently changing binaries in a git repository tends
# to blow up this repository. Instead, binaries should be re-created from
# source code files.
#
#############################################################################
#############################################################################
#
# Create a file named DEPEND containing dependencies, to be added to
# the Makefile. This is done here because we need lots of #defines
# to make it right.
#
#############################################################################
.PHONY: DEPEND
DEPEND:
rm -f DEPEND
touch DEPEND
makedepend -DMIDI -DSATURN -DUSBOZY -DSOAPYSDR -DEXTNR -DGPIO \
-DSTEMLAB_DISCOVERY -DCLIENT_SERVER -DPULSEAUDIO \
-DPORTAUDIO -DALSA -D__APPLE__ -D__linux__ \
-f DEPEND -I./src src/*.c src/*.h
#############################################################################
#
# This is for MacOS "app" creation ONLY
#
# The piHPSDR working directory is
# $HOME -> Application Support -> piHPSDR
#
# That is the directory where the WDSP wisdom file (created upon first
# start of piHPSDR) but also the radio settings and the midi.props file
# are stored.
#
# No libraries are included in the app bundle, so it will only run
# on the computer where it was created, and on other computers which
# have all librariesand possibly the SoapySDR support
# modules installed.
#############################################################################
.PHONY: app
app: $(OBJS) $(AUDIO_OBJS) $(USBOZY_OBJS) $(SOAPYSDR_OBJS) \
$(MIDI_OBJS) $(STEMLAB_OBJS) $(SERVER_OBJS) $(SATURN_OBJS)
ifneq (z$(WDSP_INCLUDE), z)
@+make -C wdsp
endif
$(LINK) -headerpad_max_install_names -o $(PROGRAM) $(OBJS) $(AUDIO_OBJS) $(USBOZY_OBJS) \
$(SOAPYSDR_OBJS) $(MIDI_OBJS) $(STEMLAB_OBJS) $(SERVER_OBJS) $(SATURN_OBJS) \
$(LIBS) $(LDFLAGS)
@rm -rf pihpsdr.app
@mkdir -p pihpsdr.app/Contents/MacOS
@mkdir -p pihpsdr.app/Contents/Frameworks
@mkdir -p pihpsdr.app/Contents/Resources
@cp pihpsdr pihpsdr.app/Contents/MacOS/pihpsdr
@cp MacOS/PkgInfo pihpsdr.app/Contents
@cp MacOS/Info.plist pihpsdr.app/Contents
@cp MacOS/hpsdr.icns pihpsdr.app/Contents/Resources/hpsdr.icns
@cp MacOS/hpsdr.png pihpsdr.app/Contents/Resources
#############################################################################
#
# What follows is automatically generated by the "makedepend" program
# implemented here with "make DEPEND". This should be re-done each time
# a header file is added, or added to a C source code file.
#
#############################################################################
# DO NOT DELETE
src/MacOS.o: src/message.h
src/about_menu.o: src/new_menu.h src/about_menu.h src/discovered.h
src/about_menu.o: src/radio.h src/adc.h src/dac.h src/receiver.h
src/about_menu.o: src/transmitter.h src/version.h src/mystring.h
src/action_dialog.o: src/main.h src/actions.h
src/actions.o: src/main.h src/discovery.h src/receiver.h src/sliders.h
src/actions.o: src/transmitter.h src/actions.h src/band_menu.h
src/actions.o: src/diversity_menu.h src/vfo.h src/mode.h src/radio.h
src/actions.o: src/adc.h src/dac.h src/discovered.h src/radio_menu.h
src/actions.o: src/new_menu.h src/new_protocol.h src/MacOS.h src/ps_menu.h
src/actions.o: src/agc.h src/filter.h src/band.h src/bandstack.h
src/actions.o: src/noise_menu.h src/client_server.h src/ext.h src/zoompan.h
src/actions.o: src/gpio.h src/toolbar.h src/iambic.h src/store.h
src/actions.o: src/equalizer_menu.h src/message.h src/mystring.h
src/agc_menu.o: src/new_menu.h src/agc_menu.h src/agc.h src/band.h
src/agc_menu.o: src/bandstack.h src/radio.h src/adc.h src/dac.h
src/agc_menu.o: src/discovered.h src/receiver.h src/transmitter.h src/vfo.h
src/agc_menu.o: src/mode.h src/ext.h src/client_server.h
src/alsa_midi.o: src/actions.h src/midi.h src/midi_menu.h src/alsa_midi.h
src/alsa_midi.o: src/message.h
src/ant_menu.o: src/new_menu.h src/ant_menu.h src/band.h src/bandstack.h
src/ant_menu.o: src/radio.h src/adc.h src/dac.h src/discovered.h
src/ant_menu.o: src/receiver.h src/transmitter.h src/new_protocol.h
src/ant_menu.o: src/MacOS.h src/soapy_protocol.h src/message.h
src/appearance.o: src/appearance.h
src/audio.o: src/radio.h src/adc.h src/dac.h src/discovered.h src/receiver.h
src/audio.o: src/transmitter.h src/audio.h src/mode.h src/vfo.h src/message.h
src/band.o: src/bandstack.h src/band.h src/filter.h src/mode.h src/property.h
src/band.o: src/mystring.h src/radio.h src/adc.h src/dac.h src/discovered.h
src/band.o: src/receiver.h src/transmitter.h src/vfo.h
src/band_menu.o: src/new_menu.h src/band_menu.h src/band.h src/bandstack.h
src/band_menu.o: src/filter.h src/mode.h src/radio.h src/adc.h src/dac.h
src/band_menu.o: src/discovered.h src/receiver.h src/transmitter.h src/vfo.h
src/band_menu.o: src/client_server.h
src/bandstack_menu.o: src/new_menu.h src/bandstack_menu.h src/band.h
src/bandstack_menu.o: src/bandstack.h src/filter.h src/mode.h src/radio.h
src/bandstack_menu.o: src/adc.h src/dac.h src/discovered.h src/receiver.h
src/bandstack_menu.o: src/transmitter.h src/vfo.h
src/client_server.o: src/discovered.h src/adc.h src/dac.h src/receiver.h
src/client_server.o: src/transmitter.h src/radio.h src/main.h src/vfo.h
src/client_server.o: src/mode.h src/client_server.h src/ext.h src/audio.h
src/client_server.o: src/zoompan.h src/noise_menu.h src/radio_menu.h
src/client_server.o: src/sliders.h src/actions.h src/message.h src/mystring.h
src/configure.o: src/radio.h src/adc.h src/dac.h src/discovered.h
src/configure.o: src/receiver.h src/transmitter.h src/main.h src/channel.h
src/configure.o: src/actions.h src/gpio.h src/i2c.h src/message.h
src/css.o: src/css.h src/message.h
src/cw_menu.o: src/new_menu.h src/pa_menu.h src/band.h src/bandstack.h
src/cw_menu.o: src/filter.h src/mode.h src/radio.h src/adc.h src/dac.h
src/cw_menu.o: src/discovered.h src/receiver.h src/transmitter.h
src/cw_menu.o: src/new_protocol.h src/MacOS.h src/old_protocol.h src/iambic.h
src/cw_menu.o: src/ext.h src/client_server.h
src/discovered.o: src/discovered.h
src/discovery.o: src/discovered.h src/old_discovery.h src/new_discovery.h
src/discovery.o: src/soapy_discovery.h src/main.h src/radio.h src/adc.h
src/discovery.o: src/dac.h src/receiver.h src/transmitter.h src/ozyio.h
src/discovery.o: src/stemlab_discovery.h src/ext.h src/client_server.h
src/discovery.o: src/gpio.h src/actions.h src/configure.h src/protocols.h
src/discovery.o: src/property.h src/mystring.h src/message.h src/saturnmain.h
src/discovery.o: src/saturnregisters.h
src/display_menu.o: src/main.h src/new_menu.h src/display_menu.h src/radio.h
src/display_menu.o: src/adc.h src/dac.h src/discovered.h src/receiver.h
src/display_menu.o: src/transmitter.h
src/diversity_menu.o: src/new_menu.h src/diversity_menu.h src/radio.h
src/diversity_menu.o: src/adc.h src/dac.h src/discovered.h src/receiver.h
src/diversity_menu.o: src/transmitter.h src/new_protocol.h src/MacOS.h
src/diversity_menu.o: src/old_protocol.h src/sliders.h src/actions.h
src/diversity_menu.o: src/ext.h src/client_server.h
src/encoder_menu.o: src/main.h src/new_menu.h src/agc_menu.h src/agc.h
src/encoder_menu.o: src/band.h src/bandstack.h src/channel.h src/radio.h
src/encoder_menu.o: src/adc.h src/dac.h src/discovered.h src/receiver.h
src/encoder_menu.o: src/transmitter.h src/vfo.h src/mode.h src/actions.h
src/encoder_menu.o: src/action_dialog.h src/gpio.h src/i2c.h
src/equalizer_menu.o: src/main.h src/new_menu.h src/equalizer_menu.h
src/equalizer_menu.o: src/radio.h src/adc.h src/dac.h src/discovered.h
src/equalizer_menu.o: src/receiver.h src/transmitter.h src/ext.h
src/equalizer_menu.o: src/client_server.h src/vfo.h src/mode.h src/message.h
src/exit_menu.o: src/main.h src/new_menu.h src/exit_menu.h src/discovery.h
src/exit_menu.o: src/radio.h src/adc.h src/dac.h src/discovered.h
src/exit_menu.o: src/receiver.h src/transmitter.h src/new_protocol.h
src/exit_menu.o: src/MacOS.h src/old_protocol.h src/soapy_protocol.h
src/exit_menu.o: src/actions.h src/gpio.h src/message.h src/saturnmain.h
src/exit_menu.o: src/saturnregisters.h
src/ext.o: src/main.h src/discovery.h src/receiver.h src/sliders.h
src/ext.o: src/transmitter.h src/actions.h src/toolbar.h src/gpio.h src/vfo.h
src/ext.o: src/mode.h src/radio.h src/adc.h src/dac.h src/discovered.h
src/ext.o: src/radio_menu.h src/new_menu.h src/noise_menu.h src/ext.h
src/ext.o: src/client_server.h src/zoompan.h src/equalizer_menu.h
src/fft_menu.o: src/new_menu.h src/fft_menu.h src/radio.h src/adc.h src/dac.h
src/fft_menu.o: src/discovered.h src/receiver.h src/transmitter.h
src/fft_menu.o: src/message.h
src/filter.o: src/sliders.h src/receiver.h src/transmitter.h src/actions.h
src/filter.o: src/filter.h src/mode.h src/vfo.h src/radio.h src/adc.h
src/filter.o: src/dac.h src/discovered.h src/property.h src/mystring.h
src/filter.o: src/message.h src/ext.h src/client_server.h
src/filter_menu.o: src/new_menu.h src/filter_menu.h src/band.h
src/filter_menu.o: src/bandstack.h src/filter.h src/mode.h src/radio.h
src/filter_menu.o: src/adc.h src/dac.h src/discovered.h src/receiver.h
src/filter_menu.o: src/transmitter.h src/vfo.h src/ext.h src/client_server.h
src/filter_menu.o: src/message.h
src/gpio.o: src/band.h src/bandstack.h src/channel.h src/discovered.h
src/gpio.o: src/mode.h src/filter.h src/toolbar.h src/gpio.h src/radio.h
src/gpio.o: src/adc.h src/dac.h src/receiver.h src/transmitter.h src/main.h
src/gpio.o: src/property.h src/mystring.h src/vfo.h src/new_menu.h
src/gpio.o: src/encoder_menu.h src/diversity_menu.h src/actions.h src/i2c.h
src/gpio.o: src/ext.h src/client_server.h src/sliders.h src/new_protocol.h
src/gpio.o: src/MacOS.h src/zoompan.h src/iambic.h src/message.h
src/hpsdrsim.o: src/MacOS.h src/hpsdrsim.h
src/i2c.o: src/i2c.h src/actions.h src/gpio.h src/band.h src/bandstack.h
src/i2c.o: src/band_menu.h src/radio.h src/adc.h src/dac.h src/discovered.h
src/i2c.o: src/receiver.h src/transmitter.h src/toolbar.h src/vfo.h
src/i2c.o: src/mode.h src/ext.h src/client_server.h src/message.h
src/iambic.o: src/main.h src/gpio.h src/radio.h src/adc.h src/dac.h
src/iambic.o: src/discovered.h src/receiver.h src/transmitter.h
src/iambic.o: src/new_protocol.h src/MacOS.h src/iambic.h src/ext.h
src/iambic.o: src/client_server.h src/mode.h src/vfo.h src/message.h
src/led.o: src/message.h
src/mac_midi.o: src/discovered.h src/receiver.h src/transmitter.h src/adc.h
src/mac_midi.o: src/dac.h src/radio.h src/actions.h src/midi.h
src/mac_midi.o: src/midi_menu.h src/alsa_midi.h src/message.h
src/main.o: src/appearance.h src/audio.h src/receiver.h src/band.h
src/main.o: src/bandstack.h src/main.h src/discovered.h src/configure.h
src/main.o: src/actions.h src/gpio.h src/new_menu.h src/radio.h src/adc.h
src/main.o: src/dac.h src/transmitter.h src/version.h src/discovery.h
src/main.o: src/new_protocol.h src/MacOS.h src/old_protocol.h
src/main.o: src/soapy_protocol.h src/ext.h src/client_server.h src/vfo.h
src/main.o: src/mode.h src/css.h src/exit_menu.h src/message.h src/mystring.h
src/main.o: src/startup.h src/tts.h
src/meter.o: src/appearance.h src/band.h src/bandstack.h src/receiver.h
src/meter.o: src/meter.h src/radio.h src/adc.h src/dac.h src/discovered.h
src/meter.o: src/transmitter.h src/version.h src/mode.h src/vox.h
src/meter.o: src/new_menu.h src/vfo.h src/message.h
src/meter_menu.o: src/new_menu.h src/receiver.h src/meter_menu.h src/meter.h
src/meter_menu.o: src/radio.h src/adc.h src/dac.h src/discovered.h
src/meter_menu.o: src/transmitter.h
src/midi2.o: src/MacOS.h src/receiver.h src/discovered.h src/adc.h src/dac.h
src/midi2.o: src/transmitter.h src/radio.h src/main.h src/actions.h
src/midi2.o: src/midi.h src/alsa_midi.h src/message.h
src/midi3.o: src/actions.h src/message.h src/midi.h
src/midi_menu.o: src/main.h src/discovered.h src/mode.h src/filter.h
src/midi_menu.o: src/band.h src/bandstack.h src/receiver.h src/transmitter.h
src/midi_menu.o: src/adc.h src/dac.h src/radio.h src/actions.h
src/midi_menu.o: src/action_dialog.h src/midi.h src/alsa_midi.h
src/midi_menu.o: src/new_menu.h src/midi_menu.h src/property.h src/mystring.h
src/midi_menu.o: src/message.h
src/mode_menu.o: src/new_menu.h src/band_menu.h src/band.h src/bandstack.h
src/mode_menu.o: src/filter.h src/mode.h src/radio.h src/adc.h src/dac.h
src/mode_menu.o: src/discovered.h src/receiver.h src/transmitter.h src/vfo.h
src/new_discovery.o: src/discovered.h src/discovery.h src/message.h
src/new_discovery.o: src/mystring.h
src/new_menu.o: src/audio.h src/receiver.h src/new_menu.h src/about_menu.h
src/new_menu.o: src/exit_menu.h src/radio_menu.h src/rx_menu.h src/ant_menu.h
src/new_menu.o: src/display_menu.h src/pa_menu.h src/rigctl_menu.h
src/new_menu.o: src/oc_menu.h src/cw_menu.h src/store_menu.h src/xvtr_menu.h
src/new_menu.o: src/equalizer_menu.h src/radio.h src/adc.h src/dac.h
src/new_menu.o: src/discovered.h src/transmitter.h src/meter_menu.h
src/new_menu.o: src/band_menu.h src/bandstack_menu.h src/mode_menu.h