forked from n7tae/mrefd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
81 lines (64 loc) · 2.59 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
# Copyright (c) 2020 by Thomas A. Early N7TAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# locations for the executibles and other files are set here
# NOTE: IF YOU CHANGE THESE, YOU WILL NEED TO UPDATE THE service.* FILES AND
# if you change these locations, make sure the sgs.service file is updated!
# you will also break hard coded paths in the dashboard file, index.php.
include configure.mk
# if you make changed in these two variable, you'll need to change things
# in the main.h file as well as the systemd service file.
BINDIR = /usr/local/bin
CFGDIR = /usr/local/etc
DATADIR = /var/lib/m17ref
CC = g++
ifeq ($(debug), true)
CFLAGS = -ggdb3 -W -c -std=c++11 -MMD -MD -c
else
CFLAGS = -c -W -std=c++11 -MMD -MD -c
endif
LDFLAGS=-pthread
SRCS = callsign.cpp callsignlist.cpp callsignlistitem.cpp client.cpp clients.cpp crc.cpp gatekeeper.cpp ip.cpp m17client.cpp m17peer.cpp m17protocol.cpp notification.cpp packet.cpp packetstream.cpp peer.cpp peers.cpp peercallsignlist.cpp protocol.cpp reflector.cpp timepoint.cpp udpsocket.cpp user.cpp users.cpp version.cpp main.cpp
OBJS = $(SRCS:.cpp=.o)
DEPS = $(SRCS:.cpp=.d)
EXE=mrefd
all : $(EXE) crc-test
crc-test : crc-test.o crc.o
$(CC) $^ -o $@
$(EXE) : $(OBJS)
$(CC) $^ -o $@ $(LDFLAGS)
%.o : %.cpp
g++ $(CFLAGS) $< -o $@
clean :
$(RM) *.o *.d $(EXE) crc-test
-include $(DEPS)
install : $(EXE).blacklist $(EXE).whitelist $(EXE).interlink
ln -s $(shell pwd)/$(EXE).blacklist $(CFGDIR)/$(EXE).blacklist
ln -s $(shell pwd)/$(EXE).whitelist $(CFGDIR)/$(EXE).whitelist
ln -s $(shell pwd)/$(EXE).interlink $(CFGDIR)/$(EXE).interlink
cp -f systemd/$(EXE).service /etc/systemd/system/
cp -f $(EXE) $(BINDIR)
mkdir -p $(DATADIR)
systemctl enable $(EXE).service
systemctl daemon-reload
systemctl start $(EXE)
uninstall :
rm -f $(CFGDIR)/$(EXE).blacklist
rm -f $(CFGDIR)/$(EXE).whitelist
rm -f $(CFGDIR)/$(EXE).interlink
systemctl stop $(EXE).service
rm -f $(CFGDIR)/dmrid.dat
systemctl disable $(EXE).service
rm -f /etc/systemd/system/$(EXE).service
systemctl daemon-reload