73103df8 |
|
247c2b65 |
#
# makefile defs (CC, LD,a.s.o)
# |
5b9b8d2e |
# Environment variables:
# PREFIX, LOCALBASE, BASEDIR |
1f2c924e |
# INSTALL, TAR , CC, LEX, YACC, |
a2040154 |
# CPU, CC_EXTRA_OPTS, LD_EXTRA_OPTS |
fc50bc47 |
# exclude_modules, skip_modules, include_modules |
3dae72a3 |
# extra_defs |
6419a43f |
# |
a2786e3e |
# History:
# --------
# created by andrei |
28b28d2c |
# 2003-02-24 added LOCALBASE, fixed doc_dir for freebsd - patch provided |
b33736bc |
# by Maxim Sobolev <sobomax@FreeBSD.org> |
5df85411 |
# 2003-02-25 added -DDISABLE_NAGLE (andrei) |
a6c0b4ba |
# 2003-03-02 added -DDIGEST_DOMAIN (janakj) |
6419a43f |
# 2003-03-10 added -xcode=pic32 for module compilation w/ sun cc |
1f2c924e |
# (too many symbols for pic13) (andrei)
# 2003-04-16 added CC_EXTRA_OPTS, s/march/mcpu, added CPU (cpu to optimize |
5df85411 |
# for, used only with gcc-3.x) (andrei) |
4ce32edc |
# 2003-05-23 check if this makefile was already included (andrei)
# removed -DDIGEST_DOMAIN (andrei) |
3dae72a3 |
# 2003-05-30 added extra_defs (andrei) |
176e7a13 |
# 2003-06-06 moved compiler detection before DEFS (andrei) |
74250efc |
# 2003-06-10 removed -m32 for gcc 3.x/sparc64 -- it will use
# arch. default: -m32 on solaris, -m64 on *bsd (andrei) |
4e018310 |
# 2003-09-25 added -pthread into LIBS when compiling on FreeBSD/alpha
# and other FreeBSD arches for which no fast locking assembly
# code exists (sobomax) |
06aaa54f |
# 2003-11-08 mips1 support introduced (andrei) |
cf98659b |
# 2003-11-24 openbsd 3.4 (elf) fixes (andrei) |
194b6a35 |
# 2004-07-27 darwin (mac os x) port (andrei) |
5ffcc5d0 |
# 2004-09-12 mips2 & cobalt support introduced (andrei) |
4d080f49 |
# 2004-09-28 x86_64 support introduced (andrei) |
88d3fa6d |
# 2004-12-14 gcc-3.4 special case added (andrei) |
8d0543b9 |
# 2004-12-15 HAVE_ALLOCA_H added (andrei) |
350ffd02 |
# 2004-12-19 amd64 transformed in x86_64 (andrei) |
871a6a07 |
# 2005-04-27 alpha support added (andrei) |
3543f7dc |
# 2005-06-01 use $(LOCALBASE) instead of /usr/{local,pkg} (andrei) |
9eda5956 |
# 2005-06-26 numeric OSREL & HAVE_KQUEUE added to the *BSD (andrei)
# 2005-07-04 HAVE_DEVPOLL added to solaris (andrei) |
e0931fb0 |
# 2005-07-06 gcc 4.0 optimizations support (andrei) |
473f6f2e |
# 2005-07-25 better solaris arch detection (andrei) |
a31a6e8c |
# 2005-09-12 -mallign-double removed (too many problems) (andrei) |
3fb732f3 |
# 2005-10-02 distcc get gcc version hack (andrei) |
d307929c |
# 2006-03-30 64 bit mode compile by default on sparc64 (-m64), added
# CC_GCC_LIKE_ASM and SPARC64_MODE (andrei)
# sparc <= v8 support (andrei) |
0db44da7 |
# 2006-03-31 armv6 & mips64 support added
# mips and arm set to NOSMP by default (andrei) |
4fd7c9fd |
# 2006-07-10 added -DPROFILING (hscholz) |
6c53d41a |
# 2007-02-09 added TLS_HOOKS and CORE_TLS support, obsoleted TLS=1
# added TLS_EXTRA_LIBS (andrei) |
c853f68a |
# 2007-03-16 added LIB building options: LIB_LDFLAGS, LIB_SONAME, LIB_RPATH, |
28b28d2c |
# INSTALL_LIB, libraries install paths (andrei) |
8b8fc486 |
# 2007-05-14 futex support if linux 2.5.70+ and
# use_futex=yes (default) (andrei) |
f233d281 |
# 2007-05-26 changed darwin module link flags (instead of -bundle_loader ser
# -flat_namespace -undefined suppress) (andrei) |
b234c3ac |
# 2007-07-07 use isainfo -n to detect cpu type on solaris (andrei) |
7eec6c23 |
# 2007-07-07 added HAVE_SCHED_SETSCHEDULER for linux (andrei) |
f682fd71 |
# 2007-07-18 added DNS_WATCHDOG_SUPPORT (Miklos) |
021e7e0e |
# 2007-07-30 added USE_DNS_CACHE_STATS and USE_DST_BLACKLIST_STATS (Gergo) |
7742b1d2 |
# 2008-06-26 support for make cfg / config.mak and hack to load
# automatically config.mak when included from a module, lib
# a.s.o (not from the main Makefile) (andrei) |
f072585d |
# 2009-03-10 replaced DEFS with C_DEFS and INCLUDES with C_INCLUDES (DEFS
# and INCLUDES are now used only for "temporary" defines/includes
# inside modules or libs) (andrei) |
c46e7970 |
# 2009-09-29 for gcc 4.2+ use -fno-strict-overflow (andrei)
# 2009-09-30 find the target architecture from the compiler and not
# from the host (andrei) |
4ef2fe37 |
# 2009-10-01 use -fsigned-char for gcc on ppc, ppc64, arm and arm6
# (on those archs char is unsigned by default) (andrei) |
5a9014ee |
# 2010-03-10 added CC_MKDEP_OPTS, which contains to the list of options
# needed to generate dependencies on-the-fly while compiling
# or is empty if the compiler doesn't support it (andrei) |
7742b1d2 |
|
9f264d53 |
# default silent, unless Q= 0|no|off|verbose|noisy
quiet?=$(if $(filter 0 no off verbose noisy,$(Q)),verbose,silent) |
4ce32edc |
# check if already included/exported
|
7742b1d2 |
# used for sanity checks for Makefile.defs inclusion (!= makefile_defs which
# specifies if we have a set of valid defs)
override makefile_defs_included:=1
ifeq ($(makefile_defs),1) |
a91ba01f |
ifeq ($(quiet),verbose) |
7742b1d2 |
$(info Makefile.defs defs skipped) |
a91ba01f |
endif # verbose
|
4ce32edc |
else |
7742b1d2 |
ifeq (,$(main_makefile))
# hack to automatically use config.mak in all the modules, without
# changing the current module makefiles (which all include Makefile.defs):
# if not called from the main makefile (module, lib or ut):
# include config.mak, but if not present or incomplete (makefile_defs!=1)
# don't export the vars)
COREPATH?= ../..
include $(COREPATH)/config.mak |
a91ba01f |
ifeq ($(quiet),verbose) |
7742b1d2 |
$(info config.mak included) |
a91ba01f |
endif # verbose |
7742b1d2 |
# config.mak should set makefile_defs if complete |
4ce32edc |
export makefile_defs |
247c2b65 |
|
7742b1d2 |
else
override makefile_defs=1
export makefile_defs
|
a91ba01f |
ifeq ($(quiet),verbose) |
7742b1d2 |
$(info normal Makefile.defs exec) |
a91ba01f |
endif # verbose |
caf3128c |
|
dd15ae96 |
-include Makefile.vars
|
0b2d2c6e |
# usage: $(call set_if_empty,VAR,value)
set_if_empty=$(if $($(1)),,$(eval override $(1)=$(2)))
|
caf3128c |
# flavour: sip-router, ser or kamailio |
4af2262b |
$(call set_if_empty,FLAVOUR,kamailio) |
caf3128c |
|
82164081 |
#prefix for various configs and scripts
#config name/name-prefix for distributed configs |
e5dbe686 |
CFG_NAME?=sip-router |
82164081 |
#config name/name-prefix for distributed scripts
SCR_NAME=sip-router
#name in source tree
SRC_NAME=sip-router
|
caf3128c |
ifeq ($(FLAVOUR),sip-router) |
194b6a35 |
# main binary name |
e5dbe686 |
MAIN_NAME=ser |
caf3128c |
else ifeq ($(FLAVOUR),ser)
# main binary name |
e5dbe686 |
MAIN_NAME=ser |
caf3128c |
else ifeq ($(FLAVOUR),kamailio)
# main binary name |
e5dbe686 |
MAIN_NAME=kamailio |
82164081 |
# use kamailio config |
e5dbe686 |
CFG_NAME=kamailio |
82164081 |
# kamailio statistics on
KMSTATS ?= 1
# fast malloc statistics on
FMSTATS ?= 1 |
4af2262b |
else # unknown: |
caf3128c |
# main binary name |
e5dbe686 |
MAIN_NAME=kamailio |
caf3128c |
endif
|
01cbe8bf |
# application server support on
WITHAS ?= 1 |
7f8e7a85 |
# enable core hooks for SCTP
SCTP ?= 1 |
01cbe8bf |
|
caf3128c |
# what to install
INSTALL_FLAVOUR=$(FLAVOUR)
|
2e6675bd |
# version number |
e03be11d |
VERSION = 4 |
9f9b5608 |
PATCHLEVEL = 1 |
22f545d8 |
SUBLEVEL = 0 |
f8697d13 |
EXTRAVERSION = -dev9 |
247c2b65 |
|
15a0b9c2 |
# memory manager switcher
# 0 - f_malloc (fast malloc)
# 1 - q_malloc (quick malloc) |
d9640166 |
MEMMNG ?= 1 |
2c168f02 |
# memory debugger switcher |
15a0b9c2 |
# 0 - off (no-debug mode)
# 1 - on (debug mode) |
002b3b53 |
MEMDBG ?= 0 |
2c168f02 |
|
21a3adb3 |
SER_VER = $(shell expr $(VERSION) \* 1000000 + $(PATCHLEVEL) \* 1000 + \
$(SUBLEVEL) ) |
b89da7b7 |
RELEASE:=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
OS := $(shell uname -s | sed -e s/SunOS/solaris/ -e s/CYGWIN.*/cygwin/ \ |
03023127 |
| tr "[A-Z]" "[a-z]") |
473f6f2e |
ifeq ($(OS),solaris) |
b234c3ac |
GETARCH=isainfo -n
ifeq ($(GETARCH),) |
473f6f2e |
GETARCH=uname -p |
b234c3ac |
endif |
473f6f2e |
else
GETARCH=uname -m
endif
|
c46e7970 |
HOST_ARCH := $(shell $(GETARCH) |sed -e s/i.86/i386/ -e s/sun4[uv]/sparc64/ \ |
0db44da7 |
-e s/armv[3-5].*/arm/ -e s/armv6.*/arm6/ \
-e "s/Power Macintosh/ppc/" \ |
473f6f2e |
-e "s/cobalt/mips2/" \ |
b234c3ac |
-e s/amd64/x86_64/ -e s/sparcv9/sparc64/ ) |
473f6f2e |
# fix sparc -> sparc64 |
c46e7970 |
ifeq ($(HOST_ARCH),sparc) |
473f6f2e |
ifeq ($(shell uname -m),sun4u) |
c46e7970 |
HOST_ARCH := sparc64 |
473f6f2e |
endif |
b234c3ac |
ifeq ($(shell uname -m),sun4v) |
c46e7970 |
HOST_ARCH := sparc64 |
b234c3ac |
endif |
473f6f2e |
endif
|
b89da7b7 |
OSREL := $(shell uname -r) |
741a9937 |
# numerical version (good for comparisons: A.B.C => A*1000000+B*1000+C) |
b89da7b7 |
OSREL_N:= $(shell echo $(OSREL) | sed -e 's/^[^0-9]*//' \ |
741a9937 |
-e 's/^\([0-9][0-9]*\(\.[0-9][0-9]*\)*\).*$$/\1/g' | \ |
473f6f2e |
(IFS=. read A B C D; R=0; \ |
741a9937 |
[ -n "$$A" ] && R=`expr $$R \* 1000 + $$A` && \
[ -n "$$B" ] && R=`expr $$R \* 1000 + $$B` && \
[ -n "$$C" ] && R=`expr $$R \* 1000 + $$C`; echo $$R ) ) |
247c2b65 |
|
df67d63e |
|
f22b996b |
# TLS support |
6c53d41a |
CORE_TLS ?= |
14a93a9b |
# by default compile with tls hooks support (so that no ser recompile is
# needed before the tls module can be used)
TLS_HOOKS=1 |
6c53d41a |
ifeq ($(CORE_TLS), 1) |
346c7dab |
RELEASE:=$(RELEASE)-tls |
6c53d41a |
TLS_HOOKS:=0 |
346c7dab |
endif |
6c53d41a |
ifeq ($(TLS_HOOKS), 1) |
895cb2af |
# RELEASE:=$(RELEASE)-tls |
6c53d41a |
endif
|
1f2c924e |
# extra CC command line options (e.g -march=athlon-mp)
CC_EXTRA_OPTS ?= |
db1b5017 |
|
a2040154 |
# extra LD command line options
LD_EXTRA_OPTS ?= |
c82fe029 |
|
0bafb279 |
ifeq ($(OS), solaris)
#use GNU versions |
5b9b8d2e |
INSTALL ?= ginstall
TAR ?= gtar |
0bafb279 |
else |
7742b1d2 |
INSTALL ?= install |
5b9b8d2e |
TAR ?= tar |
0bafb279 |
endif |
054cb6cf |
|
28b28d2c |
INSTALL_TOUCH = touch # used to create the file first (good to |
15dde484 |
# make solaris install work) |
28b28d2c |
INSTALL_CFG = $(INSTALL) -m 644
INSTALL_BIN = $(INSTALL) -m 755 |
1c5f04ac |
INSTALL_SCRIPT = $(INSTALL) -m 755 |
28b28d2c |
INSTALL_MODULES = $(INSTALL) -m 755
INSTALL_LIB = $(INSTALL) -m 755
INSTALL_DOC = $(INSTALL) -m 644
INSTALL_MAN = $(INSTALL) -m 644 |
ee03be75 |
INSTALL_SHARE = $(INSTALL) -m 644 |
db1b5017 |
|
054cb6cf |
#set some vars from the environment (and not make builtins)
CC := $(shell echo "$${CC}")
LEX := $(shell echo "$${LEX}")
YACC := $(shell echo "$${YACC}")
|
db1b5017 |
|
176e7a13 |
# find compiler name & version
ifeq ($(CC),)
CC=gcc
endif
LD= $(CC) |
b89da7b7 |
CC_LONGVER:=$(shell if $(CC) -v 2>/dev/null; then \ |
176e7a13 |
$(CC) -v 2>&1 ;\
else \
$(CC) -V 2>&1 ; \
fi ) |
8d5f8bbc |
MKTAGS=ctags |
176e7a13 |
#find-out the compiler's name
ifneq (,$(findstring gcc, $(CC_LONGVER)))
CC_NAME=gcc |
ca492cdd |
RPAREN=) |
0f72c774 |
CC_VER:=$(word 1,$(CC)) $(shell $(CC) - --version|head -n 1|\ |
ca492cdd |
sed -e 's/([^$(RPAREN)]*)//g' \ |
0f72c774 |
-e 's/^.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/'\ |
ca492cdd |
-e 's/^[^0-9].*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/') |
0f72c774 |
# CC_VER:=$(word 1,$(CC)) $(shell $(CC) - --version|head -n 1|cut -d" " -f 3\
# |sed -e 's/^.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/'\
# -e 's/^[^0-9].*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/') |
eac2c677 |
# sed with POSIX.1 regex doesn't support |, + or ?
# (darwin, solaris ...) => this complicated expression |
5a9014ee |
MKDEP=$(CC) -MM -MG |
176e7a13 |
#transform gcc version into 2.9x or 3.0 |
b89da7b7 |
CC_SHORTVER:=$(shell echo "$(CC_VER)" | cut -d" " -f 2| \ |
176e7a13 |
sed -e 's/[^0-9]*-\(.*\)/\1/'| \ |
c925278b |
sed -e 's/2\.9.*/2.9x/' \
-e 's/3\.[0-3]\..*/3.0/' \
-e 's/3\.[0-3]/3.0/' \
-e 's/3\.[4-9]\..*/3.4/' \
-e 's/3\.[4-9]/3.4/' \
-e 's/4\.[0-1]\..*/4.x/' \
-e 's/4\.[0-1]/4.x/' \ |
184187a6 |
-e 's/4\.[2-4]\..*/4.2+/' \
-e 's/4\.[2-4]$$/4.2+/' \
-e 's/4\.[5-9]\..*/4.5+/' \
-e 's/4\.[5-9]$$/4.5+/')
ifeq (,$(strip $(filter-out 3.0 3.4 4.x 4.2+ 4.5+,$(CC_SHORTVER)))) |
5a9014ee |
# dependencies can be generated on-the-fly while compiling *.c
CC_MKDEP_OPTS=-MMD -MP
endif # 3.0 <= $(CC_SHORTVER) <= 4.x
endif # gcc |
176e7a13 |
ifneq (, $(findstring Sun, $(CC_LONGVER)))
CC_NAME=suncc |
b89da7b7 |
CC_SHORTVER:=$(shell echo "$(CC_LONGVER)"|head -n 1| \ |
176e7a13 |
sed -e 's/.*\([0-9]\.[0-9]\).*/\1/g' )
CC_VER=$(CC) $(CC_SHORTVER)
MKDEP=$(CC) -xM1
endif
ifneq (, $(findstring Intel(R) C++ Compiler, $(CC_LONGVER)))
# very nice: gcc compatible
CC_NAME=icc |
b89da7b7 |
CC_FULLVER:=$(shell echo "$(CC_LONGVER)"|head -n 1| \ |
176e7a13 |
sed -e 's/.*Version \([0-9]\.[0-9]\.[0-9]*\).*/\1/g' ) |
b89da7b7 |
CC_SHORTVER:=$(shell echo "$(CC_FULLVER)" | cut -d. -f1,2 ) |
176e7a13 |
CC_VER=$(CC) $(CC_FULLVER)
MKDEP=$(CC) -MM
endif
|
452c543d |
ifneq (, $(findstring clang, $(CC_LONGVER)))
#clang should be gcc compatible
CC_NAME=clang
CC_FULLVER:=$(shell echo "$(CC_LONGVER)" | head -n 1 | sed -e 's/.*version \([0-9]\.[0-9]\).*/\1/g' )
CC_SHORTVER:=$(shell echo "$(CC_FULLVER)" | cut -d. -f1,2 )
CC_VER=$(CC) $(CC_FULLVER)
MKDEP=$(CC) -MM
endif |
176e7a13 |
ifeq (,$(CC_NAME))
#not found
CC_NAME=$(CC)
CC_SHORTVER=unknown
CC_VER=unknown
MKDEP=gcc -MM
$(warning Unknown compiler $(CC)\; supported compilers: \
gcc, sun cc, intel icc )
endif
|
c46e7970 |
# ARCH detection
# predefined compiler macros for different architectures
# (see http://predef.sourceforge.net/prearch.html for a more complete list)
i386_macros= i386 __i386__ __i486__ __i586__ __i686__ \
__i386 _M_IX86 __X86__ _X86_
x86_64_macros= __amd64__ __amd64 __x86_64__ __x86_64 _M_X64
sparc_macros= __sparc__ __sparc __sparcv8
sparc64_macros= __sparcv9 __sparc_v9__
arm_macros= __arm__ __thumb__
arm6_macros= __ARM_ARCH_6__
ppc_macros= __powerpc __powerpc__ __POWERPC__ __ppc__ _ARCH_PPC
ppc64_macros= __ppc64__ _ARCH_PPC64
mips_macros= __mips__ __mips _MIPS_ARCH_MIPS1
mips2_macros= _MIPS_ISA_MIPS2 _MIPS_ISA_MIPS3 _MIPS_ISA_MIPS4 \
_MIPS_ARCH_MIPS2 _MIPS_ARCH_MIPS3 _MIPS_ARCH_MIPS4
mips64_macros= _MIPS_ISA_MIPS64 _MIPS_ARCH_MIPS64
alpha_macros= __alpha__ __alpha _M_ALPHA_
ifeq ($(CC_NAME),gcc)
#if gcc use gcc arch
predef_macros:=$(shell $(CC) -dM -E -x c $(CC_EXTRA_OPTS) $(extra_defs) \
$(CFLAGS) /dev/null)
ifneq ($(strip $(filter $(i386_macros), $(predef_macros))),)
CC_ARCH=i386
else ifneq ($(strip $(filter $(x86_64_macros), $(predef_macros))),)
CC_ARCH=x86_64
else ifneq ($(strip $(filter $(sparc_macros), $(predef_macros))),)
ifneq ($(strip $(filter $(sparc64_macros), $(predef_macros))),)
CC_ARCH=sparc64
else # sparc64_macros
CC_ARCH=sparc
endif # sparc64_macros
else ifneq ($(strip $(filter $(arm_macros), $(predef_macros))),)
ifneq ($(strip $(filter $(arm6_macros), $(predef_macros))),)
CC_ARCH=arm6
else # arm6_macros
CC_ARCH=arm
endif # arm6_macros
else ifneq ($(strip $(filter $(ppc64_macros), $(predef_macros))),)
CC_ARCH=ppc64
else ifneq ($(strip $(filter $(ppc_macros), $(predef_macros))),)
CC_ARCH=ppc
else ifneq ($(strip $(filter $(mips_macros), $(predef_macros))),)
ifneq ($(strip $(filter $(mips64_macros), $(predef_macros))),)
CC_ARCH=mips64
else ifneq ($(strip $(filter $(mips2_macros), $(predef_macros))),)
CC_ARCH=mips2
else # mips2_macros
CC_ARCH=mips
endif # mips64_macros
else ifneq ($(strip $(filter $(alpha_macros), $(predef_macros))),)
CC_ARCH=alpha
else
$(warn "Unknown target compiler architecture")
endif # predefined macros tests (x86_macros, ...)
endif # gcc
ifdef CC_ARCH
ARCH:=$(CC_ARCH)
else
ARCH:=$(HOST_ARCH)
endif |
a91ba01f |
$(info target architecture <$(ARCH)>, host architecture <$(HOST_ARCH)>) |
176e7a13 |
|
7bb701b7 |
LIBDIR ?=
ifeq ($(LIBDIR),)
ARCHBSZ= $(shell echo $(ARCH) | sed -e 's/.*64.*/64b/')
ifeq ($(ARCHBSZ),64b)
LIBDIR = lib64
else
LIBDIR = lib
endif
endif
# dirs
cfg_dir = etc/$(MAIN_NAME)/
bin_dir = sbin/
share_dir = share/$(MAIN_NAME)/
# lib/$(MAIN_NAME)/modules , lib/$(MAIN_NAME)/modules-s, lib/$(MAIN_NAME)/modules-k
modules_dir = $(LIBDIR)/$(MAIN_NAME)/
lib_dir = $(LIBDIR)/$(MAIN_NAME)/
doc_dir = doc/$(MAIN_NAME)/
man_dir = man/
data_dir = $(MAIN_NAME)/
ifeq ($(OS), linux)
doc_dir = share/doc/$(MAIN_NAME)/
man_dir = share/man/
data_dir = share/$(MAIN_NAME)/
LOCALBASE ?= /usr/local
endif
ifeq ($(OS), freebsd)
doc_dir = share/doc/$(MAIN_NAME)/
man_dir = man/
data_dir = share/$(MAIN_NAME)/
LOCALBASE ?= /usr/local
endif
ifeq ($(OS), openbsd)
doc_dir = share/doc/$(MAIN_NAME)/
man_dir = man/
data_dir = share/$(MAIN_NAME)/
LOCALBASE ?= /usr/local
endif
ifeq ($(OS), netbsd)
doc_dir = share/doc/$(MAIN_NAME)/
man_dir = man/
data_dir = share/$(MAIN_NAME)/
LOCALBASE ?= /usr/pkg
endif
ifeq ($(OS), dragonfly)
doc_dir = share/doc/$(MAIN_NAME)/
man_dir = man/
data_dir = share/$(MAIN_NAME)/
LOCALBASE ?= /usr/pkg
endif
ifeq ($(OS), darwin)
doc_dir = share/doc/$(MAIN_NAME)/
man_dir = man/
data_dir = share/$(MAIN_NAME)/
LOCALBASE ?= /usr/local
endif
LOCALBASE ?= /usr/local
# Doxygen directory
doxygen_dir=doc/doxygen
# install location
PREFIX ?= $(LOCALBASE)
prefix = $(PREFIX)
# install path is $(basedir) $(prefix)
# example:
# creating a bin. archive in /tmp, which unpacks in /usr/local
# basedir=/tmp
# prefix=/usr/local
BASEDIR ?= $(DESTDIR)
basedir = $(BASEDIR)
# install prefixes for various stuff
cfg_prefix = $(basedir)$(prefix)
bin_prefix = $(basedir)$(prefix)
modules_prefix = $(basedir)$(prefix)
lib_prefix = $(basedir)$(prefix)
doc_prefix = $(basedir)$(prefix)
man_prefix = $(basedir)$(prefix)
ut_prefix = $(basedir)$(prefix)
share_prefix = $(basedir)$(prefix)
data_prefix = $(basedir)$(prefix)
# target dirs for various stuff
cfg_target = $(prefix)/$(cfg_dir)
bin_target = $(prefix)/$(bin_dir)
#modules_target = $(prefix)/$(modules_dir)
lib_target = $(prefix)/$(lib_dir)
doc_target = $(prefix)/$(doc_dir)
data_target = $(prefix)/$(data_dir)
|
247c2b65 |
# compile-time options |
efd6c2fe |
#
# -DSTATS
# allows to print out number of packets processed on CTRL-C; |
247c2b65 |
# implementation still nasty and reports per-process |
efd6c2fe |
# -DNO_DEBUG |
247c2b65 |
# turns off some of the debug messages (DBG(...)). |
efd6c2fe |
# -DNO_LOG |
247c2b65 |
# completely turns of all the logging (and DBG(...)) |
efd6c2fe |
# -DEXTRA_DEBUG |
247c2b65 |
# compiles in some extra debugging code |
efd6c2fe |
# -DDNS_IP_HACK |
247c2b65 |
# faster ip address resolver for ip strings (e.g "127.0.0.1") |
efd6c2fe |
# -DSHM_MEM |
247c2b65 |
# compiles in shared mem. support, needed by some modules and
# by USE_SHM_MEM |
dcb5f364 |
# -DSHM_MMAP
# use mmap instead of SYSV shared memory |
efd6c2fe |
# -DPKG_MALLOC |
247c2b65 |
# uses a faster malloc (exclusive w/ USE_SHM_MEM) |
efd6c2fe |
# -DUSE_SHM_MEM
# all pkg_malloc => shm_malloc (most mallocs use a common sh. |
247c2b65 |
# mem. segment); don't define PKG_MALLOC if you want this!
# -DDBG_QM_MALLOC
# qm_malloc debug code, will cause pkg_malloc and shm_malloc
# to keep and display lot of debuging information: file name,
# function, line number of malloc/free call for each block,
# extra error checking (trying to free the same pointer
# twice, trying to free a pointer alloc'ed with a different
# malloc etc.) |
dda9dab1 |
# -DVQ_MALLOC
# additional option to PKG_MALLOC which utilizes a fater then
# qm version |
b2dec9c6 |
# (not true anymore, q_malloc performs approx. the same)
# -DF_MALLOC
# an even faster malloc, not recommended for debugging |
51ea5ec2 |
# -DDL_MALLOC
# a malloc implementation based on Doug Lea's dl_malloc |
fbe11914 |
# -DSF_MALLOC
# an experimental multi-CPU, pool based, multi-process safe version of
# F_MALLOC. Should give better performance on machines with lots of CPUs
# after some tunning.
# -DLL_MALLOC
# an experimental multi-CPU, pool based, multi-process safe, mostly
# lockless version of SF_MALLOC/F_MALLOC. Not for production use for
# now. |
ea6721d7 |
# -DDBG_MALLOC
# issues additional debugging information if lock/unlock is called |
d89420df |
# -DMEM_JOIN_FREE
# enable the join of free memory chunks (see also mem_join cfg param) |
b2dec9c6 |
# -DFAST_LOCK
# uses fast arhitecture specific locking (see the arh. specific section) |
e0135488 |
# -DUSE_SYSV_SEM
# uses sys v sems for locking (slower & limited number)
# -DUSE_PTHREAD_MUTEX
# uses pthread mutexes, faster than sys v or posix sems, but do not
# work on all systems inter-processes (e.g. linux)
# -DUSE_POSIX_SEM
# uses posix semaphores for locking (faster than sys v) |
8b8fc486 |
# -DUSE_FUTEX
# uses futexes for locking (linux 2.6+) |
30f1f956 |
# -DBUSY_WAIT |
06aaa54f |
# uses busy waiting on the lock (FAST_LOCK) |
30f1f956 |
# -DADAPTIVE_WAIT
# try busy waiting for a while and if the lock is still held go to |
06aaa54f |
# force reschedule (FAST_LOCK) |
30f1f956 |
# -DADAPTIVE_WAIT_LOOPS=number
# number of loops we busy wait, after "number" loops have elapsed we |
06aaa54f |
# force a reschedule (FAST_LOCK) |
30f1f956 |
# -DNOSMP
# don't use smp compliant locking (faster but won't work on SMP machines) |
06aaa54f |
# (not yet enabled) (FAST_LOCK) |
caf80ae6 |
# -DNO_PINGTEL_TAG_HACK
# if enabled, To-header-field will be less liberal and will not accept
# 'tag=' (tag parameter with equal sign and without value); it is called
# this way because such message was sighted from a Pingtel phone |
5b532c7f |
# -DUSE_TCP |
f22b996b |
# compiles in tcp support |
b33736bc |
# -DDISABLE_NAGLE
# disable the tcp Nagle algorithm (lower delay) |
f22b996b |
# -DUSE_TLS |
6c53d41a |
# compiles in tls support, requires -DUSE_TCP. Note: this is only
# generic support (parsing a.s.o.), it does not include the actual
# "tls engine". If you really want tls you need also either
# -DCORE_TLS and a tls/ subdir with the tls code or -DTLS_HOOKS and
# the tls module loaded.
# -DCORE_TLS
# compiles tls in-core support. Requires -DUSE_TLS, conflicts
# -DTLS_HOOKS. Please use make CORE_TLS=1 instead (it will set all the
# needed defines automatically and extra libraries needed for linking).
# -DTLS_HOOKS
# compile tls module support (support for having the "tls engine" in a
# module). Requires -DUSE_TLS, conflicts -DCORE_TLS.
# Please use make TLS_HOOKS=1 (or TLS_HOOKS=0 to for disabling) instead
# of setting -DTLS_HOOKS (it will set all the needed defines
# automatically) |
878fc194 |
# -DHAVE_RESOLV_RES
# support for changing some of the resolver parameters present
# (_res structure in <resolv.h>) |
7a068ff3 |
# -DUSE_COMP
# compiles in comp=[sergz|sigcomp] support (parsing uri & via,
# adding it to via, lumps a.s.o). WARNING: right now this option
# is useless since the compression code doesn't exist yet. |
17bae7f1 |
# -DHONOR_MADDR
# compiles in checks and use for maddr parameter in uri.
# Required to support Windows Messenger 5.x over TCP connection
# which (mis)uses this parameter. |
dcb59e67 |
# -DUSE_DNS_CACHE
# use an internal dns cache instead of making dns requests each time |
021e7e0e |
# -DUSE_DNS_CACHE_STATS
# turns on DNS cache measurements |
dcb59e67 |
# -DUSE_DNS_FAILOVER
# if the destination resolves to multiple ips, on send error fall back
# to the others
# -DUSE_DST_BLACKLIST
# blacklist bad destination (timeout, failed to connect, error sending
# a.s.o) |
021e7e0e |
# -DUSE_DST_BLACKLIST_STATS
# turns on blacklist bad destination measurements |
4fd7c9fd |
# -DPROFILING
# if enabled profiling will be enabled for child processes
# Don't forget to set PROFILE (see below) |
96d09107 |
# -DNO_SIG_DEBUG
# turns off debugging messages in signal handlers (which might be
# unsafe) |
dd4ffbb7 |
# -DUSE_NAPTR
# turns on naptr support (but must be also enabled from the config) |
f682fd71 |
# -DDNS_WATCHDOG_SUPPORT
# turns on DNS watchdog support which can be used to inform the
# core that the DNS servers are down. No DNS query is performed
# when the servers are unreachable, and even expired resource
# records are used from the cache. (requires external watchdog) |
d65cdd3f |
# -DWITH_AS_SUPPORT
# adds support for Application Server interface |
bc404f2b |
# Sometimes is needes correct non-quoted $OS. HACK: gcc translates known OS to number ('linux'), so there is added underscore |
96dd9e9f |
|
7d27010d |
ifeq ($(OS), dragonfly) |
c07c2b5e |
# Tell it that dragonflybsd is equivalent to compiling for freebsd, but
# define also __OS_dragonfly (for fine-tunning like kqueue support).
os_defs := -D__OS_freebsd -D__OS_dragonfly
EQUIV_OS = freebsd |
7d27010d |
else |
c07c2b5e |
os_defs := -D__OS_$(OS)
EQUIV_OS = $(OS) |
7d27010d |
endif
|
f072585d |
C_DEFS= $(extra_defs) \ |
dd0e65a8 |
-DNAME='"$(MAIN_NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \ |
c82fe029 |
-DOS='$(OS)_' -DOS_QUOTED='"$(OS)"' -DCOMPILER='"$(CC_VER)"'\ |
c07c2b5e |
-D__CPU_$(ARCH) $(os_defs) \ |
21a3adb3 |
-DSER_VER=$(SER_VER) \ |
28b28d2c |
-DCFG_DIR='"$(cfg_target)"'\ |
9b47a45c |
-DPKG_MALLOC \ |
51eadd0c |
-DSHM_MEM -DSHM_MMAP \ |
ba506d03 |
-DDNS_IP_HACK \ |
2ba73117 |
-DUSE_MCAST \ |
8aeb47e2 |
-DUSE_TCP \ |
b33736bc |
-DDISABLE_NAGLE \ |
878fc194 |
-DHAVE_RESOLV_RES \ |
dcb59e67 |
-DUSE_DNS_CACHE \
-DUSE_DNS_FAILOVER \
-DUSE_DST_BLACKLIST \ |
dd4ffbb7 |
-DUSE_NAPTR \ |
bcd4c3fe |
-DWITH_XAVP \ |
021e7e0e |
#-DUSE_DNS_CACHE_STATS \
#-DUSE_DST_BLACKLIST_STATS \ |
f682fd71 |
#-DDNS_WATCHDOG_SUPPORT \ |
fbe11914 |
#-DLL_MALLOC \
#-DSF_MALLOC \ |
51ea5ec2 |
#-DDL_MALLOC \ |
08bf96f2 |
#-DDBG_F_MALLOC \ |
bfd94206 |
#-DNO_DEBUG \ |
ca20b615 |
#-DEXTRA_DEBUG \ |
08bf96f2 |
#-DVQ_MALLOC \
#-DDBG_LOCK \ |
db829953 |
#-DNOSMP \ |
e5bcdb99 |
#-DUSE_SHM_MEM \
#-DSTATS \ |
4fd7c9fd |
#-DNO_LOG \ |
96d09107 |
#-DPROFILING \
#-DNO_SIG_DEBUG |
b2dec9c6 |
|
4fd7c9fd |
#PROFILE= -pg # set this if you want profiling
# you may also want to set -DPROFILING |
6419a43f |
# WARNING: do not add mode=debug or mode=release anymore in the Makefile,
# use make mode=debug all instead. Anyway no by default ser is compiled w/
# debugging symbols in all cases (-g). --andrei |
f22b996b |
|
15a0b9c2 |
# set memory manager and its debug mode
ifeq ($(MEMMNG), 1)
# use q_malloc
ifeq ($(MEMDBG), 1)
C_DEFS+= -DDBG_QM_MALLOC
endif |
d89420df |
C_DEFS+= -DMEM_JOIN_FREE |
2c168f02 |
else |
15a0b9c2 |
# use f_malloc |
2c168f02 |
C_DEFS+= -DF_MALLOC |
15a0b9c2 |
ifeq ($(MEMDBG), 1)
C_DEFS+= -DDBG_F_MALLOC
endif |
c2ca22fa |
C_DEFS+= -DMEM_JOIN_FREE |
2c168f02 |
endif |
15a0b9c2 |
|
bdc85a8c |
ifneq ($(PKG_MEM_SIZE),)
C_DEFS+= -DPKG_MEM_SIZE=$(PKG_MEM_SIZE)
endif |
6c53d41a |
ifeq ($(CORE_TLS), 1) |
f072585d |
C_DEFS+= -DUSE_TLS -DCORE_TLS |
6c53d41a |
endif
ifeq ($(TLS_HOOKS), 1) |
f072585d |
C_DEFS+= -DUSE_TLS -DTLS_HOOKS |
f22b996b |
endif |
6343018d |
ifeq ($(KMSTATS), 1) |
1010c358 |
C_DEFS+= -DUSE_CORE_STATS -DSTATISTICS |
6343018d |
endif |
82164081 |
ifeq ($(FMSTATS), 1)
C_DEFS+= -DMALLOC_STATS
endif |
f821c005 |
ifeq ($(WITHAS), 1)
C_DEFS+= -DWITH_AS_SUPPORT
endif |
f22b996b |
|
054cb6cf |
ifeq ($(mode),)
mode = release
endif |
247c2b65 |
|
f2e456c3 |
ifeq ($(mode),debug) |
f072585d |
C_DEFS+= -DEXTRA_DEBUG |
f2e456c3 |
endif
|
247c2b65 |
# platform dependent settings
|
85f1f3ee |
# find ld & as name (gnu or solaris) |
473f6f2e |
ifeq ($(OS), solaris) |
629fca1e |
ifeq ($(CC_NAME), gcc) |
b89da7b7 |
LDGCC:=$(shell $(CC) -v 2>&1 | grep with-ld| \ |
629fca1e |
sed -e 's/.*--with-ld=\([^ ][^ ]*\).*/\1/' ) |
b89da7b7 |
ASGCC:=$(shell $(CC) -v 2>&1 | grep with-as| \ |
85f1f3ee |
sed -e 's/.*--with-as=\([^ ][^ ]*\).*/\1/' ) |
b89da7b7 |
LDPATH:=$(shell if [ -z "$(LDGCC)" ] ; then echo "ld" ;\ |
629fca1e |
else \
if $(LDGCC) -V 2>/dev/null 1>/dev/null; then \
echo $(LDGCC); \
else echo "ld" ; \
fi\
fi) |
b89da7b7 |
ASPATH:=$(shell if [ -z "$(ASGCC)" ] ; then echo "as" ;\ |
85f1f3ee |
else \ |
0f7ec046 |
if $(ASGCC) -V 2>/dev/null 1>/dev/null </dev/null; \
then \ |
85f1f3ee |
echo $(ASGCC); \
else echo "as" ; \
fi\
fi)
|
b89da7b7 |
LDTYPE:=$(shell if $(LDPATH) -V 1>/dev/null 2>/dev/null; then \ |
629fca1e |
if $(LDPATH) -V 2>&1|grep GNU >/dev/null; \
then echo gnu; \
else \
if $(LDPATH) -V 2>&1|grep Solaris >/dev/null;\
then echo solaris; \
else \
echo unknown ; \
fi \
fi \
fi) |
b89da7b7 |
ASTYPE:=$(shell if $(ASPATH) -V 1>/dev/null 2>/dev/null </dev/null; \ |
85f1f3ee |
then \ |
b89da7b7 |
if $(ASPATH) -V 2>&1 </dev/null | \
grep GNU >/dev/null; then echo gnu; \ |
85f1f3ee |
else \ |
b89da7b7 |
if $(ASPATH) -V 2>&1 </dev/null | \
grep Sun >/dev/null; then echo solaris; \ |
85f1f3ee |
else \
echo unknown ; \
fi \
fi \
fi)
#$(warning "using ld=$(LDPATH)/$(LDTYPE), as=$(ASPATH)/$(ASTYPE)")
|
629fca1e |
endif
endif |
11ece359 |
|
03023127 |
# arch. specific definitions |
43fcad56 |
ifeq ($(ARCH), i386) |
e0135488 |
use_fast_lock=yes |
43fcad56 |
endif
|
4d080f49 |
ifeq ($(ARCH), x86_64)
use_fast_lock=yes
endif
|
85f1f3ee |
ifeq ($(ARCH), sparc64) |
43fcad56 |
ifeq ($(CC_NAME), gcc) |
e0135488 |
use_fast_lock=yes |
43fcad56 |
endif
endif
|
245b8b93 |
ifeq ($(ARCH), sparc)
use_fast_lock=yes
endif
|
087d0976 |
ifeq ($(ARCH), arm) |
e0135488 |
use_fast_lock=yes |
f072585d |
C_DEFS+=-DNOSMP # very unlikely to have an smp arm |
0db44da7 |
endif
ifeq ($(ARCH), arm6)
use_fast_lock=yes |
0f7bc9da |
C_DEFS+=-DNOSMP # very unlikely to have an smp arm |
733a6458 |
endif
|
523768d2 |
ifeq ($(ARCH), ppc) |
e0135488 |
use_fast_lock=yes
endif
|
871a6a07 |
ifeq ($(ARCH), ppc64)
use_fast_lock=yes
endif
|
06aaa54f |
ifeq ($(ARCH), mips)
# mips1 arch. (e.g. R3000) - no hardware locking support
use_fast_lock=no |
f072585d |
C_DEFS+=-DMIPS_HAS_LLSC # likely
C_DEFS+=-DNOSMP # very likely |
06aaa54f |
endif
|
5ffcc5d0 |
ifeq ($(ARCH), mips2)
# mips2 arch and newer (mips3=R4000, mips4=R5000 a.s.o)
use_fast_lock=yes
endif
|
0db44da7 |
ifeq ($(ARCH), mips64)
# mips2 arch and newer (mips3=R4000, mips4=R5000 a.s.o)
use_fast_lock=yes
endif
|
871a6a07 |
ifeq ($(ARCH), alpha)
use_fast_lock=yes |
f072585d |
C_DEFS+=-DNOSMP # very likely |
871a6a07 |
endif
|
e0135488 |
ifeq ($(use_fast_lock), yes) |
f072585d |
C_DEFS+= -DFAST_LOCK -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 |
e0135488 |
found_lock_method=yes |
523768d2 |
endif
|
054cb6cf |
CFLAGS= |
74250efc |
LDFLAGS= |
f072585d |
C_INCLUDES= |
11ece359 |
# setting CFLAGS |
247c2b65 |
ifeq ($(mode), release) |
11ece359 |
#if i386
ifeq ($(ARCH), i386)
# if gcc |
452c543d |
ifeq ($(CC_NAME), gcc) |
f072585d |
C_DEFS+=-DCC_GCC_LIKE_ASM |
51eadd0c |
#common stuff |
c69ee0ff |
CFLAGS=-g -O9 -funroll-loops -Wcast-align $(PROFILE) |
184187a6 |
#if gcc 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+,$(CC_SHORTVER)))) |
0b2d2c6e |
$(call set_if_empty,CPU,athlon64) |
c69ee0ff |
CFLAGS+=-m32 -minline-all-stringops \ |
9558980b |
-falign-loops \
-ftree-vectorize \
-fno-strict-overflow \
-mtune=$(CPU) |
c69ee0ff |
LDFLAGS+=-m32 |
9558980b |
else |
e0931fb0 |
#if gcc 4.0+
ifeq ($(CC_SHORTVER), 4.x) |
0b2d2c6e |
$(call set_if_empty,CPU,athlon64) |
c69ee0ff |
CFLAGS+=-m32 -minline-all-stringops \ |
e0931fb0 |
-falign-loops \
-ftree-vectorize \
-mtune=$(CPU) |
c69ee0ff |
LDFLAGS+=-m32 |
e0931fb0 |
else |
88d3fa6d |
#if gcc 3.4+
ifeq ($(CC_SHORTVER), 3.4) |
0b2d2c6e |
$(call set_if_empty,CPU,athlon) |
c69ee0ff |
CFLAGS+=-m32 -minline-all-stringops \ |
88d3fa6d |
-falign-loops \
-mtune=$(CPU) |
c69ee0ff |
LDFLAGS+=-m32 |
88d3fa6d |
else
#if gcc 3.0+ |
11ece359 |
ifeq ($(CC_SHORTVER), 3.0) |
0b2d2c6e |
$(call set_if_empty,CPU,athlon) |
a31a6e8c |
CFLAGS+=-minline-all-stringops \ |
65531ed9 |
-falign-loops \ |
c69ee0ff |
-mcpu=$(CPU)
# -m32 supported since gcc 3.2 |
11ece359 |
else
ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5]) |
2510051e |
$(warning Old gcc detected ($(CC_SHORTVER)), use gcc >= 3.1 \ |
11ece359 |
for better results)
CFLAGS+=-m486 \
-malign-loops=4
else
#really old version
$(warning You are using an old and unsupported gcc \ |
65531ed9 |
version ($(CC_SHORTVER)), compile at your own risk!) |
11ece359 |
endif # CC_SHORTVER, 2.9x
endif # CC_SHORTVER, 3.0 |
88d3fa6d |
endif # CC_SHORTVER, 3.4 |
e0931fb0 |
endif # CC_SHORTVER, 4.x |
184187a6 |
endif # CC_SHORTVER, 4.5+ or 4.2+ |
11ece359 |
else # CC_NAME, gcc |
452c543d |
ifeq ($(CC_NAME), clang)
$(call set_if_empty,CPU,athlon64)
C_DEFS+=-DCC_GCC_LIKE_ASM
CFLAGS+=-m32 |
5273948a |
-O9 \ |
452c543d |
\ |
5273948a |
-mtune=$(CPU) |
452c543d |
LDFLAGS+=-m32
else # CC_NAME, clang |
9c61e9f9 |
ifeq ($(CC_NAME), icc) |
f072585d |
C_DEFS+=-DCC_GCC_LIKE_ASM |
6419a43f |
CFLAGS=-g -O3 -ipo -ipo_obj -unroll $(PROFILE) \ |
9c61e9f9 |
-tpp6 -xK #-openmp #optimize for PIII
# -prefetch doesn't seem to work
#( ty to inline acroos files, unroll loops,prefetch,
# optimize for PIII, use PIII instructions & vect.,
# mutlithread loops)
else |
11ece359 |
#other compilers
$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc) |
9c61e9f9 |
endif #CC_NAME, icc |
452c543d |
endif #CC_NAME, clang |
11ece359 |
endif #CC_NAME, gcc
endif #ARCH, i386
|
4d080f49 |
#x86_64
ifeq ($(ARCH), x86_64)
# if gcc
ifeq ($(CC_NAME), gcc) |
f072585d |
C_DEFS+=-DCC_GCC_LIKE_ASM |
4d080f49 |
#common stuff |
c69ee0ff |
CFLAGS=-g -O9 -funroll-loops -Wcast-align $(PROFILE) |
184187a6 |
#if gcc 4.5+ |
c925278b |
# don't add '-mtune=$(CPU)' - gcc failure |
184187a6 |
ifeq ($(CC_SHORTVER), 4.5+) |
c925278b |
$(call set_if_empty,CPU,opteron)
CFLAGS+=-m64 -minline-all-stringops \
-falign-loops \
-ftree-vectorize \
-fno-strict-overflow
LDFLAGS+=-m64
else |
9558980b |
#if gcc 4.2+
ifeq ($(CC_SHORTVER), 4.2+) |
0b2d2c6e |
$(call set_if_empty,CPU,opteron) |
c69ee0ff |
CFLAGS+=-m64 -minline-all-stringops \ |
9558980b |
-falign-loops \
-ftree-vectorize \
-fno-strict-overflow \
-mtune=$(CPU) |
c69ee0ff |
LDFLAGS+=-m64 |
9558980b |
else |
e0931fb0 |
#if gcc 4.0+
ifeq ($(CC_SHORTVER), 4.x) |
0b2d2c6e |
$(call set_if_empty,CPU,opteron) |
c69ee0ff |
CFLAGS+=-m64 -minline-all-stringops \ |
e0931fb0 |
-falign-loops \
-ftree-vectorize \
-mtune=$(CPU) |
c69ee0ff |
LDFLAGS+=-m64 |
e0931fb0 |
else |
88d3fa6d |
#if gcc 3.4
ifeq ($(CC_SHORTVER), 3.4) |
0b2d2c6e |
$(call set_if_empty,CPU,athlon64) |
c69ee0ff |
CFLAGS+=-m64 -minline-all-stringops \ |
88d3fa6d |
-falign-loops |
c69ee0ff |
LDFLAGS+=-m64 |
88d3fa6d |
else |
4d080f49 |
#if gcc 3.0
ifeq ($(CC_SHORTVER), 3.0) |
0b2d2c6e |
$(call set_if_empty,CPU,athlon64) |
4d080f49 |
CFLAGS+=-minline-all-stringops \ |
88d3fa6d |
-falign-loops |
664b2784 |
#-mcpu=$(CPU) \ # not working on all x86_64 gccs |
4d080f49 |
#-mcpu=athlon |
c69ee0ff |
#-m64 on x86_64/x86 works starting with gcc 3.2 |
4d080f49 |
else
ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
$(warning Old gcc detected ($(CC_SHORTVER)), use gcc >= 3.1 \
for better results)
CFLAGS+=-m486 \
-malign-loops=4
else
#really old version
$(warning You are using an old and unsupported gcc \
version ($(CC_SHORTVER)), compile at your own risk!)
endif # CC_SHORTVER, 2.9x
endif # CC_SHORTVER, 3.0 |
88d3fa6d |
endif # CC_SHORTVER, 3.4 |
e0931fb0 |
endif # CC_SHORTVER, 4.x |
9558980b |
endif # CC_SHORTVER, 4.2+ |
184187a6 |
endif # CC_SHORTVER, 4.5+ |
4d080f49 |
else # CC_NAME, gcc |
452c543d |
ifeq ($(CC_NAME), clang)
$(call set_if_empty,CPU,opteron)
C_DEFS+=-DCC_GCC_LIKE_ASM
CFLAGS+=-m64 \ |
5273948a |
-O9 |
452c543d |
LDFLAGS+=-m64
else # CC_NAME, clang |
4d080f49 |
ifeq ($(CC_NAME), icc) |
f072585d |
C_DEFS+=-DCC_GCC_LIKE_ASM |
4d080f49 |
CFLAGS=-g -O3 -ipo -ipo_obj -unroll $(PROFILE) \
-tpp6 -xK #-openmp #optimize for PIII
# -prefetch doesn't seem to work
#( ty to inline acroos files, unroll loops,prefetch,
# optimize for PIII, use PIII instructions & vect.,
# mutlithread loops)
else
#other compilers
$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
endif #CC_NAME, icc |
452c543d |
endif #CC_NAME, clang |
4d080f49 |
endif #CC_NAME, gcc
endif #ARCH, x86_64 |
11ece359 |
|
d307929c |
#if sparc64 |
85f1f3ee |
ifeq ($(ARCH), sparc64) |
11ece359 |
#if gcc
ifeq ($(CC_NAME), gcc) |
f072585d |
C_DEFS+=-DCC_GCC_LIKE_ASM -DSPARC64_MODE |
51eadd0c |
#common stuff |
c69ee0ff |
CFLAGS=-g -O9 -funroll-loops $(PROFILE) \ |
462cf6f9 |
#-Wcast-align \
#-Wmissing-prototypes |
184187a6 |
#if gcc 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+,$(CC_SHORTVER)))) |
0b2d2c6e |
$(call set_if_empty,CPU,ultrasparc) |
9558980b |
#use 32bit for now |
c69ee0ff |
CFLAGS+=-m64 -mcpu=ultrasparc \ |
9558980b |
-mtune=$(CPU) \
-fno-strict-overflow \
-ftree-vectorize |
c69ee0ff |
# use -m64 to force 64 bit (but add it also to LDFLAGS and
# don't forget to define SPARC64_MODE)
# -m32 for 32 bit (default on solaris),
# nothing for arch. default
LDFLAGS+=-m64 |
9558980b |
else |
e0931fb0 |
#if gcc 4.x
ifeq ($(CC_SHORTVER), 4.x) |
0b2d2c6e |
$(call set_if_empty,CPU,ultrasparc) |
e0931fb0 |
#use 32bit for now |
c69ee0ff |
CFLAGS+=-m64 -mcpu=ultrasparc \ |
e0931fb0 |
-mtune=$(CPU) \
-ftree-vectorize |
c69ee0ff |
LDFLAGS+=-m64 |
e0931fb0 |
else |
88d3fa6d |
#if gcc 3.4
ifeq ($(CC_SHORTVER), 3.4) |
0b2d2c6e |
$(call set_if_empty,CPU,ultrasparc) |
88d3fa6d |
#use 32bit for now |
c69ee0ff |
CFLAGS+=-m64 -mcpu=ultrasparc -mtune=$(CPU)
LDFLAGS+=-m64 |
88d3fa6d |
else |
11ece359 |
#if gcc 3.0
ifeq ($(CC_SHORTVER), 3.0) |
0b2d2c6e |
$(call set_if_empty,CPU,ultrasparc) |
11ece359 |
#use 32bit for now |
c69ee0ff |
CFLAGS+=-m64 -mcpu=ultrasparc -mtune=$(CPU) \ |
11ece359 |
# -mcpu=v9 or ultrasparc? # -mtune implied by -mcpu
#-mno-epilogue #try to inline function exit code
#-mflat # omit save/restore
#-,faster-structs #faster non Sparc ABI structure copy ops |
c69ee0ff |
LDFLAGS+=-m64 |
11ece359 |
else # CC_SHORTVER, 3.0
ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5]) |
2510051e |
$(warning Old gcc detected ($(CC_SHORTVER)), use gcc >= 3.1 \ |
11ece359 |
for better results) |
85f1f3ee |
ifneq ($(OS), netbsd)
# on netbsd/sparc64, gcc 2.95.3 does not compile
# ser with -mv8 |
d307929c |
CFLAGS+= -mv9 |
c69ee0ff |
# -m64/-m32 on sparc works starting with gcc 3.0 |
85f1f3ee |
endif
ifeq ($(ASTYPE), solaris)
CFLAGS+= -Wa,-xarch=v8plus
endif |
11ece359 |
else #CC_SHORTVER, 2.9x
#really old version
$(warning You are using an old and unsupported gcc \
version ($(CC_SHORTVER)), compile at your own risk!)
|
d307929c |
CFLAGS+= -mv9 |
85f1f3ee |
ifeq ($(ASTYPE), solaris)
CFLAGS+= -Wa,-xarch=v8plus
endif
|
11ece359 |
endif #CC_SHORTVER, 2.9x
endif #CC_SHORTVER, 3.0 |
88d3fa6d |
endif #CC_SHORTVER, 3.4 |
e0931fb0 |
endif #CC_SHORTVER, 4.x |
184187a6 |
endif #CC_SHORTVER, 4.5+ or 4.2+ |
d307929c |
|
11ece359 |
else #CC_NAME, gcc |
51eadd0c |
ifeq ($(CC_NAME), suncc) |
f072585d |
C_DEFS+=-DSPARC64_MODE |
d307929c |
CFLAGS+= -m64 -g -xO5 -fast -native -xarch=v9 -xCC \ |
51eadd0c |
-xc99 # C99 support
# -Dinline="" # add this if cc < 5.3 (define inline as null)
else |
11ece359 |
#other compilers
$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc) |
51eadd0c |
endif #CC_NAME, suncc |
11ece359 |
endif #CC_NAME, gcc |
245b8b93 |
endif #ARCH, sparc64 |
11ece359 |
|
d307929c |
#if sparc
ifeq ($(ARCH), sparc)
#if gcc
ifeq ($(CC_NAME), gcc) |
f072585d |
C_DEFS+=-DCC_GCC_LIKE_ASM |
d307929c |
#common stuff
CFLAGS=-g -O9 -funroll-loops $(PROFILE) \
#-Wcast-align \
#-Wmissing-prototypes |
184187a6 |
#if gcc 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+,$(CC_SHORTVER)))) |
0b2d2c6e |
$(call set_if_empty,CPU,v8) |
9558980b |
#use 32bit for now |
c46e7970 |
CFLAGS+= -mtune=$(CPU) \ |
9558980b |
-fno-strict-overflow \
-ftree-vectorize
else |
d307929c |
#if gcc 4.x
ifeq ($(CC_SHORTVER), 4.x) |
0b2d2c6e |
$(call set_if_empty,CPU,v8) |
d307929c |
#use 32bit for now |
c46e7970 |
CFLAGS+= -mtune=$(CPU) \ |
d307929c |
-ftree-vectorize
else
#if gcc 3.4
ifeq ($(CC_SHORTVER), 3.4) |
0b2d2c6e |
$(call set_if_empty,CPU,v8) |
d307929c |
#use 32bit for now
CFLAGS+= -mtune=$(CPU)
else
#if gcc 3.0
ifeq ($(CC_SHORTVER), 3.0) |
0b2d2c6e |
$(call set_if_empty,CPU,v8) |
d307929c |
#use 32bit for now
CFLAGS+= -mtune=$(CPU) \
#-mno-epilogue #try to inline function exit code
#-mflat # omit save/restore
#-,faster-structs #faster non Sparc ABI structure copy ops
else # CC_SHORTVER, 3.0
ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
$(warning Old gcc detected ($(CC_SHORTVER)), use gcc >= 3.1 \
for better results)
else #CC_SHORTVER, 2.9x
#really old version
$(warning You are using an old and unsupported gcc \
version ($(CC_SHORTVER)), compile at your own risk!)
endif #CC_SHORTVER, 2.9x
endif #CC_SHORTVER, 3.0
endif #CC_SHORTVER, 3.4
endif #CC_SHORTVER, 4.x |
184187a6 |
endif #CC_SHORTVER, 4.5+ or 4.2+ |
d307929c |
else #CC_NAME, gcc
ifeq ($(CC_NAME), suncc)
CFLAGS+= -g -xO5 -fast -native -xCC \
-xc99 # C99 support
# -Dinline="" # add this if cc < 5.3 (define inline as null)
else
#other compilers
$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
endif #CC_NAME, suncc
endif #CC_NAME, gcc
endif #ARCH, sparc
|
8c141481 |
#if ipaq/netwinder |
087d0976 |
ifeq ($(ARCH), arm) |
8c141481 |
# if gcc
ifeq ($(CC_NAME), gcc) |
f072585d |
C_DEFS+=-DCC_GCC_LIKE_ASM |
8c141481 |
#common stuff |
e916a468 |
CFLAGS=-marm -march=armv5t -O9 -funroll-loops -fsigned-char $(PROFILE) |
184187a6 |
#if gcc 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+,$(CC_SHORTVER)))) |
9558980b |
CFLAGS+= -ftree-vectorize -fno-strict-overflow
# not supported on arm: -minline-all-stringops
else |
e0931fb0 |
#if gcc 4.x+
ifeq ($(CC_SHORTVER), 4.x) |
0db44da7 |
CFLAGS+= -ftree-vectorize
# not supported on arm: -minline-all-stringops |
e0931fb0 |
else |
88d3fa6d |
#if gcc 3.4+
ifeq ($(CC_SHORTVER), 3.4) |
0db44da7 |
CFLAGS+= |
88d3fa6d |
else |
8c141481 |
#if gcc 3.0
ifeq ($(CC_SHORTVER), 3.0) |
0db44da7 |
CFLAGS+= |
8c141481 |
#-mcpu=athlon
else
ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
$(warning Old gcc detected ($(CC_SHORTVER)), use gcc 3.0.x \
for better results)
CFLAGS+=
else
#really old version
$(warning You are using an old and unsupported gcc \
version ($(CC_SHORTVER)), compile at your own risk!) |
06aaa54f |
|
8c141481 |
endif # CC_SHORTVER, 2.9x
endif # CC_SHORTVER, 3.0 |
88d3fa6d |
endif # CC_SHORTVER, 3.4 |
9558980b |
endif # CC_SHORTVER, 4.x |
184187a6 |
endif # CC_SHORTVER, 4.5+ or 4.2+ |
06aaa54f |
else # CC_NAME, gcc
#other compilers
$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
endif #CC_NAME, gcc
endif #ARCH, arm |
8c141481 |
|
0db44da7 |
#if armv6 cpu
ifeq ($(ARCH), arm6)
# if gcc
ifeq ($(CC_NAME), gcc) |
f072585d |
C_DEFS+=-DCC_GCC_LIKE_ASM |
0db44da7 |
#common stuff |
4ef2fe37 |
CFLAGS=-march=armv6 -O9 -funroll-loops -fsigned-char \ |
c8907870 |
$(PROFILE) |
184187a6 |
#if gcc 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+,$(CC_SHORTVER)))) |
9558980b |
CFLAGS+= -ftree-vectorize -fno-strict-overflow
else |
0db44da7 |
#if gcc 4.x+
ifeq ($(CC_SHORTVER), 4.x)
CFLAGS+= -ftree-vectorize
else
#if gcc 3.4+
ifeq ($(CC_SHORTVER), 3.4)
CFLAGS+=
else
#if gcc 3.0
ifeq ($(CC_SHORTVER), 3.0)
CFLAGS+=
#-mcpu=athlon
else
ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
$(warning Old gcc detected ($(CC_SHORTVER)), use gcc 3.0.x \
for better results)
CFLAGS+=
else
#really old version
$(warning You are using an old and unsupported gcc \
version ($(CC_SHORTVER)), compile at your own risk!)
endif # CC_SHORTVER, 2.9x
endif # CC_SHORTVER, 3.0
endif # CC_SHORTVER, 3.4 |
9558980b |
endif # CC_SHORTVER, 4.x |
184187a6 |
endif # CC_SHORTVER, 4.5+ or 4.2+ |
0db44da7 |
else # CC_NAME, gcc
#other compilers
$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
endif #CC_NAME, gcc
endif #ARCH, arm6
|
06aaa54f |
#if mips (R3000)
ifeq ($(ARCH), mips)
# if gcc
ifeq ($(CC_NAME), gcc) |
f072585d |
C_DEFS+=-DCC_GCC_LIKE_ASM |
06aaa54f |
#common stuff |
c8907870 |
CFLAGS=-O9 -funroll-loops $(PROFILE) |
184187a6 |
#if gcc 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+,$(CC_SHORTVER)))) |
9558980b |
CFLAGS+=-march=r3000 -minline-all-stringops \
-ftree-vectorize -fno-strict-overflow
else |
e0931fb0 |
#if gcc 4.0+
ifeq ($(CC_SHORTVER), 4.x) |
e960e1e6 |
CFLAGS+=-march=r3000 -minline-all-stringops \ |
e0931fb0 |
-ftree-vectorize
else |
88d3fa6d |
#if gcc 3.4+
ifeq ($(CC_SHORTVER), 3.4) |
e960e1e6 |
CFLAGS+= -march=r3000 |
88d3fa6d |
else |
06aaa54f |
#if gcc 3.0
ifeq ($(CC_SHORTVER), 3.0) |
e960e1e6 |
CFLAGS+= -march=r3000 |
06aaa54f |
else
ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
$(warning Old gcc detected ($(CC_SHORTVER)), use gcc 3.0.x \
for better results)
|
e960e1e6 |
CFLAGS+=-march=r3000 |
06aaa54f |
else
#really old version
$(warning You are using an old and unsupported gcc \
version ($(CC_SHORTVER)), compile at your own risk!)
endif # CC_SHORTVER, 2.9x
endif # CC_SHORTVER, 3.0 |
88d3fa6d |
endif # CC_SHORTVER, 3.4 |
e0931fb0 |
endif # CC_SHORTVER, 4.x |
184187a6 |
endif # CC_SHORTVER, 4.5+ or 4.2+ |
06aaa54f |
|
8c141481 |
else # CC_NAME, gcc
#other compilers
$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
endif #CC_NAME, gcc |
06aaa54f |
endif #ARCH, mips |
8c141481 |
|
5ffcc5d0 |
#if >=mips2 (R4000, R5000, R6000 ....)
ifeq ($(ARCH), mips2)
# if gcc
ifeq ($(CC_NAME), gcc) |
f072585d |
C_DEFS+=-DCC_GCC_LIKE_ASM |
5ffcc5d0 |
#common stuff |
c8907870 |
CFLAGS= -mips2 -O9 -funroll-loops $(PROFILE) |
184187a6 |
#if gcc 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+,$(CC_SHORTVER)))) |
9558980b |
CFLAGS+=-minline-all-stringops -ftree-vectorize \
-fno-strict-overflow
else |
e0931fb0 |
#if gcc 4.0+
ifeq ($(CC_SHORTVER), 4.x)
CFLAGS+=-minline-all-stringops -ftree-vectorize
else |
88d3fa6d |
#if gcc 3.4+
ifeq ($(CC_SHORTVER), 3.4)
CFLAGS+=
else |
5ffcc5d0 |
#if gcc 3.0
ifeq ($(CC_SHORTVER), 3.0)
CFLAGS+=
else
ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
$(warning Old gcc detected ($(CC_SHORTVER)), use gcc 3.0.x \
for better results)
CFLAGS+=
else
#really old version
$(warning You are using an old and unsupported gcc \
version ($(CC_SHORTVER)), compile at your own risk!)
endif # CC_SHORTVER, 2.9x
endif # CC_SHORTVER, 3.0 |
88d3fa6d |
endif # CC_SHORTVER, 3.4 |
e0931fb0 |
endif # CC_SHORTVER, 4.x |
184187a6 |
endif # CC_SHORTVER, 4.5+ or 4.2+ |
5ffcc5d0 |
else # CC_NAME, gcc
#other compilers
$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
endif #CC_NAME, gcc
endif #ARCH, mips2 |
8c141481 |
|
0db44da7 |
#if >=mips64
ifeq ($(ARCH), mips64)
# if gcc
ifeq ($(CC_NAME), gcc) |
f072585d |
C_DEFS+=-DCC_GCC_LIKE_ASM |
0db44da7 |
#common stuff |
c8907870 |
CFLAGS= -mips64 -O9 -funroll-loops $(PROFILE) |
184187a6 |
#if gcc 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+,$(CC_SHORTVER)))) |
9558980b |
CFLAGS+=-minline-all-stringops -ftree-vectorize \
-fno-strict-overflow
else |
0db44da7 |
#if gcc 4.0+
ifeq ($(CC_SHORTVER), 4.x)
CFLAGS+=-minline-all-stringops -ftree-vectorize
else
#if gcc 3.4+
ifeq ($(CC_SHORTVER), 3.4)
CFLAGS+=
else
#if gcc 3.0
ifeq ($(CC_SHORTVER), 3.0)
CFLAGS+=
else
ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
$(warning Old gcc detected ($(CC_SHORTVER)), use gcc 3.0.x \
for better results)
CFLAGS+=
else
#really old version
$(warning You are using an old and unsupported gcc \
version ($(CC_SHORTVER)), compile at your own risk!)
endif # CC_SHORTVER, 2.9x
endif # CC_SHORTVER, 3.0
endif # CC_SHORTVER, 3.4
endif # CC_SHORTVER, 4.x |
184187a6 |
endif # CC_SHORTVER, 4.5+ or 4.2+ |
0db44da7 |
else # CC_NAME, gcc
#other compilers
$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
endif #CC_NAME, gcc
endif #ARCH, mips64 |
871a6a07 |
#if alpha
ifeq ($(ARCH), alpha)
# if gcc
ifeq ($(CC_NAME), gcc) |
f072585d |
C_DEFS+=-DCC_GCC_LIKE_ASM |
871a6a07 |
#common stuff |
c8907870 |
CFLAGS= -O9 -funroll-loops $(PROFILE) |
fd6704da |
#if gcc 4.5 or 4.2+ |
184187a6 |
ifeq (,$(strip $(filter-out 4.2+ 4.5+,$(CC_SHORTVER)))) |
9558980b |
CFLAGS+= -fno-strict-overflow
# not supported: -minline-all-stringops
else |
e0931fb0 |
#if gcc 4.0+
ifeq ($(CC_SHORTVER), 4.x) |
0db44da7 |
CFLAGS+=
# not supported: -minline-all-stringops |
e0931fb0 |
else |
871a6a07 |
#if gcc 3.4+
ifeq ($(CC_SHORTVER), 3.4)
CFLAGS+=
else
#if gcc 3.0
ifeq ($(CC_SHORTVER), 3.0)
CFLAGS+=
else
ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
$(warning Old gcc detected ($(CC_SHORTVER)), use gcc 3.0.x \
for better results)
CFLAGS+=
else
#really old version
$(warning You are using an old and unsupported gcc \
version ($(CC_SHORTVER)), compile at your own risk!)
endif # CC_SHORTVER, 2.9x
endif # CC_SHORTVER, 3.0
endif # CC_SHORTVER, 3.4 |
e0931fb0 |
endif # CC_SHORTVER, 4.x |
184187a6 |
endif # CC_SHORTVER, 4.5+ or 4.2+ |
871a6a07 |
else # CC_NAME, gcc
#other compilers
$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
endif #CC_NAME, gcc
endif #ARCH, alpha
#if ppc
ifeq ($(ARCH), ppc)
# if gcc
ifeq ($(CC_NAME), gcc) |
f072585d |
C_DEFS+=-DCC_GCC_LIKE_ASM |
871a6a07 |
#common stuff |
4ef2fe37 |
CFLAGS= -O9 -funroll-loops -fsigned-char $(PROFILE) |
184187a6 |
#if gcc 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+,$(CC_SHORTVER)))) |
0b2d2c6e |
$(call set_if_empty,CPU,powerpc) |
9558980b |
CFLAGS+=-ftree-vectorize \
-fno-strict-overflow \
-mtune=$(CPU) -maltivec
else |
e0931fb0 |
#if gcc 4.0+
ifeq ($(CC_SHORTVER), 4.x) |
0b2d2c6e |
$(call set_if_empty,CPU,powerpc) |
f373f141 |
CFLAGS+=-ftree-vectorize \ |
e0931fb0 |
-mtune=$(CPU) -maltivec
else |
871a6a07 |
#if gcc 3.4+
ifeq ($(CC_SHORTVER), 3.4)
CFLAGS+=
else
#if gcc 3.0
ifeq ($(CC_SHORTVER), 3.0)
CFLAGS+=
else
ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
$(warning Old gcc detected ($(CC_SHORTVER)), use gcc 3.0.x \
for better results)
CFLAGS+=
else
#really old version
$(warning You are using an old and unsupported gcc \
version ($(CC_SHORTVER)), compile at your own risk!)
endif # CC_SHORTVER, 2.9x
endif # CC_SHORTVER, 3.0
endif # CC_SHORTVER, 3.4 |
e0931fb0 |
endif # CC_SHORTVER, 4.x |
184187a6 |
endif # CC_SHORTVER, 4.5+ or 4.2+ |
871a6a07 |
else # CC_NAME, gcc
#other compilers
$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
endif #CC_NAME, gcc
endif #ARCH, ppc
#if ppc64
ifeq ($(ARCH), ppc64)
# if gcc
ifeq ($(CC_NAME), gcc) |
f072585d |
C_DEFS+=-DCC_GCC_LIKE_ASM |
871a6a07 |
#common stuff |
4ef2fe37 |
CFLAGS= -O9 -funroll-loops -fsigned-char $(PROFILE) |
184187a6 |
#if gcc 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+,$(CC_SHORTVER)))) |
0b2d2c6e |
$(call set_if_empty,CPU,powerpc64) |
9558980b |
CFLAGS+=-ftree-vectorize \
-fno-strict-overflow \
-mtune=$(CPU) -maltivec
else
#if gcc 4.0+ |
e0931fb0 |
ifeq ($(CC_SHORTVER), 4.x) |
0b2d2c6e |
$(call set_if_empty,CPU,powerpc64) |
f373f141 |
CFLAGS+=-ftree-vectorize \ |
e0931fb0 |
-mtune=$(CPU) -maltivec
else |
871a6a07 |
#if gcc 3.4+
ifeq ($(CC_SHORTVER), 3.4)
CFLAGS+=
else
#if gcc 3.0
ifeq ($(CC_SHORTVER), 3.0)
CFLAGS+=
else
ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
$(warning Old gcc detected ($(CC_SHORTVER)), use gcc 3.0.x \
for better results)
CFLAGS+=
else
#really old version
$(warning You are using an old and unsupported gcc \
version ($(CC_SHORTVER)), compile at your own risk!)
endif # CC_SHORTVER, 2.9x
endif # CC_SHORTVER, 3.0
endif # CC_SHORTVER, 3.4 |
e0931fb0 |
endif # CC_SHORTVER, 4.x |
184187a6 |
endif # CC_SHORTVER, 4.5+ or 4.2+ |
871a6a07 |
else # CC_NAME, gcc
#other compilers
$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
endif #CC_NAME, gcc
endif #ARCH, ppc
|
c8907870 |
CFLAGS+= $(CC_EXTRA_OPTS) |
1f2c924e |
|
11ece359 |
# setting LDFLAGS |
51eadd0c |
ifeq ($(CC_NAME), gcc) |
473f6f2e |
ifeq ($(LDTYPE), solaris)
# solaris ld
LDFLAGS+=-O2 $(PROFILE) |
c853f68a |
MOD_LDFLAGS:=-G $(LDFLAGS)
LIB_LDFLAGS:=-G $(LDFLAGS)
LIB_SONAME=-Wl,-h,
LD_RPATH=-Wl,-R, |
473f6f2e |
else
#gcc and maybe others, => gnu ld
LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE) |
c853f68a |
MOD_LDFLAGS:=-shared $(LDFLAGS)
LIB_LDFLAGS:=-shared $(LDFLAGS)
LIB_SONAME=-Wl,-soname,
LD_RPATH=-Wl,-rpath, |
629fca1e |
endif |
51eadd0c |
endif |
9c61e9f9 |
ifeq ($(CC_NAME), icc)
#gcc and maybe others
LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE) |
c853f68a |
MOD_LDFLAGS:=-shared $(LDFLAGS)
LIB_LDFLAGS:=-shared $(LDFLAGS)
LIB_SONAME=-Wl,-soname,
LD_RPATH=-Wl,-rpath, |
9c61e9f9 |
endif |
51eadd0c |
ifeq ($(CC_NAME), suncc) |
c853f68a |
# -dy? |
51eadd0c |
LDFLAGS+=-xO5 $(PROFILE) |
c853f68a |
MOD_LDFLAGS:=-G $(LDFLAGS)
LIB_LDFLAGS:=-G $(LDFLAGS)
LIB_SONAME="-h "
LD_RPATH=-"-R " |
51eadd0c |
endif |
247c2b65 |
# we need -fPIC -DPIC only for shared objects, we don't need them for
# the executable file, because it's always loaded at a fixed address
# -andrei |
a2040154 |
|
452c543d |
ifeq ($(CC_NAME), clang)
LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE)
MOD_LDFLAGS:=-shared $(LDFLAGS)
LIB_LDFLAGS:=-shared $(LDFLAGS)
LIB_SONAME=-Wl,-soname,
LD_RPATH=-Wl,-rpath,
endif
|
a2040154 |
LDFLAGS+= $(LD_EXTRA_OPTS)
MOD_LDFLAGS+= $(LD_EXTRA_OPTS)
LIB_LDFLAGS+= $(LD_EXTRA_OPTS)
|
11ece359 |
else #mode,release |
51eadd0c |
ifeq ($(CC_NAME), gcc) |
e61f4ba3 |
CFLAGS=-g -Wcast-align $(PROFILE) |
f072585d |
C_DEFS+=-DCC_GCC_LIKE_ASM |
85f1f3ee |
ifeq ($(ARCH), sparc64) |
f072585d |
C_DEFS+=SPARC64_MODE |
d307929c |
CFLAGS+= -mcpu=ultrasparc -m64
LDFLAGS+=-m64 |
629fca1e |
endif
ifeq ($(LDTYPE), solaris)
#solaris ld
LDFLAGS+=-g $(PROFILE) |
c853f68a |
MOD_LDFLAGS:=-G $(LDFLAGS)
LIB_LDFLAGS:=-G $(LDFLAGS)
LIB_SONAME=-Wl,-h,
LD_RPATH=-Wl,-R, |
629fca1e |
else
#gnu or other ld type
LDFLAGS+=-g -Wl,-E $(PROFILE) |
c853f68a |
MOD_LDFLAGS:=-shared $(LDFLAGS)
LIB_LDFLAGS:=-shared $(LDFLAGS)
LIB_SONAME=-Wl,-soname,
LD_RPATH=-Wl,-rpath, |
629fca1e |
endif |
51eadd0c |
endif |
9c61e9f9 |
ifeq ($(CC_NAME), icc) |
f072585d |
C_DEFS+=-DCC_GCC_LIKE_ASM |
9c61e9f9 |
CFLAGS=-g $(PROFILE)
LDFLAGS+=-g -Wl,-E $(PROFILE) |
c853f68a |
MOD_LDFLAGS:=-shared $(LDFLAGS)
LIB_LDFLAGS:=-shared $(LDFLAGS)
LIB_SONAME=-Wl,-soname,
LD_RPATH=-Wl,-rpath, |
9c61e9f9 |
endif |
51eadd0c |
ifeq ($(CC_NAME), suncc)
CFLAGS= -g $(PROFILE)
LDFLAGS+=-g $(PROFILE) |
c853f68a |
MOD_LDFLAGS:=-G $(LDFLAGS)
LIB_LDFLAGS:=-G $(LDFLAGS)
LIB_SONAME="-h "
LD_RPATH=-"-R " |
51eadd0c |
endif
|
11ece359 |
endif #mode=release
|
c8907870 |
# set pedantic compiler options
ifeq ($(CC_NAME), gcc)
CFLAGS+= -Wall
else # no gcc
ifeq ($(CC_NAME), icc)
CFLAGS+= -Wall
else # no icc
ifeq ($(CC_NAME), suncc)
# FIXME: is the default (-Xa ?) enough?
endif # CC_NAME=suncc
endif # CC_NAME=icc
endif # CC_NAME=gcc
|
89d40068 |
#CFLAGS used for compiling the modules, libraries and utils |
51eadd0c |
ifeq ($(CC_NAME), gcc) |
7742b1d2 |
MOD_CFLAGS=-fPIC -DPIC $(CFLAGS)
LIB_CFLAGS=-fPIC -DPIC $(CFLAGS) |
51eadd0c |
endif |
9c61e9f9 |
ifeq ($(CC_NAME), icc) |
7742b1d2 |
MOD_CFLAGS=-Kpic $(CFLAGS)
LIB_CFLAGS=-Kpic $(CFLAGS) |
9c61e9f9 |
endif |
51eadd0c |
ifeq ($(CC_NAME), suncc) |
c853f68a |
# FIMXE: use -KPIC instead -xcode ? |
7742b1d2 |
MOD_CFLAGS=-xcode=pic32 $(CFLAGS)
LIB_CFLAGS=-xcode=pic32 $(CFLAGS) |
51eadd0c |
endif |
452c543d |
ifeq ($(CC_NAME), clang)
MOD_CFLAGS=-fPIC -DPIC $(CFLAGS)
LIB_CFLAGS=-fPIC -DPIC $(CFLAGS)
endif
|
89d40068 |
UTILS_CFLAGS=$(CFLAGS)
# LDFLAGS uses for compiling the utils
UTILS_LDFLAGS=$(LDFLAGS) |
247c2b65 |
|
054cb6cf |
ifeq ($(LEX),)
LEX=flex
endif
ifeq ($(YACC),)
YACC=bison
endif |
247c2b65 |
YACC_FLAGS=-d -b cfg
# on solaris add -lxnet (e.g. LIBS= -lxnet) |
34285950 |
LIBS= -ldl -lresolv |
3922c022 |
LIB_PREFIX:=lib
LIB_SUFFIX:=.so |
247c2b65 |
|
11ece359 |
#os specific stuff |
aee4712e |
ifeq ($(OS), linux) |
8b8fc486 |
# by default use futexes if available
use_futex= yes |
f072585d |
C_DEFS+=-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \ |
efa97d66 |
-DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H \ |
53cc96bd |
-DHAVE_TIMEGM -DHAVE_SCHED_SETSCHEDULER -DUSE_RAW_SOCKS |
e0135488 |
ifneq ($(found_lock_method), yes) |
f072585d |
#C_DEFS+= -DUSE_POSIX_SEM
C_DEFS+=-DUSE_PTHREAD_MUTEX |
8b8fc486 |
LIBS+= -lpthread |
f072585d |
#C_DEFS+= -DUSE_SYSV_SEM # try posix sems |
e0135488 |
found_lock_method=yes |
32f700f3 |
else |
f072585d |
ifneq (,$(findstring -DUSE_POSIX_SEM, $(C_DEFS))) |
32f700f3 |
LIBS+=-lpthread
endif |
f072585d |
ifneq (,$(findstring -DUSE_PTHREAD_MUTEX, $(C_DEFS))) |
d5b4d882 |
LIBS+=-lpthread
endif |
e0135488 |
endif |
73103df8 |
# check for >= 2.5.44
|
741a9937 |
ifeq ($(shell [ $(OSREL_N) -ge 2005044 ] && echo has_epoll), has_epoll) |
0ba367ec |
ifeq ($(NO_EPOLL),) |
f072585d |
C_DEFS+=-DHAVE_EPOLL |
a31a6e8c |
# linux + gcc >= 3.0 + -malign-double + epoll => problems |
7742b1d2 |
CFLAGS_RM+=-malign-double
#CFLAGS:=$(filter-out -malign-double, $(CFLAGS)) |
0ba367ec |
endif
endif |
741a9937 |
# check for >= 2.2.0
ifeq ($(shell [ $(OSREL_N) -ge 2002000 ] && echo has_sigio), has_sigio)
ifeq ($(NO_SIGIO),) |
f072585d |
C_DEFS+=-DHAVE_SIGIO_RT -DSIGINFO64_WORKARROUND |
741a9937 |
endif |
0ba367ec |
endif |
8b8fc486 |
# check for >= 2.5.70
ifeq ($(shell [ $(OSREL_N) -ge 2005070 ] && echo has_futex), has_futex)
ifeq ($(use_futex), yes) |
f072585d |
C_DEFS+=-DUSE_FUTEX |
8b8fc486 |
endif
endif |
0ba367ec |
ifeq ($(NO_SELECT),) |
f072585d |
C_DEFS+=-DHAVE_SELECT |
0ba367ec |
endif |
247c2b65 |
endif |
11ece359 |
|
0bafb279 |
ifeq ($(OS), solaris) |
f072585d |
C_DEFS+= -DHAVE_GETIPNODEBYNAME -DHAVE_SYS_SOCKIO_H -DHAVE_SCHED_YIELD \ |
02dae965 |
-DHAVE_ALLOCA_H -DUSE_SIGACTION |
e0135488 |
ifneq ($(found_lock_method), yes) |
f072585d |
C_DEFS+= -DUSE_PTHREAD_MUTEX # try pthread sems |
e0135488 |
found_lock_method=yes
endif |
9eda5956 |
# check for ver >= 5.7
ifeq ($(shell [ $(OSREL_N) -gt 5007 ] && echo has_devpoll), has_devpoll)
ifeq ($(NO_DEVPOLL),) |
f072585d |
C_DEFS+=-DHAVE_DEVPOLL |
9eda5956 |
endif
endif |
0ba367ec |
ifeq ($(NO_SELECT),) |
f072585d |
C_DEFS+=-DHAVE_SELECT |
0ba367ec |
endif |
0d2d4018 |
# check for filio.h
filio_h_locations= /usr/include/sys/filio.h \
$(LOCALBASE)/include/sys/filio.h
has_filio_h=$(shell for r in $(filio_h_locations); do \
if [ -r "$$r" ] ; then echo yes; exit; fi \
done;\
)
ifeq ($(has_filio_h), yes) |
f072585d |
C_DEFS+=-DHAVE_FILIO_H |
0d2d4018 |
endif |
7c0265cc |
ifeq ($(mode), release) |
687e82fe |
#use these only if you're using gcc with Solaris ld |
db829953 |
#LDFLAGS=-O2 $(PROFILE)
#MOD_LDFLAGS=-O2 -G |
7c0265cc |
else |
db829953 |
#LDFLAGS=-g $(PROFILE)
#MOD_LDFLAGS=-g -G |
7c0265cc |
endif |
11ece359 |
YACC=yacc |
51eadd0c |
ifeq ($(CC_NAME), suncc) |
169b99f8 |
LIBS= -lfast -ldl -lresolv |
51eadd0c |
endif |
4168f707 |
OLD_SOLARIS= $(shell echo "$(OSREL)" | \
sed -e 's/^5\.[0-6][^0-9]*$$/yes/' ) |
34285950 |
LIBS+= -L$(LOCALBASE)/lib -lxnet -lnsl |
4168f707 |
ifeq ($(OLD_SOLARIS), yes)
LIBS+=-lposix4
else
LIBS+=-lrt
endif |
51eadd0c |
# -lrt needed for sched_yield |
247c2b65 |
endif |
11ece359 |
|
0bafb279 |
ifeq ($(OS), freebsd) |
f072585d |
C_DEFS+=-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN \ |
efa97d66 |
-DHAVE_SCHED_YIELD -DHAVE_MSGHDR_MSG_CONTROL \ |
a7380699 |
-DHAVE_CONNECT_ECONNRESET_BUG -DHAVE_TIMEGM \ |
49e34588 |
-DHAVE_NETINET_IN_SYSTM -DUSE_RAW_SOCKS |
e0135488 |
ifneq ($(found_lock_method), yes) |
f072585d |
C_DEFS+= -DUSE_PTHREAD_MUTEX # try pthread sems |
e0135488 |
found_lock_method=yes |
32f700f3 |
LIBS+= -pthread #dlopen is in libc |
4e018310 |
else |
34285950 |
LIBS= #dlopen is in libc |
e0135488 |
endif |
741a9937 |
# check for ver >= 4.1
ifeq ($(shell [ $(OSREL_N) -gt 4001 ] && echo has_kqueue), has_kqueue)
ifeq ($(NO_KQUEUE),) |
f072585d |
C_DEFS+=-DHAVE_KQUEUE |
741a9937 |
endif
endif |
0ba367ec |
ifeq ($(NO_SELECT),) |
f072585d |
C_DEFS+=-DHAVE_SELECT |
0ba367ec |
endif |
11ece359 |
YACC=yacc |
087d0976 |
endif |
247c2b65 |
|
7d27010d |
ifeq ($(OS), dragonfly)
C_DEFS+=-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN \
-DHAVE_SCHED_YIELD -DHAVE_MSGHDR_MSG_CONTROL \
-DHAVE_CONNECT_ECONNRESET_BUG -DHAVE_TIMEGM \
-DHAVE_NETINET_IN_SYSTM
ifneq ($(found_lock_method), yes)
C_DEFS+= -DUSE_PTHREAD_MUTEX # try pthread sems
found_lock_method=yes
LIBS+= -pthread #dlopen is in libc
else
LIBS= #dlopen is in libc
endif |
c07c2b5e |
# dragonfly was forked from freebsd 4.8 => all version have kqueue
ifeq ($(NO_KQUEUE),)
C_DEFS+=-DHAVE_KQUEUE |
7d27010d |
endif
ifeq ($(NO_SELECT),)
C_DEFS+=-DHAVE_SELECT
endif
YACC=yacc
endif
|
087d0976 |
ifeq ($(OS), openbsd) |
f072585d |
C_DEFS+=-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 \ |
efa97d66 |
-DHAVE_UNION_SEMUN -DHAVE_MSGHDR_MSG_CONTROL \ |
000f4d33 |
-DHAVE_CONNECT_ECONNRESET_BUG -DHAVE_TIMEGM \
-DHAVE_NETINET_IN_SYSTM -DUSE_SIGWAIT |
e0135488 |
ifneq ($(found_lock_method), yes) |
f072585d |
C_DEFS+= -DUSE_PTHREAD_MUTEX # try pthread sems |
e0135488 |
found_lock_method=yes
endif |
8386f8d7 |
# check for ver >=2 9
ifeq ($(shell [ $(OSREL_N) -ge 2009 ] && echo has_kqueue), has_kqueue) |
741a9937 |
ifeq ($(NO_KQUEUE),) |
f072585d |
C_DEFS+=-DHAVE_KQUEUE |
741a9937 |
endif
endif |
0ba367ec |
ifeq ($(NO_SELECT),) |
f072585d |
C_DEFS+=-DHAVE_SELECT |
0ba367ec |
endif |
e61f4ba3 |
# (symbols on openbsd are prefixed by "_") |
087d0976 |
YACC=yacc |
e61f4ba3 |
# no sched_yield on openbsd unless linking with c_r (not recommended) |
000f4d33 |
# unfortunately pthread is needed for sigwait |
34285950 |
LIBS= -lpthread |
b89da7b7 |
OPENBSD_IS_AOUT:= $(shell echo "$(OSREL)" | \ |
cf98659b |
sed -e 's/^3\.[0-3][^0-9]*$$/yes/' |sed -e 's/^[0-2]\..*/yes/') |
245b8b93 |
# exception: on sparc openbsd 3.2 is elf and not aout
ifeq ($(OSREL), 3.2)
ifeq ($(ARCH), sparc)
OPENBSD_IS_AOUT:=no
endif
ifeq ($(ARCH), sparc64)
OPENBSD_IS_AOUT:=no
endif
endif |
cf98659b |
ifeq ($(OPENBSD_IS_AOUT), yes) |
f072585d |
C_DEFS+=-DDLSYM_PREFIX='"_"' |
cf98659b |
LDFLAGS= # openbsd ld doesn't like -O2 or -E |
247c2b65 |
endif |
cf98659b |
endif # if opensd |
087d0976 |
|
9627d1fc |
ifeq ($(OS), netbsd) |
f072585d |
C_DEFS+=-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 \ |
efa97d66 |
-DHAVE_MSGHDR_MSG_CONTROL -DHAVE_CONNECT_ECONNRESET_BUG -DHAVE_TIMEGM |
e0135488 |
ifneq ($(found_lock_method), yes) |
f072585d |
C_DEFS+= -DUSE_SYSV_SEM # try pthread sems |
e0135488 |
found_lock_method=yes
endif |
741a9937 |
# check for ver >= 2.0.0
ifeq ($(shell [ $(OSREL_N) -ge 2000000 ] && echo has_kqueue), has_kqueue)
ifeq ($(NO_KQUEUE),) |
f072585d |
C_DEFS+=-DHAVE_KQUEUE |
2f2e593b |
# netbsd + kqueue and -malign-double don't work |
7742b1d2 |
CFLAGS_RM+=-malign-double
#CFLAGS:=$(filter-out -malign-double, $(CFLAGS)) |
741a9937 |
endif
endif |
0ba367ec |
ifeq ($(NO_SELECT),) |
f072585d |
C_DEFS+=-DHAVE_SELECT |
0ba367ec |
endif |
9627d1fc |
YACC=yacc |
34285950 |
LIBS= |
9627d1fc |
endif |
247c2b65 |
|
194b6a35 |
# OS X support, same as freebsd
ifeq ($(OS), darwin) |
f072585d |
C_DEFS+=-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN \ |
194b6a35 |
-DHAVE_SCHED_YIELD -DHAVE_MSGHDR_MSG_CONTROL \
-DUSE_ANON_MMAP \ |
6c006f79 |
-DNDEBUG -DHAVE_CONNECT_ECONNRESET_BUG -DHAVE_TIMEGM \
-DUSE_SIGWAIT |
194b6a35 |
# -DNDEBUG used to turn off assert (assert wants to call
# eprintf which doesn't seem to be defined in any shared lib
ifneq ($(found_lock_method), yes) |
f072585d |
C_DEFS+= -DUSE_PTHREAD_MUTEX # try pthread sems |
194b6a35 |
found_lock_method=yes |
f072585d |
C_DEFS+= -DUSE_SYSV_SEM # try sys v sems (pthread don't work for |
e5076770 |
# processes and unnamed posix sems are not
# supported) |
194b6a35 |
endif |
e5076770 |
LIBS= -lresolv #dlopen is in libc |
55d8155e |
ifeq ($(NO_KQUEUE),) |
f072585d |
C_DEFS+=-DHAVE_KQUEUE |
55d8155e |
endif |
0ba367ec |
ifeq ($(NO_SELECT),) |
f072585d |
C_DEFS+=-DHAVE_SELECT |
0ba367ec |
endif |
194b6a35 |
LDFLAGS= # darwin doesn't like -O2 or -E |
f233d281 |
# the modules uses symbols from ser => either
# -flat_namespace -undefined_suppress or -bundle_loader ../../$(MAIN_NAME)
MOD_LDFLAGS:= -bundle -flat_namespace -undefined suppress |
24111254 |
# for libs using symbols from ser (e.g srdb2, kcore a.s.o) we
# need -flat_namespace -undefined suppress
LIB_LDFLAGS:= -dynamiclib -flat_namespace -undefined suppress |
3922c022 |
LIB_SUFFIX:=.dylib |
c853f68a |
# on darwin soname should include the full path
# (it kind of combines rpath & soname)
LIB_SONAME=
# no equiv. for rpath on darwin
LD_RPATH= |
194b6a35 |
YACC=yacc
endif
|
03023127 |
ifneq (,$(findstring cygwin, $(OS))) |
abdf40da |
# cygwin does support IPV6 starting from version 1.7, but (still?) doesn't support fd passing so no TCP
#C_DEFS:=$(filter-out -DUSE_TCP, $(C_DEFS))
DEFS_RM+=-DUSE_TCP |
f072585d |
C_DEFS+=-DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \ |
03023127 |
-DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H \
-DHAVE_TIMEGM -DHAVE_SCHED_SETSCHEDULER |
e0135488 |
ifneq ($(found_lock_method), yes) |
f072585d |
C_DEFS+= -DUSE_POSIX_SEM
#C_DEFS+= -DUSE_SYSV_SEM # try posix sems |
03023127 |
# PTHREAD_MUTEX do not work for processes (try test/pthread_test.c)
#LIBS+= -lpthread |
e0135488 |
found_lock_method=yes |
03023127 |
else |
f072585d |
ifneq (,$(findstring -DUSE_POSIX_SEM, $(C_DEFS))) |
03023127 |
#LIBS+=-lpthread
endif |
f072585d |
ifneq (,$(findstring -DUSE_PTHREAD_MUTEX, $(C_DEFS))) |
03023127 |
$(error PTHREAD_MUTEX do not work for processes on Windows/CYGWIN)
endif
endif
# check for >= 2.5.70
ifeq ($(NO_SELECT),) |
f072585d |
C_DEFS+=-DHAVE_SELECT |
e0135488 |
endif
endif
|
f22b996b |
#add libssl if needed |
6c53d41a |
ifeq ($(CORE_TLS), 1) |
16155740 |
C_INCLUDES+= -I$(LOCALBASE)/ssl/include |
6c53d41a |
LIBS+= -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib -lssl -lcrypto \
$(TLS_EXTRA_LIBS)
# NOTE: depending on the way in which libssl was compiled you might
# have to add -lz -lkrb5 (zlib and kerberos5).
# E.g.: make CORE_TLS=1 EXTRA_TLS_LIBS="-lz -lkrb5" |
f22b996b |
endif
|
e0135488 |
ifneq ($(found_lock_method), yes)
$(warning No locking method found so far, trying SYS V sems) |
f072585d |
C_DEFS+= -DUSE_SYSV_SEM # try sys v sems |
e0135488 |
found_lock_method=yes |
247c2b65 |
endif |
4ce32edc |
|
7742b1d2 |
endif # ifeq (,$(main_makefile))
endif # ifeq ($(makefile_defs), 1)
# if incomplete or missing config.mak, or already exported vars, don't
# try to export/re-export
ifeq ($(makefile_defs),1)
ifneq ($(exported_vars),1)
override exported_vars:=1
export exported_vars
# variable changeable only at configure time (once saved in config.mak they
# cannot be overwritten from environment or command line, unless make cfg
# is run) |
caf3128c |
saved_fixed_vars:= MAIN_NAME CFG_NAME SCR_NAME FLAVOUR INSTALL_FLAVOUR \ |
6b6bc928 |
SRC_NAME RELEASE OS ARCH \ |
f072585d |
C_DEFS DEFS_RM PROFILE CC LD MKDEP MKTAGS LDFLAGS C_INCLUDES \ |
5a9014ee |
CC_MKDEP_OPTS \ |
89d40068 |
MOD_LDFLAGS LIB_LDFLAGS UTILS_LDFLAGS LIB_SONAME LD_RPATH \ |
7742b1d2 |
LIB_SUFFIX LIB_PREFIX \
LIBS \
LEX YACC YACC_FLAGS \
PREFIX LOCALBASE \
TAR \
INSTALL INSTALL_CFG INSTALL_BIN INSTALL_MODULES INSTALL_DOC \ |
e37e8d6a |
INSTALL_MAN INSTALL_LIB INSTALL_TOUCH INSTALL_SHARE \
Q |
7742b1d2 |
# variable changeable at compile time
# extra: prefix DESTDIR BASEDIR basedirt
saved_chg_vars:=\ |
89d40068 |
CC_EXTRA_OPTS CPU CFLAGS_RM CFLAGS MOD_CFLAGS LIB_CFLAGS UTILS_CFLAGS \ |
cf837383 |
BASEDIR basedir DESTDIR LIBDIR \ |
7742b1d2 |
PREFIX prefix\
cfg_prefix cfg_dir bin_prefix bin_dir modules_prefix modules_dir \
doc_prefix doc_dir man_prefix man_dir ut_prefix ut_dir \ |
0cb74fb4 |
share_prefix share_dir lib_prefix lib_dir data_prefix data_dir \
cfg_target lib_target data_target |
7742b1d2 |
|
4ce32edc |
|
c853f68a |
#export relevant variables to the sub-makes |
7742b1d2 |
export $(saved_fixed_vars)
export $(saved_chg_vars)
endif # ifneq ($(exported_vars),1)
endif # ifeq ($(makefile_defs),1)
|