forked from jvde-github/AIS-catcher
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
152 lines (117 loc) · 5.23 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
SRC = Ships/Ships.cpp Library/N2K.cpp IO/N2KInterface.cpp Device/N2KsktCAN.cpp IO/N2KStream.cpp Application/Prometheus.cpp Application/Main.cpp Application/WebViewer.cpp IO/HTTPClient.cpp DBMS/PostgreSQL.cpp Ships/DB.cpp Application/Config.cpp Application/Receiver.cpp IO/IO.cpp IO/HTTPServer.cpp DSP/DSP.cpp Library/JSONAIS.cpp JSON/Parser.cpp JSON/StringBuilder.cpp Library/Keys.cpp Library/AIS.cpp IO/Network.cpp DSP/Model.cpp Library/NMEA.cpp Library/Utilities.cpp DSP/Demod.cpp Library/Message.cpp Device/UDP.cpp Device/ZMQ.cpp Device/RTLSDR.cpp Device/AIRSPYHF.cpp Device/SoapySDR.cpp Device/AIRSPY.cpp Device/FileRAW.cpp Device/FileWAV.cpp Device/SDRPLAY.cpp Device/RTLTCP.cpp Device/HACKRF.cpp Device/Serial.cpp Library/TCP.cpp Device/SpyServer.cpp JSON/JSON.cpp
OBJ = Ships.o Main.o N2KStream.o N2K.o N2KInterface.o N2KsktCAN.o Prometheus.o Receiver.o Config.o WebViewer.o HTTPClient.o PostgreSQL.o DB.o IO.o DSP.o AIS.o Model.o Utilities.o Network.o Demod.o Serial.o RTLSDR.o HTTPServer.o AIRSPYHF.o Keys.o AIRSPY.o Parser.o StringBuilder.o FileRAW.o FileWAV.o SDRPLAY.o NMEA.o RTLTCP.o HACKRF.o ZMQ.o UDP.o SoapySDR.o TCP.o Message.o SpyServer.o JSON.o JSONAIS.o
INCLUDE = -I. -IDBMS/ -IShips/ -ILibrary/ -IDSP/ -IApplication/ -IIO/
CC = gcc
override CFLAGS += -Wall -Ofast -std=c++11 $(INCLUDE)
override LFLAGS += -lstdc++ -lpthread -lm -o AIS-catcher
CFLAGS_RTL = -DHASRTLSDR $(shell pkg-config --cflags librtlsdr)
CFLAGS_AIRSPYHF = -DHASAIRSPYHF $(shell pkg-config --cflags libairspyhf)
CFLAGS_AIRSPY = -DHASAIRSPY $(shell pkg-config --cflags libairspy)
CFLAGS_SDRPLAY = -DHASSDRPLAY
CFLAGS_HACKRF = -DHASHACKRF $(shell pkg-config --cflags libhackrf) -I /usr/include/libhackrf/
CFLAGS_ZMQ = -DHASZMQ $(shell pkg-config --cflags libzmq)
CFLAGS_SOXR = -DHASSOXR $(shell pkg-config --cflags soxr)
CFLAGS_SAMPLERATE = -DHASSAMPLERATE $(shell pkg-config --cflags samplerate)
CFLAGS_CURL = -DHASCURL $(shell pkg-config --cflags libcurl)
CFLAGS_SSL = -DHASOPENSSL $(shell pkg-config --cflags openssl)
CFLAGS_SOAPYSDR = -DHASSOAPYSDR
CFLAGS_ZLIB = -DHASZLIB ${shell pkg-config --cflags zlib}
CFLAGS_PSQL = -DHASPSQL ${shell pkg-config --cflags libpq}
LFLAGS_RTL = $(shell pkg-config --libs-only-l librtlsdr)
LFLAGS_AIRSPYHF = $(shell pkg-config --libs libairspyhf)
LFLAGS_AIRSPY = $(shell pkg-config --libs libairspy)
LFLAGS_SDRPLAY = -lsdrplay_api
LFLAGS_HACKRF = $(shell pkg-config --libs libhackrf)
LFLAGS_ZMQ = $(shell pkg-config --libs libzmq)
LFLAGS_SOXR = $(shell pkg-config --libs soxr)
LFLAGS_SAMPLERATE = $(shell pkg-config --libs samplerate)
LFLAGS_SOAPYSDR = -lSoapySDR
LFLAGS_CURL =$(shell pkg-config --libs libcurl)
LFLAGS_SSL =$(shell pkg-config --libs openssl)
LFLAGS_ZLIB =$(shell pkg-config --libs zlib)
LFLAGS_PSQL =$(shell pkg-config --libs libpq)
CFLAGS_ALL =
LFLAGS_ALL =
ifneq ($(shell pkg-config --exists soxr && echo 'T'),)
CFLAGS_ALL += $(CFLAGS_SOXR)
LFLAGS_ALL += $(LFLAGS_SOXR)
endif
ifneq ($(shell pkg-config --exists samplerate && echo 'T'),)
CFLAGS_ALL += $(CFLAGS_SAMPLERATE)
LFLAGS_ALL += $(LFLAGS_SAMPLERATE)
endif
ifneq ($(shell pkg-config --exists librtlsdr && echo 'T'),)
CFLAGS_ALL += $(CFLAGS_RTL)
LFLAGS_ALL += $(LFLAGS_RTL)
endif
ifneq ($(shell pkg-config --exists libhackrf && echo 'T'),)
CFLAGS_ALL += $(CFLAGS_HACKRF)
LFLAGS_ALL += $(LFLAGS_HACKRF)
endif
ifneq ($(shell pkg-config --exists libairspy && echo 'T'),)
CFLAGS_ALL += $(CFLAGS_AIRSPY)
LFLAGS_ALL += $(LFLAGS_AIRSPY)
endif
ifneq ($(shell pkg-config --exists libairspyhf && echo 'T'),)
CFLAGS_ALL += $(CFLAGS_AIRSPYHF)
LFLAGS_ALL += $(LFLAGS_AIRSPYHF)
endif
ifneq ($(shell pkg-config --exists libzmq && echo 'T'),)
CFLAGS_ALL += $(CFLAGS_ZMQ)
LFLAGS_ALL += $(LFLAGS_ZMQ)
endif
ifneq ($(shell pkg-config --exists libcurl && echo 'T'),)
CFLAGS_ALL += $(CFLAGS_CURL)
LFLAGS_ALL += $(LFLAGS_CURL)
endif
ifneq ($(shell pkg-config --exists zlib && echo 'T'),)
CFLAGS_ALL += $(CFLAGS_ZLIB)
LFLAGS_ALL += $(LFLAGS_ZLIB)
endif
ifneq ($(shell pkg-config --exists libpq && echo 'T'),)
CFLAGS_ALL += $(CFLAGS_PSQL)
LFLAGS_ALL += $(LFLAGS_PSQL)
endif
ifneq ($(shell pkg-config --exists openssl && echo 'T'),)
CFLAGS_ALL += $(CFLAGS_SSL)
LFLAGS_ALL += $(LFLAGS_SSL)
endif
# Building AIS-Catcher
all: lib
$(CC) $(OBJ) $(LFLAGS) $(LFLAGS_ALL)
rtl-only: lib-rtl
$(CC) $(OBJ) $(LFLAGS) $(LFLAGS_RTL)
airspyhf-only: lib-airspyhf
$(CC) $(OBJ) $(LFLAGS) $(LFLAGS_AIRSPYHF)
airspy-only: lib-airspy
$(CC) $(OBJ) $(LFLAGS) $(LFLAGS_AIRSPY)
sdrplay-only: lib-sdrplay
$(CC) $(OBJ) $(LFLAGS) $(LFLAGS_SDRPLAY)
hackrf-only: lib-hackrf
$(CC) $(OBJ) $(LFLAGS) $(LFLAGS_HACKRF)
zmq-only: lib-zmq
$(CC) $(OBJ) $(LFLAGS) $(LFLAGS_ZMQ)
soapysdr-only: lib-soapysdr
$(CC) $(OBJ) $(LFLAGS) $(LFLAGS_SOAPYSDR)
# Creating object-files
lib:
$(CC) -c $(SRC) $(CFLAGS) $(CFLAGS_ALL)
lib-rtl:
$(CC) -c $(SRC) $(CFLAGS) $(CFLAGS_RTL)
lib-airspyhf:
$(CC) -c $(SRC) $(CFLAGS) $(CFLAGS_AIRSPYHF)
lib-airspy:
$(CC) -c $(SRC) $(CFLAGS) $(CFLAGS_AIRSPY)
lib-sdrplay:
$(CC) -c $(SRC) $(CFLAGS) $(CFLAGS_SDRPLAY)
lib-hackrf:
$(CC) -c $(SRC) $(CFLAGS) $(CFLAGS_HACKRF)
lib-zmq:
$(CC) -c $(SRC) $(CFLAGS) $(CFLAGS_ZMQ)
lib-soapysdr:
$(CC) -c $(SRC) $(CFLAGS) $(CFLAGS_SOAPYSDR)
clean:
rm *.o
rm AIS-catcher
install:
cp AIS-catcher /usr/local/bin/AIS-catcher