@@ -11,10 +11,14 @@ all : $(APPS) direwolf.desktop direwolf.conf
11
11
@echo " sudo make install"
12
12
@echo " "
13
13
14
- CC := gcc
15
- CFLAGS := -O3 -pthread -Igeotranz
14
+ free := $(shell uname | grep FreeBSD)
16
15
17
- LDFLAGS := -lm -lpthread -lrt
16
+ PREFIX ?= /usr
17
+
18
+ CC ?= gcc
19
+ CFLAGS ?= -O3 -pthread -Igeotranz
20
+
21
+ LDFLAGS ?= -lm -lpthread -lrt
18
22
19
23
20
24
@@ -70,7 +74,7 @@ LDFLAGS := -lm -lpthread -lrt
70
74
# If the compiler is generating code for the i386 target, we can
71
75
# get much better results by telling it we have at least a Pentium 3.
72
76
73
- arch := $(shell echo | gcc -E -dM - | grep __i386__)
77
+ arch := $(shell echo | ${CC} -E -dM - | grep __i386__)
74
78
ifneq ($(arch),)
75
79
CFLAGS += -march=pentium3
76
80
endif
@@ -108,7 +112,7 @@ endif
108
112
109
113
# Add -ffastmath in only if compiler version recognizes it.
110
114
111
- useffast := $(shell gcc --help -v 2>/dev/null | grep ffast-math)
115
+ useffast := $(shell ${CC} --help -v 2>/dev/null | grep ffast-math)
112
116
ifneq ($(useffast),)
113
117
CFLAGS += -ffast-math
114
118
endif
@@ -171,7 +175,12 @@ endif
171
175
# and the compiler target defaults.
172
176
#
173
177
178
+ ifneq (${free},FreeBSD)
174
179
neon := $(shell cat /proc/cpuinfo | grep neon)
180
+ else
181
+ neon := ${NEON}
182
+ endif
183
+
175
184
ifneq ($(neon),)
176
185
CFLAGS += -mfpu=neon
177
186
endif
@@ -205,7 +214,7 @@ LDFLAGS += -lasound
205
214
# Finding libgps.so* is more difficult because it
206
215
# is in different places on different operating systems.
207
216
208
- enable_gpsd := $(wildcard /usr /include/gps.h)
217
+ enable_gpsd := $(wildcard ${PREFIX} /include/gps.h)
209
218
ifneq ($(enable_gpsd),)
210
219
CFLAGS += -DENABLE_GPSD
211
220
LDFLAGS += -lgps
@@ -420,11 +429,15 @@ direwolf.conf : generic.conf
420
429
# This is a step in the right direction but not sufficient to use /usr instead.
421
430
# Eventually I'd like to have targets here to build the .DEB and .RPM packages.
422
431
423
- INSTALLDIR : = /usr/local
432
+ DESTDIR ? = /usr/local
424
433
425
434
# Command to "install" to system directories. Use "ginstall" for Mac.
426
435
427
- INSTALL=install
436
+ INSTALL ?= install
437
+ INSTALL_PROGRAM ?= ${INSTALL}
438
+ INSTALL_SCRIPT ?= ${INSTALL}
439
+ INSTALL_DATA ?= ${INSTALL} -D --mode=644
440
+ INSTALL_MAN ?= ${INSTALL_DATA}
428
441
429
442
# direwolf.desktop was previously handcrafted for the Raspberry Pi.
430
443
# It was hardcoded with lxterminal, /home/pi, and so on.
@@ -437,16 +450,16 @@ direwolf.desktop :
437
450
@echo "Generating customized direwolf.desktop ..."
438
451
@echo '[Desktop Entry]' > $@
439
452
@echo 'Type=Application' >> $@
440
- ifneq ($(wildcard /usr /bin/lxterminal),)
441
- @echo "Exec=lxterminal -t \"Dire Wolf\" -e \"$(INSTALLDIR )/bin/direwolf\"" >> $@
442
- else ifneq ($(wildcard /usr /bin/lxterm),)
443
- @echo "Exec=lxterm -hold -title \"Dire Wolf\" -bg white -e \"$(INSTALLDIR )/bin/direwolf\"" >> $@
453
+ ifneq ($(wildcard ${PREFIX} /bin/lxterminal),)
454
+ @echo "Exec=lxterminal -t \"Dire Wolf\" -e \"$(DESTDIR )/bin/direwolf\"" >> $@
455
+ else ifneq ($(wildcard ${PREFIX} /bin/lxterm),)
456
+ @echo "Exec=lxterm -hold -title \"Dire Wolf\" -bg white -e \"$(DESTDIR )/bin/direwolf\"" >> $@
444
457
else
445
- @echo "Exec=xterm -hold -title \"Dire Wolf\" -bg white -e \"$(INSTALLDIR )/bin/direwolf\"" >> $@
458
+ @echo "Exec=xterm -hold -title \"Dire Wolf\" -bg white -e \"$(DESTDIR )/bin/direwolf\"" >> $@
446
459
endif
447
460
@echo 'Name=Dire Wolf' >> $@
448
461
@echo 'Comment=APRS Soundcard TNC' >> $@
449
- @echo 'Icon=/usr /share/direwolf/dw-icon.png' >> $@
462
+ @echo 'Icon=${PREFIX} /share/direwolf/dw-icon.png' >> $@
450
463
@echo "Path=$(HOME)" >> $@
451
464
@echo '#Terminal=true' >> $@
452
465
@echo 'Categories=HamRadio' >> $@
@@ -463,83 +476,83 @@ install : $(APPS) direwolf.conf tocalls.txt symbols-new.txt symbolsX.txt dw-icon
463
476
# Applications, not installed with package manager, normally go in /usr/local/bin.
464
477
# /usr/bin is used instead when installing from .DEB or .RPM package.
465
478
#
466
- $(INSTALL ) direwolf $(INSTALLDIR )/bin
467
- $(INSTALL ) decode_aprs $(INSTALLDIR )/bin
468
- $(INSTALL ) text2tt $(INSTALLDIR )/bin
469
- $(INSTALL ) tt2text $(INSTALLDIR )/bin
470
- $(INSTALL ) ll2utm $(INSTALLDIR )/bin
471
- $(INSTALL ) utm2ll $(INSTALLDIR )/bin
472
- $(INSTALL ) aclients $(INSTALLDIR )/bin
473
- $(INSTALL ) log2gpx $(INSTALLDIR )/bin
474
- $(INSTALL ) gen_packets $(INSTALLDIR )/bin
475
- $(INSTALL ) atest $(INSTALLDIR )/bin
476
- $(INSTALL ) ttcalc $(INSTALLDIR )/bin
477
- $(INSTALL ) dwespeak.sh $(INSTALLDIR )/bin
479
+ $(INSTALL_PROGRAM ) direwolf $(DESTDIR )/bin
480
+ $(INSTALL_PROGRAM ) decode_aprs $(DESTDIR )/bin
481
+ $(INSTALL_PROGRAM ) text2tt $(DESTDIR )/bin
482
+ $(INSTALL_PROGRAM ) tt2text $(DESTDIR )/bin
483
+ $(INSTALL_PROGRAM ) ll2utm $(DESTDIR )/bin
484
+ $(INSTALL_PROGRAM ) utm2ll $(DESTDIR )/bin
485
+ $(INSTALL_PROGRAM ) aclients $(DESTDIR )/bin
486
+ $(INSTALL_PROGRAM ) log2gpx $(DESTDIR )/bin
487
+ $(INSTALL_PROGRAM ) gen_packets $(DESTDIR )/bin
488
+ $(INSTALL_PROGRAM ) atest $(DESTDIR )/bin
489
+ $(INSTALL_PROGRAM ) ttcalc $(DESTDIR )/bin
490
+ $(INSTALL_PROGRAM ) dwespeak.sh $(DESTDIR )/bin
478
491
#
479
492
# Telemetry Toolkit executables. Other .conf and .txt files will go into doc directory.
480
493
#
481
- $(INSTALL ) telemetry-toolkit/telem-balloon.pl $(INSTALLDIR )/bin
482
- $(INSTALL ) telemetry-toolkit/telem-bits.pl $(INSTALLDIR )/bin
483
- $(INSTALL ) telemetry-toolkit/telem-data.pl $(INSTALLDIR )/bin
484
- $(INSTALL ) telemetry-toolkit/telem-data91.pl $(INSTALLDIR )/bin
485
- $(INSTALL ) telemetry-toolkit/telem-eqns.pl $(INSTALLDIR )/bin
486
- $(INSTALL ) telemetry-toolkit/telem-parm.pl $(INSTALLDIR )/bin
487
- $(INSTALL ) telemetry-toolkit/telem-seq.sh $(INSTALLDIR )/bin
488
- $(INSTALL ) telemetry-toolkit/telem-unit.pl $(INSTALLDIR )/bin
489
- $(INSTALL ) telemetry-toolkit/telem-volts.py $(INSTALLDIR )/bin
494
+ $(INSTALL_SCRIPT ) telemetry-toolkit/telem-balloon.pl $(DESTDIR )/bin
495
+ $(INSTALL_SCRIPT ) telemetry-toolkit/telem-bits.pl $(DESTDIR )/bin
496
+ $(INSTALL_SCRIPT ) telemetry-toolkit/telem-data.pl $(DESTDIR )/bin
497
+ $(INSTALL_SCRIPT ) telemetry-toolkit/telem-data91.pl $(DESTDIR )/bin
498
+ $(INSTALL_SCRIPT ) telemetry-toolkit/telem-eqns.pl $(DESTDIR )/bin
499
+ $(INSTALL_SCRIPT ) telemetry-toolkit/telem-parm.pl $(DESTDIR )/bin
500
+ $(INSTALL_SCRIPT ) telemetry-toolkit/telem-seq.sh $(DESTDIR )/bin
501
+ $(INSTALL_SCRIPT ) telemetry-toolkit/telem-unit.pl $(DESTDIR )/bin
502
+ $(INSTALL_SCRIPT ) telemetry-toolkit/telem-volts.py $(DESTDIR )/bin
490
503
#
491
504
# Misc. data such as "tocall" to system mapping.
492
505
#
493
- $(INSTALL) -D --mode=644 tocalls.txt /usr/share/direwolf/tocalls.txt
494
- $(INSTALL) -D --mode=644 symbols-new.txt /usr/share/direwolf/symbols-new.txt
495
- $(INSTALL) -D --mode=644 symbolsX.txt /usr/share/direwolf/symbolsX.txt
496
- $(INSTALL) -D --mode=644 dw-icon.png /usr/share/direwolf/dw-icon.png
497
- $(INSTALL) -D --mode=644 direwolf.desktop /usr/share/applications/direwolf.desktop
506
+ $(INSTALL_DATA) tocalls.txt /usr/share/direwolf/tocalls.txt
507
+ $(INSTALL_DATA) symbols-new.txt /usr/share/direwolf/symbols-new.txt
508
+ $(INSTALL_DATA) symbolsX.txt /usr/share/direwolf/symbolsX.txt
509
+ $(INSTALL_DATA) dw-icon.png /usr/share/direwolf/dw-icon.png
510
+ $(INSTALL_DATA) direwolf.desktop /usr/share/applications/direwolf.desktop
498
511
#
499
512
# Documentation. Various plain text files and PDF.
500
513
#
501
- $(INSTALL) -D --mode=644 CHANGES.md $(INSTALLDIR )/share/doc/direwolf/CHANGES.md
502
- $(INSTALL) -D --mode=644 LICENSE-dire-wolf.txt $(INSTALLDIR )/share/doc/direwolf/LICENSE-dire-wolf.txt
503
- $(INSTALL) -D --mode=644 LICENSE-other.txt $(INSTALLDIR )/share/doc/direwolf/LICENSE-other.txt
514
+ $(INSTALL_DATA) CHANGES.md $(DESTDIR )/share/doc/direwolf/CHANGES.md
515
+ $(INSTALL_DATA) LICENSE-dire-wolf.txt $(DESTDIR )/share/doc/direwolf/LICENSE-dire-wolf.txt
516
+ $(INSTALL_DATA) LICENSE-other.txt $(DESTDIR )/share/doc/direwolf/LICENSE-other.txt
504
517
#
505
518
# ./README.md is an overview for the project main page.
506
519
# doc/README.md contains an overview of the PDF file contents and is more useful here.
507
520
#
508
- $(INSTALL) -D --mode=644 doc/README.md $(INSTALLDIR )/share/doc/direwolf/README.md
509
- $(INSTALL) -D --mode=644 doc/User-Guide.pdf $(INSTALLDIR )/share/doc/direwolf/User-Guide.pdf
510
- $(INSTALL) -D --mode=644 doc/Raspberry-Pi-APRS.pdf $(INSTALLDIR )/share/doc/direwolf/Raspberry-Pi-APRS.pdf
511
- $(INSTALL) -D --mode=644 doc/Raspberry-Pi-APRS-Tracker.pdf $(INSTALLDIR )/share/doc/direwolf/Raspberry-Pi-APRS-Tracker.pdf
512
- $(INSTALL) -D --mode=644 doc/Raspberry-Pi-SDR-IGate.pdf $(INSTALLDIR )/share/doc/direwolf/Raspberry-Pi-SDR-IGate.pdf
513
- $(INSTALL) -D --mode=644 doc/APRStt-Implementation-Notes.pdf $(INSTALLDIR )/share/doc/direwolf/APRStt-Implementation-Notes.pdf
514
- $(INSTALL) -D --mode=644 doc/APRStt-interface-for-SARTrack.pdf $(INSTALLDIR )/share/doc/direwolf/APRStt-interface-for-SARTrack.pdf
515
- $(INSTALL) -D --mode=644 doc/APRS-Telemetry-Toolkit.pdf $(INSTALLDIR )/share/doc/direwolf/APRS-Telemetry-Toolkit.pdf
516
- $(INSTALL) -D --mode=644 doc/A-Better-APRS-Packet-Demodulator-Part-1-1200-baud.pdf $(INSTALLDIR )/share/doc/direwolf/A-Better-APRS-Packet-Demodulator-Part-1-1200-baud.pdf
517
- $(INSTALL) -D --mode=644 doc/A-Better-APRS-Packet-Demodulator-Part-2-9600-baud.pdf $(INSTALLDIR )/share/doc/direwolf/A-Better-APRS-Packet-Demodulator-Part-2-9600-baud.pdf
521
+ $(INSTALL_DATA) doc/README.md $(DESTDIR )/share/doc/direwolf/README.md
522
+ $(INSTALL_DATA) doc/User-Guide.pdf $(DESTDIR )/share/doc/direwolf/User-Guide.pdf
523
+ $(INSTALL_DATA) doc/Raspberry-Pi-APRS.pdf $(DESTDIR )/share/doc/direwolf/Raspberry-Pi-APRS.pdf
524
+ $(INSTALL_DATA) doc/Raspberry-Pi-APRS-Tracker.pdf $(DESTDIR )/share/doc/direwolf/Raspberry-Pi-APRS-Tracker.pdf
525
+ $(INSTALL_DATA) doc/Raspberry-Pi-SDR-IGate.pdf $(DESTDIR )/share/doc/direwolf/Raspberry-Pi-SDR-IGate.pdf
526
+ $(INSTALL_DATA) doc/APRStt-Implementation-Notes.pdf $(DESTDIR )/share/doc/direwolf/APRStt-Implementation-Notes.pdf
527
+ $(INSTALL_DATA) doc/APRStt-interface-for-SARTrack.pdf $(DESTDIR )/share/doc/direwolf/APRStt-interface-for-SARTrack.pdf
528
+ $(INSTALL_DATA) doc/APRS-Telemetry-Toolkit.pdf $(DESTDIR )/share/doc/direwolf/APRS-Telemetry-Toolkit.pdf
529
+ $(INSTALL_DATA) doc/A-Better-APRS-Packet-Demodulator-Part-1-1200-baud.pdf $(DESTDIR )/share/doc/direwolf/A-Better-APRS-Packet-Demodulator-Part-1-1200-baud.pdf
530
+ $(INSTALL_DATA) doc/A-Better-APRS-Packet-Demodulator-Part-2-9600-baud.pdf $(DESTDIR )/share/doc/direwolf/A-Better-APRS-Packet-Demodulator-Part-2-9600-baud.pdf
518
531
#
519
532
# Various sample config and other files go into examples under the doc directory.
520
533
# When building from source, these can be put in home directory with "make install-conf".
521
534
# When installed from .DEB or .RPM package, the user will need to copy these to
522
535
# the home directory or other desired location.
523
536
#
524
- $(INSTALL) -D --mode=644 direwolf.conf $(INSTALLDIR )/share/doc/direwolf/examples/direwolf.conf
525
- $(INSTALL) -D --mode=644 dw-start.sh $(INSTALLDIR )/share/doc/direwolf/examples/dw-start.sh
526
- $(INSTALL) -D --mode=644 sdr.conf $(INSTALLDIR )/share/doc/direwolf/examples/sdr.conf
527
- $(INSTALL) -D --mode=644 telemetry-toolkit/telem-m0xer-3.txt $(INSTALLDIR )/share/doc/direwolf/examples/telem-m0xer-3.txt
528
- $(INSTALL) -D --mode=644 telemetry-toolkit/telem-balloon.conf $(INSTALLDIR )/share/doc/direwolf/examples/telem-balloon.conf
529
- $(INSTALL) -D --mode=644 telemetry-toolkit/telem-volts.conf $(INSTALLDIR )/share/doc/direwolf/examples/telem-volts.conf
537
+ $(INSTALL_DATA) direwolf.conf $(DESTDIR )/share/doc/direwolf/examples/direwolf.conf
538
+ $(INSTALL_SCRIPT) dw-start.sh $(DESTDIR )/share/doc/direwolf/examples/dw-start.sh
539
+ $(INSTALL_DATA) sdr.conf $(DESTDIR )/share/doc/direwolf/examples/sdr.conf
540
+ $(INSTALL_DATA) telemetry-toolkit/telem-m0xer-3.txt $(DESTDIR )/share/doc/direwolf/examples/telem-m0xer-3.txt
541
+ $(INSTALL_DATA) telemetry-toolkit/telem-balloon.conf $(DESTDIR )/share/doc/direwolf/examples/telem-balloon.conf
542
+ $(INSTALL_DATA) telemetry-toolkit/telem-volts.conf $(DESTDIR )/share/doc/direwolf/examples/telem-volts.conf
530
543
#
531
544
# "man" pages
532
545
#
533
- $(INSTALL) -D --mode=644 man1/aclients.1 $(INSTALLDIR )/man/man1/aclients.1
534
- $(INSTALL) -D --mode=644 man1/atest.1 $(INSTALLDIR )/man/man1/atest.1
535
- $(INSTALL) -D --mode=644 man1/decode_aprs.1 $(INSTALLDIR )/man/man1/decode_aprs.1
536
- $(INSTALL) -D --mode=644 man1/direwolf.1 $(INSTALLDIR )/man/man1/direwolf.1
537
- $(INSTALL) -D --mode=644 man1/gen_packets.1 $(INSTALLDIR )/man/man1/gen_packets.1
538
- $(INSTALL) -D --mode=644 man1/ll2utm.1 $(INSTALLDIR )/man/man1/ll2utm.1
539
- $(INSTALL) -D --mode=644 man1/log2gpx.1 $(INSTALLDIR )/man/man1/log2gpx.1
540
- $(INSTALL) -D --mode=644 man1/text2tt.1 $(INSTALLDIR )/man/man1/text2tt.1
541
- $(INSTALL) -D --mode=644 man1/tt2text.1 $(INSTALLDIR )/man/man1/tt2text.1
542
- $(INSTALL) -D --mode=644 man1/utm2ll.1 $(INSTALLDIR )/man/man1/utm2ll.1
546
+ $(INSTALL_DATA) man1/aclients.1 $(DESTDIR )/man/man1/aclients.1
547
+ $(INSTALL_DATA) man1/atest.1 $(DESTDIR )/man/man1/atest.1
548
+ $(INSTALL_DATA) man1/decode_aprs.1 $(DESTDIR )/man/man1/decode_aprs.1
549
+ $(INSTALL_DATA) man1/direwolf.1 $(DESTDIR )/man/man1/direwolf.1
550
+ $(INSTALL_DATA) man1/gen_packets.1 $(DESTDIR )/man/man1/gen_packets.1
551
+ $(INSTALL_DATA) man1/ll2utm.1 $(DESTDIR )/man/man1/ll2utm.1
552
+ $(INSTALL_DATA) man1/log2gpx.1 $(DESTDIR )/man/man1/log2gpx.1
553
+ $(INSTALL_DATA) man1/text2tt.1 $(DESTDIR )/man/man1/text2tt.1
554
+ $(INSTALL_DATA) man1/tt2text.1 $(DESTDIR )/man/man1/tt2text.1
555
+ $(INSTALL_DATA) man1/utm2ll.1 $(DESTDIR )/man/man1/utm2ll.1
543
556
#
544
557
@echo " "
545
558
@echo "If this is your first install, not an upgrade, type this to put a copy"
@@ -574,7 +587,7 @@ endif
574
587
.PHONY: install-rpi
575
588
install-rpi : dw-start.sh
576
589
cp dw-start.sh ~
577
- ln -f -s /usr /share/applications/direwolf.desktop ~/Desktop/direwolf.desktop
590
+ ln -f -s ${PREFIX} /share/applications/direwolf.desktop ~/Desktop/direwolf.desktop
578
591
579
592
580
593
0 commit comments