mirror of https://github.com/sipwise/sems.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
378 lines
8.7 KiB
378 lines
8.7 KiB
ifeq ($(makefile_defs),1)
|
|
else
|
|
makefile_defs=1
|
|
export makefile_defs
|
|
|
|
GIT = $(shell which git)
|
|
SVNVERSION = $(shell which svnversion)
|
|
|
|
ifneq ($(GIT),)
|
|
SCM_REV = $(shell if git --help describe |grep dirty 2>&1 >/dev/null ; \
|
|
then git describe --always --dirty 2>/dev/null; \
|
|
else git describe --always 2>/dev/null; fi)
|
|
endif
|
|
|
|
ifeq ($(SCM_REV),)
|
|
ifneq ($(SVNVERSION),)
|
|
SCM_REV = r$(shell svnversion -n .)
|
|
endif
|
|
endif
|
|
|
|
#version number
|
|
VERSION = 1
|
|
PATCHLEVEL = 4
|
|
SUBLEVEL = 2
|
|
|
|
ifneq ($(SCM_REV),)
|
|
RELEASE = $(SCM_REV)
|
|
else
|
|
REL_VERSION=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)
|
|
RELEASE=$(REL_VERSION)$(EXTRAVERSION)
|
|
endif
|
|
|
|
CPPFLAGS += -D_DEBUG \
|
|
-D_THREAD_SAFE -D_REENTRANT \
|
|
-DSEMS_VERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"'\
|
|
-DOS='"$(OS)"' \
|
|
# -DMAX_RTP_SESSIONS=8192 \
|
|
# -DSUPPORT_IPV6 \
|
|
# -DNO_THREADID_LOG \
|
|
# -DLOG_PRETTY_FUNCTION \
|
|
# -DLOG_LOC_DATA_ATEND
|
|
|
|
|
|
# compile with session thread pool support?
|
|
# use this for very high concurrent call count
|
|
# applications (e.g. for signaling only)
|
|
# if compiled with thread pool, there will be a
|
|
# thread pool of configurable size processing the
|
|
# signaling and application logic of the calls.
|
|
# if compiled without thread pool support, every
|
|
# session will have its own thread.
|
|
#
|
|
#USE_THREADPOOL = yes
|
|
|
|
# compile with spandsp DTMF detection? see soft-switch.org
|
|
# this needs a fairly new version of spandsp - tested with 0.0.4pre11
|
|
# will not work with spandsp 0.0.2 .
|
|
# (which means that current debian and gentoo packages don't work)
|
|
#
|
|
#USE_SPANDSP = yes
|
|
# statically link spandsp library?
|
|
# (might need adjusting spandsp lib path LIBSPANDSP_LDIR - may be /usr/lib)
|
|
#LIBSPANDSP_STATIC = yes
|
|
#LIBSPANDSP_LDIR = /usr/local/lib/
|
|
|
|
# compile with sample rate conversion from secret rabbit code?
|
|
# (see http://www.mega-nerd.com/SRC/)
|
|
#
|
|
#USE_LIBSAMPLERATE = yes
|
|
|
|
#
|
|
# ZRTP support? (see zfoneproject.com)
|
|
#WITH_ZRTP = yes
|
|
|
|
#
|
|
# exclude some modules from compilation?
|
|
# e.g. python modules:
|
|
|
|
exclude_core_modules = sipctrl g729
|
|
#exclude_apps_modules = py_sems ivr mailbox pin_collect conf_auth mp3 examples
|
|
|
|
# build in support for monitoring?
|
|
#
|
|
#
|
|
USE_MONITORING=yes
|
|
|
|
# Support for long debug messages? (useful for debugging SIP messages' contents)
|
|
#
|
|
# disable for slight performance gain
|
|
LONG_DEBUG_MESSAGE=yes
|
|
|
|
# Is this a debug build or not?
|
|
debug=no
|
|
|
|
|
|
################### end of configuration section #######################
|
|
|
|
LDFLAGS += -lm
|
|
|
|
GETOS=$(COREPATH)/compat/getos
|
|
GETARCH=$(COREPATH)/compat/getarch
|
|
|
|
OS := $(shell $(CC) $(EXTRA_CFLAGS) -o $(GETOS) $(GETOS).c && $(GETOS))
|
|
ARCH := $(shell $(CC) $(EXTRA_CFLAGS) -o $(GETARCH) $(GETARCH).c && $(GETARCH))
|
|
|
|
ifdef USE_THREADPOOL
|
|
CPPFLAGS += -DSESSION_THREADPOOL
|
|
endif
|
|
|
|
ifdef USE_SPANDSP
|
|
ifneq ($(spandsp_defs), 1)
|
|
spandsp_defs=1
|
|
export spandsp_defs
|
|
CPPFLAGS += -DUSE_SPANDSP -D__STDC_LIMIT_MACROS
|
|
endif
|
|
else
|
|
exclude_core_modules += g722
|
|
endif
|
|
|
|
ifdef USE_LIBSAMPLERATE
|
|
ifneq ($(libsrc_defs), 1)
|
|
libsrc_defs=1
|
|
export libsrc_defs
|
|
CPPFLAGS += -DUSE_LIBSAMPLERATE
|
|
endif
|
|
endif
|
|
|
|
ifdef USE_MONITORING
|
|
CPPFLAGS += -DUSE_MONITORING
|
|
endif
|
|
|
|
ifdef LONG_DEBUG_MESSAGE
|
|
CPPFLAGS += -DLOG_BUFFER_LEN=2048
|
|
endif
|
|
|
|
|
|
# Additions for Solaris support.
|
|
ifeq ($(OS),solaris)
|
|
CPPFLAGS += -DHAVE_SYS_SOCKIO_H -DBSD_COMP -fPIC -include compat/solaris.h
|
|
CFLAGS += -DHAVE_SYS_SOCKIO_H -DBSD_COMP -fPIC -include compat/solaris.h
|
|
# For nanosleep.
|
|
LDFLAGS += -lrt
|
|
# For inet_aton.
|
|
LDFLAGS += -lresolv
|
|
|
|
# I don't have libspeex installed.
|
|
# binrpcctrl does some really weird header stuff that doesn't work.
|
|
exclude_core_modules += binrpcctrl ilbc speex
|
|
endif
|
|
|
|
|
|
|
|
|
|
# fix sparc -> sparc64
|
|
ifeq ($(ARCH),sparc)
|
|
ifeq ($(shell uname -m),sun4u)
|
|
ARCH := sparc64
|
|
endif
|
|
endif
|
|
|
|
# need OS specific for this ?
|
|
CXX = g++
|
|
CC = gcc
|
|
LD = $(CC)
|
|
|
|
CXXFLAGS += -Wall -Wno-reorder -fPIC -g $(EXTRA_CXXFLAGS)
|
|
CFLAGS += -Wall -fPIC -g $(EXTRA_CFLAGS)
|
|
|
|
# only optimize if releasing, as it slows down the build process
|
|
ifneq ($(debug),yes)
|
|
CXXFLAGS += -O2
|
|
CFLAGS += -O2
|
|
endif
|
|
|
|
ifeq ($(DEBUG_PLAYOUT), yes)
|
|
CPPFLAGS += -DDEBUG_PLAYOUTBUF
|
|
endif
|
|
|
|
ifdef WITH_ZRTP
|
|
CPPFLAGS += -DWITH_ZRTP \
|
|
-DBUILD_ZRTP_MUTEXES \
|
|
-DBUILD_DEFAULT_CACHE -DBUILD_DEFAULT_TIMER -DUNIX -DBUILD_ZRTP_MUTEXES \
|
|
-I/usr/local/include/zrtp
|
|
endif
|
|
|
|
TARGET=
|
|
LIB_LDFLAGS = -shared
|
|
|
|
ifeq ($(OS), linux)
|
|
LDFLAGS += -ldl -rdynamic -lpthread
|
|
else
|
|
ifeq ($(OS), freebsd)
|
|
LDFLAGS += -rdynamic -pthread
|
|
else
|
|
ifeq ($(OS), openbsd)
|
|
LDFLAGS += -rdynamic -pthread
|
|
else
|
|
ifeq ($(OS), netbsd)
|
|
LDFLAGS += -rdynamic -pthread
|
|
else
|
|
ifeq ($(OS), macosx)
|
|
LDFLAGS += -rdynamic -pthread
|
|
LIB_LDFLAGS = -flat_namespace -undefined suppress -bundle
|
|
CXXFLAGS += -fno-common
|
|
CFLAGS += -fno-common
|
|
|
|
#necessary for sa_len|ss_len|sin_len
|
|
# may be needed on other *BSD
|
|
CPPFLAGS += -DBSD44SOCKETS
|
|
|
|
# add the DarwinPorts directory
|
|
ifneq ($(ARCH), iphone)
|
|
CPPFLAGS += -D__DARWIN_UNIX03
|
|
CPPFLAGS += -I /opt/local/include
|
|
LDFLAGS += -L/opt/local/lib
|
|
endif
|
|
else
|
|
ifeq ($(OS), solaris)
|
|
LDFLAGS+= -fPIC -ldl -lsocket -lnsl -lpthread
|
|
TARGET=solaris
|
|
# These don't build on Solaris because of missing Python, invalid make args, or other.
|
|
exclude_app_modules += py_sems py_comp pin_collect mailbox ivr diameter_client conf_auth mp3 cc_acc_xmlrpc xmlrpc2di
|
|
|
|
endif
|
|
endif
|
|
endif
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
LDFLAGS += -lstdc++
|
|
|
|
ifeq ($(ARCH),iphone)
|
|
LDFLAGS += -lgcc_eh
|
|
endif
|
|
|
|
ifdef USE_SPANDSP
|
|
ifdef LIBSPANDSP_STATIC
|
|
LDFLAGS += $(LIBSPANDSP_LDIR)libspandsp.a
|
|
else
|
|
LDFLAGS += -lspandsp
|
|
endif
|
|
endif
|
|
|
|
ifdef USE_LIBSAMPLERATE
|
|
LDFLAGS +=-lsamplerate
|
|
endif
|
|
|
|
ifdef WITH_ZRTP
|
|
LDFLAGS +=-lzrtp -lbn
|
|
endif
|
|
|
|
LIB_LDFLAGS += $(LDFLAGS)
|
|
|
|
|
|
# install path is $(basedir) $(prefix)
|
|
# example:
|
|
# creating a bin. archive in /tmp, which unpacks in /usr/local
|
|
# basedir=/tmp
|
|
# prefix=/usr/local
|
|
|
|
DESTDIR ?=
|
|
PREFIX ?= /usr/local
|
|
prefix ?= $(PREFIX)
|
|
BASEDIR ?=
|
|
basedir = $(BASEDIR)
|
|
|
|
# Redhat users should use sems.redhat instead of sems
|
|
# the file will be to $(bin-prefix)/$(bin-dir)/sems copied.
|
|
start-script = sems.redhat
|
|
|
|
# install prefixes for various stuff
|
|
cfg-prefix = $(basedir)$(prefix)
|
|
bin-prefix = $(basedir)$(prefix)
|
|
modules-prefix = $(basedir)$(prefix)
|
|
doc-prefix = $(basedir)$(prefix)
|
|
audio-prefix = $(basedir)$(prefix)
|
|
lib-prefix = $(basedir)$(prefix)
|
|
|
|
# dirs
|
|
cfg-dir = etc/sems/
|
|
|
|
bin-dir = sbin/
|
|
modules-dir = lib/sems/plug-in/
|
|
audio-dir = lib/sems/audio/
|
|
lib-dir = lib/sems/
|
|
|
|
ifeq ($(OS), linux)
|
|
doc-dir = share/doc/sems/
|
|
man-dir = share/man/
|
|
else
|
|
ifeq ($(OS), freebsd)
|
|
doc-dir = share/doc/sems/
|
|
man-dir = man/
|
|
else
|
|
ifeq ($(OS), openbsd)
|
|
doc-dir = share/doc/sems/
|
|
man-dir = man/
|
|
else
|
|
ifeq ($(OS), netbsd)
|
|
doc-dir = share/doc/sems
|
|
man-dir = man/
|
|
else
|
|
doc-dir = doc/sems/
|
|
man-dir = man/
|
|
endif
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
# target dirs for various stuff
|
|
bin-target = $(prefix)/$(bin-dir)
|
|
cfg-target ?= $(prefix)/$(cfg-dir)
|
|
app-cfg-target = $(cfg-target)etc/
|
|
modules-target = $(prefix)/$(modules-dir)
|
|
audio-target = $(prefix)/$(audio-dir)
|
|
lib-target = $(prefix)/$(lib-dir)
|
|
|
|
ifeq ($(OS), solaris)
|
|
#use GNU versions
|
|
INSTALL ?= ginstall
|
|
TAR ?= gtar
|
|
else
|
|
INSTALL ?= install
|
|
TAR ?= tar
|
|
endif
|
|
|
|
INSTALL-TOUCH = touch # used to create the file first (good to
|
|
# make solaris install work)
|
|
INSTALL-CFG = $(INSTALL) -m 644
|
|
INSTALL-BIN = $(INSTALL) -m 755
|
|
INSTALL-MODULES = $(INSTALL) -m 755
|
|
INSTALL-DOC = $(INSTALL) -m 644
|
|
INSTALL-AUDIO = $(INSTALL) -m 644
|
|
|
|
#export stuff to sub-makes
|
|
export REL_VERSION RELEASE OS ARCH
|
|
export CPPFLAGS CXXFLAGS LDFLAGS CFLAGS LIB_LDFLAGS
|
|
export CXX CC LD
|
|
export DESTDIR PREFIX prefix basedir ser-prefix
|
|
export start-script
|
|
export cfg-prefix bin-prefix modules-prefix doc-prefix audio-prefix lib-prefix
|
|
export cfg-dir bin-dir modules-dir audio-dir lib-dir doc-dir man-dir
|
|
export bin-target cfg-target app-cfg-target modules-target audio-target lib-target
|
|
export INSTALL TAR INSTALL-TOUCH INSTALL-CFG INSTALL-BIN INSTALL-MODULES INSTALL-DOC INSTALL-AUDIO
|
|
|
|
export USE_SPANDSP LIBSPANDSP_STATIC LIBSPANDSP_LDIR
|
|
export USE_LIBSAMPLERATE
|
|
export WITH_ZRTP
|
|
export USE_MONITORING
|
|
export exclude_core_modules exclude_app_modules
|
|
endif # ifeq ($(makefile_defs, 1)
|
|
|
|
mk-install-dirs: $(DESTDIR)$(cfg-target) \
|
|
$(DESTDIR)$(app-cfg-target) \
|
|
$(DESTDIR)$(bin-prefix)/$(bin-dir) \
|
|
$(DESTDIR)$(modules-prefix)/$(modules-dir) \
|
|
$(DESTDIR)$(audio-prefix)/$(audio-dir) \
|
|
$(DESTDIR)$(doc-prefix)/$(doc-dir)
|
|
|
|
$(DESTDIR)$(cfg-target):
|
|
mkdir -p $(DESTDIR)$(cfg-target)
|
|
|
|
$(DESTDIR)$(app-cfg-target):
|
|
mkdir -p $(DESTDIR)$(app-cfg-target)
|
|
|
|
$(DESTDIR)$(bin-prefix)/$(bin-dir):
|
|
mkdir -p $(DESTDIR)$(bin-prefix)/$(bin-dir)
|
|
|
|
$(DESTDIR)$(modules-prefix)/$(modules-dir):
|
|
mkdir -p $(DESTDIR)$(modules-prefix)/$(modules-dir)
|
|
|
|
$(DESTDIR)$(audio-prefix)/$(audio-dir):
|
|
mkdir -p $(DESTDIR)$(audio-prefix)/$(audio-dir)
|
|
|
|
$(DESTDIR)$(doc-prefix)/$(doc-dir):
|
|
mkdir -p $(DESTDIR)$(doc-prefix)/$(doc-dir)
|