-
Notifications
You must be signed in to change notification settings - Fork 22
/
Makefile.in
234 lines (195 loc) · 8.14 KB
/
Makefile.in
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# -*- mode: Makefile -*-
# Copyright (C) 2002-2016 by its various Authors, see CVS-log
#
# PURPOSE OF THIS FILE: Make file for GNU Gatekeeper
#
# - Automatic Version Information via RCS:
# $Id$
# $Source$
#
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
PROG = gnugk
SOURCES = singleton.cxx job.cxx yasocket.cxx h323util.cxx \
Toolkit.cxx SoftPBX.cxx GkStatus.cxx RasTbl.cxx Routing.cxx \
Neighbor.cxx GkClient.cxx gkauth.cxx RasSrv.cxx ProxyChannel.cxx \
gk.cxx version.cxx gkacct.cxx gktimer.cxx gkconfig.cxx \
sigmsg.cxx clirw.cxx cisco.cxx ipauth.cxx statusacct.cxx \
syslogacct.cxx capctrl.cxx MakeCall.cxx h460presence.cxx \
forwarding.cxx snmp.cxx lua.cxx ldap.cxx geoip.cxx \
gkh235.cxx authenticators.cxx RequireOneNet.cxx httpacct.cxx amqpacct.cxx \
@SOURCES@
HEADERS = GkClient.h GkStatus.h Neighbor.h ProxyChannel.h RasPDU.h \
RasSrv.h RasTbl.h Routing.h SoftPBX.h Toolkit.h factory.h \
gk.h gk_const.h gkacct.h gkauth.h job.h name.h rasinfo.h rwlock.h \
singleton.h stl_supp.h version.h yasocket.h gktimer.h \
gkconfig.h configure Makefile sigmsg.h clirw.h cisco.h ipauth.h \
statusacct.h syslogacct.h capctrl.h MakeCall.h h460presence.h snmp.h \
gkh235.h authenticators.h RequireOneNet.h httpacct.h \
@HEADERS@
# add cleanup files for non-default targets
CLEAN_FILES += docs/manual/*.html
CLEAN_FILES += testrunner
# add cleanup files for autoconf
#CLEAN_FILES += Makefile config.*
# colon, the empty variable and a single space are special characters to
# MAKE and may cause trouble. Let's 'quote' the little bastards by
# assigning it to a variable
colon:=:
comma:=,
empty:=
space:=$(empty) $(empty)
# remove half updated or corrupt files
.DELETE_ON_ERROR:
# setup various important paths
PTLIBDIR=@PTLIBDIR@
OPENH323DIR=@OPENH323DIR@
OPENH323MAKEDIR=@OPENH323MAKEDIR@
ifndef TMP
TMP=/tmp
endif
ifeq (@NEEDOPENH323PREFIX@,1)
ifndef PREFIX
PREFIX=@OPENH323INSTALLPREFIX@
endif
endif
CWD:=$(shell pwd)
# having an own idea about default targets
.PHONY: bothdepend optnoshared gkdefault
.DEFAULT: gkdefault
gkdefault: bothdepend optnoshared
# LD_RUN_LIST is the list form of the LD_RUN_PATH
LD_RUN_LIST := $(subst $(colon),$(space),$(LD_RUN_PATH))
LD_RUN_LIST += $(PTLIBDIR)/lib $(OPENH323DIR)/lib
# compiler/linker flags set by configure script
STDCCFLAGS += @STDCCFLAGS@
LDFLAGS += @LDFLAGS@
ENDLDLIBS += @ENDLDLIBS@
ENDLDFLAGS += @ENDLDFLAGS@
STDCCFLAGS += -D'MANUFACTURER=@MANUFACTURER@'
STDCCFLAGS += -D'PROGRAMMNAME=@PROGRAMNAME@'
# automatically include debugging code or not
ifdef PASN_NOPRINT
STDCCFLAGS += -DPASN_NOPRINT
endif
###
### Including the general make rules of OpenH323/H323Plus
###
include $(OPENH323MAKEDIR)/openh323u.mak
#CXX = callcatcher g++
### Remove -fdata-sections gcc option that cause problems during link step
temp_STDCCFLAGS := $(subst -fdata-sections,,$(STDCCFLAGS))
STDCCFLAGS = $(temp_STDCCFLAGS)
ifeq "$(OSTYPE)" "solaris"
### Remove references to gcc 3.x libs that come with Solaris 10
temp_ENDLDLIBS := $(subst -R/usr/sfw/lib,,$(ENDLDLIBS))
ENDLDLIBS = $(temp_ENDLDLIBS)
temp_ENDLDLIBS := $(subst -L/usr/sfw/lib,,$(ENDLDLIBS))
ENDLDLIBS = $(temp_ENDLDLIBS)
ENDLDLIBS += -L/opt/csw/lib
endif # solaris
# GK version infomation
STDCCFLAGS += -DMAJOR_VERSION=@GNUGK_MAJOR_VERSION@ -DMINOR_VERSION=@GNUGK_MINOR_VERSION@ -DBUILD_NUMBER=@GNUGK_BUILD_NUMBER@
STDCCFLAGS += -fno-strict-aliasing
# remove -felide-constructors for Intel C++ compiler
ifeq "$(CXX)" "icpc"
temp_STDCXXFLAGS := $(subst -felide-constructors,,$(STDCXXFLAGS))
STDCXXFLAGS = $(temp_STDCXXFLAGS)
endif
# get gcc/g++ version
ifeq "$(CXX)" "g++"
GCCMAJOREQ4 := $(shell expr 4 = `$(CXX) -dumpversion | cut -f1 -d.`)
GCCMAJORGT4 := $(shell expr 4 \< `$(CXX) -dumpversion | cut -f1 -d.`)
GCCMAJORGT7 := $(shell expr 7 \< `$(CXX) -dumpversion | cut -f1 -d.`)
GCCMAJORGTEQ4 := $(shell expr 4 \<= `$(CXX) -dumpversion | cut -f1 -d.`)
GCCMINORGTEQ4 := $(shell expr 4 \<= `$(CXX) -dumpversion | cut -f2 -d.`)
endif
# enable stack protection and RELRO + BIND_NOW on Linux with gcc >= 4.x.x
ifeq "$(OSTYPE)" "linux"
ifeq "$(GCCMAJORGTEQ4)" "1"
# security flags
STDCCFLAGS += -fstack-protector --param ssp-buffer-size=4
LDFLAGS += -Wl,-z,relro,-z,now
# Ubuntu optimization flag
LDFLAGS += -Wl,--hash-style=gnu
# Export variables to dynamically loaded libraries;
# solves "Undefined symbol lua_settop" error when lua
# script tries to request external library
LDFLAGS += -Wl,--export-dynamic
# more flags from OpenSSF recommendation 11/2023
# https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++
STDCCFLAGS += -D_GLIBCXX_ASSERTIONS -fstack-clash-protection -fstack-protector-strong -Wtrampolines -fno-delete-null-pointer-checks -fno-strict-overflow -fno-strict-aliasing
LDFLAGS += -Wl,-z,nodlopen -Wl,-z,noexecstack
ifeq ($(MACHTYPE),x86_64)
STDCCFLAGS += -fcf-protection=full
endif
endif # gcc >= 4.x.x
endif # linux
# enable position independent code (PIE) for address space randomization
# can only be used with make opt, otherwise H323Plus + PTLib also need to be compiled with PIE
# 5-10% perfomance penalty on x86, less on x64_64
#STDCCFLAGS += -fPIE -pie
#LDFLAGS += -fPIE -pie
# for debugging with GCC >= 4.8.x, using AddressSanitizer
#STDCCFLAGS += -fsanitize=address -fno-omit-frame-pointer
#LDFLAGS += -fsanitize=address
# enable more warnings when using gcc >= 4.4
ifeq "$(GCCMAJOREQ4)" "1"
ifeq "$(GCCMINORGTEQ4)" "1"
STDCCFLAGS += -Wtype-limits -Wstrict-overflow=5 -fstrict-overflow -Wsign-compare
endif
endif
ifeq "$(GCCMAJORGT4)" "1"
STDCCFLAGS += -Wtype-limits -Wstrict-overflow=5 -fstrict-overflow -Wsign-compare -Wno-unused-variable
endif
ifeq "$(GCCMAJORGT7)" "1"
STDCCFLAGS += -Wno-misleading-indentation
endif
ifeq "$(CXX)" "clang++"
# avoid a ton of warnings about PTLib
STDCCFLAGS += -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-overloaded-virtual -Wno-unused-const-variable -Wno-unused-private-field
endif
ifeq "$(CXX)" "clang++-12"
# avoid a ton of warnings about PTLib
STDCCFLAGS += -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-overloaded-virtual -Wno-unused-const-variable -Wno-unused-private-field
endif
# special dependency to ensure version.cxx is rebuilt each time gnugk is recompiled
# so the proper build timestamp is included
version.cxx: $(subst version.cxx,,$(SOURCES)) $(HEADERS)
@touch $@
doc:
$(MAKE) -C docs/manual html
# test support using Google C++ Test Framework
# Set GTEST_DIR as environment variable or define it here
GTEST_DIR = /usr/src/googletest/googletest/
TESTCASES = h323util.t.cxx Toolkit.t.cxx ProxyChannel.t.cxx
temp_TESTOBJS := $(subst $(OBJDIR)/gk.o,,$(OBJS))
TESTOBJS = $(temp_TESTOBJS)
libgtest.a:
$(CXX) -I${GTEST_DIR}/include -I${GTEST_DIR} -c ${GTEST_DIR}/src/gtest-all.cc
$(AR) -rv libgtest.a gtest-all.o
test: libgtest.a testrunner.cxx $(TESTCASES) $(TESTOBJS)
@rm -f ./testrunner $(OBJDIR)/GkStatus.o
@$(CXX) $(STDCCFLAGS) $(STDCXXFLAGS) $(CFLAGS) -DUNIT_TEST=1 -x c++ -c GkStatus.cxx -o $(OBJDIR)/GkStatus.o
@$(CXX) $(STDCCFLAGS) $(STDCXXFLAGS) $(CFLAGS) -DUNIT_TEST=1 -x c++ -c ProxyChannel.cxx -o $(OBJDIR)/ProxyChannel.o
$(CXX) -I${GTEST_DIR}/include $(STDCCFLAGS) testrunner.cxx $(TESTCASES) -o testrunner libgtest.a $(TESTOBJS) $(LDFLAGS) -lh323_linux_x86_64__s -lpt_s $(ENDLDLIBS)
./testrunner
# special configure dependencies
configure: configure.in
autoconf
Makefile: Makefile.in config.status
./config.status
config.status: configure
./config.status --recheck