-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
155 lines (126 loc) · 4.91 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
153
154
155
#
# Copyright (C) 2021 by Geoffrey Merck F4FXL / KC3FRA
#
# 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, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
export BIN_DIR=/usr/local/bin
export CFG_DIR=/usr/local/etc/
export DATA_DIR=/usr/local/share/dstargateway.d/
export LOG_DIR=/var/log/dstargateway/
ifeq ($(ENABLE_DEBUG), 1)
# choose this if you want debugging help
export CPPFLAGS=-g -rdynamic -DBOOST_STACKTRACE_USE_ADDR2LINE -DDEBUG_DSTARGW -no-pie -fno-pie -ggdb -W -Wall -Werror -std=c++17
export LDFLAGS=-ldl -no-pie -fno-pie
else
# or, you can choose this for a much smaller executable without debugging help
export CPPFLAGS=-W -O3 -Wall -Werror -std=c++17
endif
export CC=g++
export LDFLAGS+= -lcurl -pthread
ifeq ($(USE_GPSD), 1)
export CPPFLAGS+= -DUSE_GPSD
export LDFLAGS+= -lgps
endif
.PHONY: all
all: DStarGateway/dstargateway DGWRemoteControl/dgwremotecontrol DGWTextTransmit/dgwtexttransmit DGWTimeServer/dgwtimeserver DGWVoiceTransmit/dgwvoicetransmit #tests
APRS/APRS.a: BaseCommon/BaseCommon.a FORCE
$(MAKE) -C APRS
Common/Common.a: VersionInfo/GitVersion.h APRS/APRS.a BaseCommon/BaseCommon.a FORCE
$(MAKE) -C Common
BaseCommon/BaseCommon.a: FORCE
$(MAKE) -C BaseCommon
DStarBase/DStarBase.a: BaseCommon/BaseCommon.a FORCE
$(MAKE) -C DStarBase
DStarGateway/dstargateway : VersionInfo/GitVersion.h $(OBJS) APRS/APRS.a Common/Common.a DStarBase/DStarBase.a IRCDDB/IRCDDB.a BaseCommon/BaseCommon.a FORCE
$(MAKE) -C DStarGateway
DGWRemoteControl/dgwremotecontrol: VersionInfo/GitVersion.h $(OBJS) DStarBase/DStarBase.a BaseCommon/BaseCommon.a FORCE
$(MAKE) -C DGWRemoteControl
DGWTextTransmit/dgwtexttransmit: VersionInfo/GitVersion.h $(OBJS) DStarBase/DStarBase.a BaseCommon/BaseCommon.a FORCE
$(MAKE) -C DGWTextTransmit
DGWTimeServer/dgwtimeserver: VersionInfo/GitVersion.h $(OBJS) DStarBase/DStarBase.a BaseCommon/BaseCommon.a FORCE
$(MAKE) -C DGWTimeServer
DGWVoiceTransmit/dgwvoicetransmit: VersionInfo/GitVersion.h $(OBJS) DStarBase/DStarBase.a BaseCommon/BaseCommon.a FORCE
$(MAKE) -C DGWVoiceTransmit
IRCDDB/IRCDDB.a: VersionInfo/GitVersion.h BaseCommon/BaseCommon.a FORCE
$(MAKE) -C IRCDDB
VersionInfo/GitVersion.h: FORCE
$(MAKE) -C VersionInfo
.PHONY: clean
clean:
$(MAKE) -C Tests clean
$(MAKE) -C APRS clean
$(MAKE) -C BaseCommon clean
$(MAKE) -C Common clean
$(MAKE) -C DGWRemoteControl clean
$(MAKE) -C DGWTextTransmit clean
$(MAKE) -C DGWTimeServer clean
$(MAKE) -C DGWVoiceTransmit clean
$(MAKE) -C DStarBase clean
$(MAKE) -C DStarGateway clean
$(MAKE) -C IRCDDB clean
$(MAKE) -C VersionInfo
-include $(DEPS)
# install, uninstall and removehostfiles need root priviledges
.PHONY: newhostfiles
newhostfiles :
@echo "Fetching new host files"
@mkdir -p $(DATA_DIR)
@wget http://www.pistar.uk/downloads/DExtra_Hosts.txt -nv -O $(DATA_DIR)/DExtra_Hosts.txt
@wget http://www.pistar.uk/downloads/DCS_Hosts.txt -nv -O $(DATA_DIR)/DCS_Hosts.txt
@wget http://www.pistar.uk/downloads/DPlus_Hosts.txt -nv -O $(DATA_DIR)/DPlus_Hosts.txt
.PHONY: install
install : DStarGateway/dstargateway DGWRemoteControl/dgwremotecontrol
# install accessories
$(MAKE) -C DGWRemoteControl install
$(MAKE) -C DGWTextTransmit install
$(MAKE) -C DGWTimeServer install
$(MAKE) -C DGWVoiceTransmit install
# create user for daemon
@useradd --user-group -M --system dstar --shell /bin/false || true
# Create directories
@mkdir -p $(CFG_DIR)
@mkdir -p $(DATA_DIR)
@mkdir -p $(BIN_DIR)
@mkdir -p $(LOG_DIR)
@chown dstar:dstar $(LOG_DIR)
@chown dstar:dstar $(DATA_DIR)
# Install data
$(MAKE) -C Data install
@chown -R dstar:dstar $(DATA_DIR)
# install services executables
$(MAKE) -C DStarGateway install
.PHONY: uninstall
uninstall :
systemctl stop dstargateway.service || true
systemctl disable dstargateway.service || true
@rm -f /lib/systemd/system/dstargateway.service
@systemctl daemon-reload
@rm -f $(BIN_DIR)/dstargateway
# @rm -f $(CFG_DIR)/dstargateway.cfg
# Only remove folder content
@rm -f $(DATA_DIR)/*
.PHONY: removehostfiles
removehostfiles :
@rm -f $(DATA_DIR)/DExtra_Hosts.txt
@rm -f $(DATA_DIR)/DCS_Hosts.txt
@rm -f $(DATA_DIR)/DPlus_Hosts.txt
.PHONY tests:
tests : VersionInfo/GitVersion.h $(OBJS) APRS/APRS.a Common/Common.a DStarBase/DStarBase.a IRCDDB/IRCDDB.a BaseCommon/BaseCommon.a FORCE
@$(MAKE) -C Tests dstargateway_tests
.PHONY run-tests:
run-tests: tests
@$(MAKE) -C Tests run-tests
FORCE:
@true