-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
75 lines (62 loc) · 2.08 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
# Copyright (c) 2017 by Thomas A. Early N7TAE
# Copyright (c) 2019-2020 by Geoffrey Merck F4FXL - KC3FRA
# if you change these locations, make sure paths en with /
BINDIR=/usr/local/bin/
CFGDIR=/usr/local/etc/sgs-xl/
DATADIR=/usr/local/sgs-xl/data/
# choose this if you want debugging help
# CPPFLAGS=-g -ggdb -W -Wall -std=c++17 -DCFG_DIR=\"$(CFGDIR)\" -DDATA_DIR=\"$(DATADIR)\"
# or, you can choose this for a much smaller executable without debugging help
CPPFLAGS= -W -Wall -O3 -std=c++17 -DCFG_DIR=\"$(CFGDIR)\" -DDATA_DIR=\"$(DATADIR)\"
SRCS = $(wildcard *.cpp)
OBJS = $(SRCS:.cpp=.o)
DEPS = $(SRCS:.cpp=.d)
sgs-xl : GitVersion.h $(OBJS)
g++ $(CPPFLAGS) -o sgs-xl $(OBJS) -lconfig++ -pthread
%.o : %.cpp
g++ $(CPPFLAGS) -MMD -MD -c $< -o $@
.PHONY: clean
clean:
$(RM) GitVersion.h $(OBJS) $(DEPS) sgs-xl
-include $(DEPS)
# install, uninstall and removehostfiles need root priviledges
.PHONY: newhostfiles
newhostfiles :
mkdir -p $(CFGDIR)
mkdir -p $(DATADIR)
wget -O $(DATADIR)/DExtra_Hosts.txt http://www.pistar.uk/downloads/DExtra_Hosts.txt
wget -O $(DATADIR)/DCS_Hosts.txt http://www.pistar.uk/downloads/DCS_Hosts.txt
.PHONY: install
install : newhostfiles sgs-xl
mkdir -p $(CFGDIR)
mkdir -p $(DATADIR)
cp -rf data/* $(DATADIR)
cp -f sgs-xl.cfg $(CFGDIR)
cp -f sgs-xl $(BINDIR)
cp -f sgs-xl.service /lib/systemd/system
sed -i "s|REPLACEME|$(BINDIR)sgs-xl $(CFGDIR)sgs-xl.cfg|g" /lib/systemd/system/sgs-xl.service
systemctl enable sgs-xl.service
systemctl daemon-reload
systemctl start sgs-xl.service
.PHONY: uninstall
uninstall :
systemctl stop sgs-xl.service
systemctl disable sgs-xl.service
rm -f /lib/systemd/system/sgs-xl.service
systemctl daemon-reload
rm -f $(BINDIR)/sgs-xl
rm -rf $(CFGDIR)
rm -rf $(DATADIR)
.PHONY: removehostfiles
removehostfiles :
rm -f $(DATADIR)/DExtra_Hosts.txt
rm -f $(DATADIR)/DCS_Hosts.txt
.PHONY: GitVersion.h
GitVersion.h: force
ifneq ("$(wildcard .git/index)","")
echo "const char *gitversion = \"$(shell git rev-parse HEAD)\";" > $@
else
echo "const char *gitversion = \"0000000000000000000000000000000000000000\";" > $@
endif
.PHONY: force
force: