forked from cyoung/stratux
-
-
Notifications
You must be signed in to change notification settings - Fork 66
/
Makefile
115 lines (89 loc) · 3.31 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
export STRATUX_HOME := /opt/stratux/
ifeq "$(CIRCLECI)" "true"
BUILDINFO=
PLATFORMDEPENDENT=
else
LFLAGS=-X main.stratuxVersion=`git describe --tags --abbrev=0` -X main.stratuxBuild=`git log -n 1 --pretty=%H`
BUILDINFO=-ldflags "$(LFLAGS)"
BUILDINFO_STATIC=-ldflags "-extldflags -static $(LFLAGS)"
PLATFORMDEPENDENT=fancontrol
endif
ifeq ($(debug),true)
BUILDINFO := -gcflags '-N -l' $(BUILDINFO)
endif
ARCH=$(shell arch)
ifeq ($(ARCH),aarch64)
OGN_RX_BINARY=ogn/ogn-rx-eu_aarch64
else ifeq ($(ARCH),x86_64)
OGN_RX_BINARY=ogn/ogn-rx-eu_x86
else
OGN_RX_BINARY=ogn/ogn-rx-eu_arm
endif
all: libdump978.so xdump1090 xrtlais gen_gdl90 $(PLATFORMDEPENDENT)
gen_gdl90: main/*.go common/*.go libdump978.so
LIBRARY_PATH=$(CURDIR) CGO_CFLAGS_ALLOW="-L$(CURDIR)" go build $(BUILDINFO) -o gen_gdl90 -p 4 ./main/
fancontrol: fancontrol_main/*.go common/*.go
go build $(BUILDINFO) -o fancontrol -p 4 ./fancontrol_main/
xdump1090:
git submodule update --init dump1090
cd dump1090 && make BLADERF=no
libdump978.so: dump978/*.c dump978/*.h
cd dump978 && make lib
xrtlais:
git submodule update --init rtl-ais
cd rtl-ais && sed -i 's/^LDFLAGS+=-lpthread.*/LDFLAGS+=-lpthread -lm -lrtlsdr -L \/usr\/lib\//' Makefile && make
.PHONY: test
test:
make -C test
www:
make -C web
ogn/ddb.json:
cd ogn && ./fetch_ddb.sh
optinstall: www ogn/ddb.json
mkdir -p $(STRATUX_HOME)/bin
mkdir -p $(STRATUX_HOME)/www
mkdir -p $(STRATUX_HOME)/ogn
mkdir -p $(STRATUX_HOME)/softrf
mkdir -p $(STRATUX_HOME)/cfg
mkdir -p $(STRATUX_HOME)/lib
mkdir -p $(STRATUX_HOME)/mapdata
chmod a+rwx $(STRATUX_HOME)/mapdata # so users can upload their stuff as user pi
# binaries
cp -f gen_gdl90 $(STRATUX_HOME)/bin/
cp -f fancontrol $(STRATUX_HOME)/bin/
cp -f dump1090/dump1090 $(STRATUX_HOME)/bin
cp -f rtl-ais/rtl_ais $(STRATUX_HOME)/bin
cp -f $(OGN_RX_BINARY) $(STRATUX_HOME)/bin/ogn-rx-eu
chmod +x $(STRATUX_HOME)/bin/*
# Libs
cp -f libdump978.so $(STRATUX_HOME)/lib/
# map data
cp -ru mapdata/* $(STRATUX_HOME)/mapdata/
# OGN stuff
cp -f ogn/ddb.json ogn/*ogn-tracker-bin-*.zip ogn/install-ogntracker-firmware-pi.sh ogn/fetch_ddb.sh $(STRATUX_HOME)/ogn
cp -f softrf/*.zip softrf/*.sh $(STRATUX_HOME)/softrf
# Scripts
cp __opt__stratux__bin__stratux-pre-start.sh $(STRATUX_HOME)/bin/stratux-pre-start.sh
chmod 744 $(STRATUX_HOME)/bin/stratux-pre-start.sh
cp -f image/stratux-wifi.sh $(STRATUX_HOME)/bin/
cp -f image/sdr-tool.sh $(STRATUX_HOME)/bin/
chmod 755 $(STRATUX_HOME)/bin/*
# Config templates
cp -f image/stratux-dnsmasq.conf.template $(STRATUX_HOME)/cfg/
cp -f image/interfaces.template $(STRATUX_HOME)/cfg/
cp -f image/wpa_supplicant.conf.template $(STRATUX_HOME)/cfg/
cp -f image/wpa_supplicant_ap.conf.template $(STRATUX_HOME)/cfg/
install: optinstall
-$(STRATUX_HOME)/bin/fancontrol remove
$(STRATUX_HOME)/bin/fancontrol install
# System configuration
cp image/10-stratux.rules /etc/udev/rules.d/10-stratux.rules
cp image/99-uavionix.rules /etc/udev/rules.d/99-uavionix.rules
cp __lib__systemd__system__stratux.service /lib/systemd/system/stratux.service
chmod 644 /lib/systemd/system/stratux.service
ln -fs /lib/systemd/system/stratux.service /etc/systemd/system/multi-user.target.wants/stratux.service
clean:
rm -f gen_gdl90 libdump978.so fancontrol ahrs_approx
cd dump1090 && make clean
cd dump978 && make clean
cd rtl-ais && make clean