Makefile.defs: version set to 5.0.0-dev7
[sip-router] / Makefile.defs
1 # Kamailio build system
2
3 #
4 # makefile defs (CC, LD,a.s.o)
5 #
6 # Environment variables:
7 #   PREFIX, LOCALBASE, BASEDIR
8 #   INSTALL, TAR , CC, LEX, YACC,
9 #   CPUTYPE, CC_EXTRA_OPTS, LD_EXTRA_OPTS
10 #   exclude_modules, skip_modules, include_modules
11 #   extra_defs
12 #
13
14 # default silent, unless Q= 0|no|off|verbose|noisy
15 quiet?=$(if $(filter 0 no off verbose noisy,$(Q)),verbose,silent)
16
17 # check if already included/exported
18
19 # used for sanity checks for Makefile.defs inclusion (!= makefile_defs which
20 # specifies if we have a set of valid defs)
21 override makefile_defs_included:=1
22 ifeq ($(makefile_defs),1)
23 ifeq ($(quiet),verbose)
24 $(info Makefile.defs defs skipped)
25 endif # verbose
26
27 else
28
29 ifeq (,$(main_makefile))
30 # hack to automatically use config.mak in all the modules, without
31 # changing the current module makefiles (which all include Makefile.defs):
32 # if not called from the main makefile (module, lib or ut):
33 # include config.mak, but if not present or incomplete (makefile_defs!=1)
34 # don't export the vars)
35 COREPATH?= ../..
36 include $(COREPATH)/config.mak
37 ifeq ($(quiet),verbose)
38 $(info config.mak included)
39 endif # verbose
40 # config.mak should set makefile_defs if complete
41 export makefile_defs
42
43 else
44 override makefile_defs=1
45 export makefile_defs
46
47
48 ifeq ($(quiet),verbose)
49 $(info normal Makefile.defs exec)
50 endif # verbose
51
52 -include Makefile.vars
53
54 # usage: $(call set_if_empty,VAR,value)
55 set_if_empty=$(if $($(1)),,$(eval override $(1)=$(2)))
56
57 # flavour: sip-router, ser or kamailio
58 $(call  set_if_empty,FLAVOUR,kamailio)
59
60 #prefix for various configs and scripts
61 #config name/name-prefix for distributed configs
62 CFG_NAME?=sip-router
63 #config name/name-prefix for distributed scripts
64 SCR_NAME=sip-router
65 #name in source tree
66 SRC_NAME=sip-router
67
68 ifeq ($(FLAVOUR),sip-router)
69 # main binary name
70 MAIN_NAME=ser
71 else ifeq ($(FLAVOUR),ser)
72 # main binary name
73 MAIN_NAME=ser
74 else ifeq ($(FLAVOUR),kamailio)
75 # main binary name
76 MAIN_NAME=kamailio
77 # use kamailio config
78 CFG_NAME=kamailio
79 # kamailio statistics on
80 KMSTATS ?= 1
81 # fast malloc statistics on
82 FMSTATS ?= 1
83 else # unknown:
84 # main binary name
85 MAIN_NAME=kamailio
86 endif
87
88 # application server support on
89 WITHAS ?= 1
90 # enable core hooks for SCTP
91 SCTP ?= 1
92 # enable raw sockets
93 RAW_SOCKS ?= yes
94 ifeq ($(RAW_SOCKS),1)
95         RAW_SOCKS = yes
96 endif
97
98 # what to install
99 INSTALL_FLAVOUR=$(FLAVOUR)
100
101 # version number
102 VERSION = 5
103 PATCHLEVEL = 0
104 SUBLEVEL =  0
105 EXTRAVERSION = -dev7
106
107 # memory manager switcher
108 # 0 - f_malloc (fast malloc)
109 # 1 - q_malloc (quick malloc)
110 # 2 - tlsf_malloc (O(1) malloc and free)
111 MEMMNG ?= 0
112 # memory debugger switcher
113 # 0 - off (no-debug mode)
114 # 1 - on (debug mode)
115 MEMDBG ?= 1
116
117 SER_VER = $(shell expr $(VERSION) \* 1000000 + $(PATCHLEVEL) \* 1000 + \
118                         $(SUBLEVEL) )
119 RELEASE:=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
120 OS := $(shell uname -s | sed -e s/SunOS/solaris/ -e s/CYGWIN.*/cygwin/ \
121                  | tr "[A-Z]" "[a-z]" | tr "/" "_")
122
123 ifeq ($(OS),solaris)
124         GETARCH=isainfo -n
125 ifeq ($(GETARCH),)
126         GETARCH=uname -p
127 endif
128 else
129         GETARCH=uname -m
130 endif
131
132 HOST_ARCH := $(shell $(GETARCH) |sed -e s/i.86/i386/ -e s/sun4[uv]/sparc64/  \
133                         -e s/armv[3-5].*/arm/  -e s/armv6.*/arm6/ \
134                         -e "s/Power Macintosh/ppc/" \
135                         -e "s/cobalt/mips2/" \
136                         -e s/amd64/x86_64/ -e s/sparcv9/sparc64/ )
137 # fix sparc -> sparc64
138 ifeq ($(HOST_ARCH),sparc)
139         ifeq ($(shell uname -m),sun4u)
140                 HOST_ARCH := sparc64
141         endif
142         ifeq ($(shell uname -m),sun4v)
143                 HOST_ARCH := sparc64
144         endif
145 endif
146
147 OSREL := $(shell uname -r)
148 # numerical version (good for comparisons: A.B.C => A*1000000+B*1000+C)
149 OSREL_N:= $(shell echo $(OSREL) | sed -e 's/^[^0-9]*//' \
150                 -e 's/^\([0-9][0-9]*\(\.[0-9][0-9]*\)*\).*$$/\1/g' | \
151                 (IFS=. read A B C D; R=0; \
152                 [ -n "$$A" ] && R=`expr $$R \* 1000 + $$A` && \
153                 [ -n "$$B" ] && R=`expr $$R \* 1000 + $$B` && \
154                 [ -n "$$C" ] && R=`expr $$R \* 1000 + $$C`; echo $$R ) )
155
156
157 # TLS support
158 CORE_TLS ?=
159 # by default compile with tls hooks support (so that no ser recompile is
160 #  needed before the tls module can be used)
161 TLS_HOOKS=1
162 ifeq ($(CORE_TLS), 1)
163         RELEASE:=$(RELEASE)-tls
164         TLS_HOOKS:=0
165 endif
166 ifeq ($(TLS_HOOKS), 1)
167 #       RELEASE:=$(RELEASE)-tls
168 endif
169
170 # extra CC command line options (e.g  -march=athlon-mp)
171 CC_EXTRA_OPTS ?=
172
173 # extra LD command line options
174 LD_EXTRA_OPTS ?=
175
176 ifeq ($(OS), solaris)
177 #use GNU versions
178 INSTALL ?= ginstall
179 TAR ?= gtar
180 else
181 INSTALL ?= install
182 TAR ?= tar
183 endif
184
185 INSTALL_TOUCH = touch          # used to create the file first (good to
186                                #  make solaris install work)
187 INSTALL_CFG = $(INSTALL) -m 644
188 INSTALL_BIN = $(INSTALL) -m 755
189 INSTALL_SCRIPT = $(INSTALL) -m 755
190 INSTALL_MODULES = $(INSTALL) -m 755
191 INSTALL_LIB = $(INSTALL) -m 755
192 INSTALL_DOC = $(INSTALL) -m 644
193 INSTALL_MAN = $(INSTALL) -m 644
194 INSTALL_SHARE = $(INSTALL) -m 644
195
196 #set some vars from the environment (and not make builtins)
197 CC   := $(shell echo "$${CC}")
198 LEX  := $(shell echo "$${LEX}")
199 YACC := $(shell echo "$${YACC}")
200
201
202
203
204 # find compiler name & version
205 ifeq ($(CC),)
206         CC=gcc
207 endif
208 LD= $(CC)
209 CC_LONGVER:=$(shell if  $(CC) -v 2>/dev/null; then \
210                                                 $(CC) -v 2>&1 ;\
211                                         else \
212                                                 $(CC) -V 2>&1 ; \
213                                         fi )
214 CC_OPT ?= -O9
215 MKTAGS=ctags
216
217 #find-out the compiler's name
218
219 ifneq (,$(findstring gcc, $(CC_LONGVER)))
220         CC_NAME=gcc
221         RPAREN=)
222         CC_VER:=$(word 1,$(CC)) $(shell $(CC) - --version|head -n 1|\
223                                 sed  -e 's/([^$(RPAREN)]*)//g' \
224                                          -e 's/^.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/'\
225                                          -e 's/^[^0-9].*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/')
226 #       CC_VER:=$(word 1,$(CC)) $(shell $(CC) - --version|head -n 1|cut -d" " -f 3\
227 #                               |sed -e 's/^.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/'\
228 #                                        -e 's/^[^0-9].*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/')
229         # sed with POSIX.1 regex doesn't support |, + or ?
230         # (darwin, solaris ...) => this complicated expression
231         MKDEP=$(CC) -MM -MG
232         #transform gcc version into 2.9x or 3.0
233         CC_SHORTVER:=$(shell echo "$(CC_VER)" | cut -d" " -f 2| \
234                                  sed -e 's/[^0-9]*-\(.*\)/\1/'| \
235                                  sed -e 's/2\.9.*/2.9x/' \
236                                         -e 's/3\.[0-3]\..*/3.0/' \
237                                         -e 's/3\.[0-3]/3.0/' \
238                                         -e 's/3\.[4-9]\..*/3.4/' \
239                                         -e 's/3\.[4-9]/3.4/' \
240                                         -e 's/4\.[0-1]\..*/4.x/' \
241                                         -e 's/4\.[0-1]/4.x/' \
242                                         -e 's/4\.[2-4]\..*/4.2+/' \
243                                         -e 's/4\.[2-4]$$/4.2+/' \
244                                         -e 's/4\.[5-9]\..*/4.5+/' \
245                                         -e 's/4\.[5-9]$$/4.5+/' \
246                                         -e 's/5\.[0-9]\..*/5.0+/' \
247                                         -e 's/5\.[0-9]$$/5.0+/' \
248                                         -e 's/6\.[0-9]\..*/6.0+/' \
249                                         -e 's/6\.[0-9]$$/6.0+/')
250 ifeq (,$(strip $(filter-out 3.0 3.4 4.x 4.2+ 4.5+ 5.0+ 6.0+,$(CC_SHORTVER))))
251         # dependencies can be generated on-the-fly while compiling *.c
252         CC_MKDEP_OPTS=-MMD -MP
253 endif # 3.0 <= $(CC_SHORTVER) <= 4.x
254 endif # gcc
255
256 ifneq (, $(findstring Sun, $(CC_LONGVER)))
257         CC_NAME=suncc
258         CC_SHORTVER:=$(shell echo "$(CC_LONGVER)"|head -n 1| \
259                                         sed -e 's/.*\([0-9]\.[0-9]\).*/\1/g' )
260         CC_VER=$(CC) $(CC_SHORTVER)
261         MKDEP=$(CC) -xM1
262         CC_MKDEP_OPTS=-xMMD
263 endif
264
265 ifneq (, $(findstring Intel(R) C++ Compiler, $(CC_LONGVER)))
266         # very nice: gcc compatible
267         CC_NAME=icc
268         CC_FULLVER:=$(shell echo "$(CC_LONGVER)"|head -n 1| \
269                                         sed -e 's/.*Version \([0-9]\.[0-9]\.[0-9]*\).*/\1/g' )
270         CC_SHORTVER:=$(shell echo "$(CC_FULLVER)" | cut -d. -f1,2 )
271         CC_VER=$(CC) $(CC_FULLVER)
272         MKDEP=$(CC) -MM
273 endif
274
275 ifneq (, $(findstring clang, $(CC_LONGVER)))
276         #clang should be gcc compatible
277         CC_NAME=clang
278         CC_FULLVER:=$(shell echo "$(CC_LONGVER)" | head -n 1 |  sed -e 's/.*version \([0-9]\.[0-9]\).*/\1/g' )
279         CC_SHORTVER:=$(shell echo "$(CC_FULLVER)" | cut -d. -f1,2 )
280         CC_VER=$(CC) $(CC_FULLVER)
281         CC_OPT=-O3
282         MKDEP=$(CC) -MM
283 endif
284
285 ifeq (,$(CC_NAME))
286 #not found
287         CC_NAME=$(CC)
288         CC_SHORTVER=unknown
289         CC_VER=unknown
290         MKDEP=gcc -MM
291 $(warning       Unknown compiler $(CC)\; supported compilers: \
292                         gcc, sun cc, intel icc )
293 endif
294
295 # ARCH detection
296 # predefined compiler macros for different architectures
297 # (see http://predef.sourceforge.net/prearch.html for a more complete list)
298 i386_macros= i386 __i386__ __i486__ __i586__ __i686__ \
299                         __i386 _M_IX86 __X86__ _X86_
300 x86_64_macros= __amd64__ __amd64 __x86_64__ __x86_64 _M_X64
301
302 sparc_macros= __sparc__ __sparc __sparcv8
303 sparc64_macros= __sparcv9 __sparc_v9__
304
305 arm_macros= __arm__ __thumb__
306 arm6_macros= __ARM_ARCH_6__
307
308 ppc_macros= __powerpc __powerpc__ __POWERPC__ __ppc__ _ARCH_PPC
309 ppc64_macros= __ppc64__ _ARCH_PPC64
310
311 mips_macros= __mips__ __mips _MIPS_ARCH_MIPS1
312 mips2_macros= _MIPS_ISA_MIPS2 _MIPS_ISA_MIPS3 _MIPS_ISA_MIPS4 \
313                         _MIPS_ARCH_MIPS2 _MIPS_ARCH_MIPS3 _MIPS_ARCH_MIPS4
314 mips64_macros= _MIPS_ISA_MIPS64 _MIPS_ARCH_MIPS64
315
316 alpha_macros= __alpha__ __alpha _M_ALPHA_
317
318 ifeq ($(CC_NAME),gcc)
319 #if gcc use gcc arch
320 predef_macros:=$(shell $(CC) -dM -E -x c $(CC_EXTRA_OPTS) $(extra_defs) \
321                                         $(CFLAGS) /dev/null)
322
323 ifneq ($(strip $(filter $(i386_macros), $(predef_macros))),)
324 CC_ARCH=i386
325 else ifneq ($(strip $(filter $(x86_64_macros), $(predef_macros))),)
326 CC_ARCH=x86_64
327 else ifneq ($(strip $(filter $(sparc_macros), $(predef_macros))),)
328
329 ifneq ($(strip $(filter $(sparc64_macros), $(predef_macros))),)
330 CC_ARCH=sparc64
331 else # sparc64_macros
332 CC_ARCH=sparc
333 endif # sparc64_macros
334
335 else ifneq ($(strip $(filter $(arm_macros), $(predef_macros))),)
336
337 ifneq ($(strip $(filter $(arm6_macros), $(predef_macros))),)
338 CC_ARCH=arm6
339 else # arm6_macros
340 CC_ARCH=arm
341 endif # arm6_macros
342
343 else ifneq ($(strip $(filter $(ppc64_macros), $(predef_macros))),)
344 CC_ARCH=ppc64
345 else ifneq ($(strip $(filter $(ppc_macros), $(predef_macros))),)
346 CC_ARCH=ppc
347 else ifneq ($(strip $(filter $(mips_macros), $(predef_macros))),)
348
349 ifneq ($(strip $(filter $(mips64_macros), $(predef_macros))),)
350 CC_ARCH=mips64
351 else ifneq ($(strip $(filter $(mips2_macros), $(predef_macros))),)
352 CC_ARCH=mips2
353 else # mips2_macros
354 CC_ARCH=mips
355 endif # mips64_macros
356
357 else ifneq ($(strip $(filter $(alpha_macros), $(predef_macros))),)
358 CC_ARCH=alpha
359 else
360
361 $(warn "Unknown target compiler architecture")
362
363 endif # predefined macros tests (x86_macros, ...)
364
365 endif # gcc
366
367 ifdef CC_ARCH
368 ARCH:=$(CC_ARCH)
369 else
370 ARCH:=$(HOST_ARCH)
371 endif
372 $(info target architecture <$(ARCH)>, host architecture <$(HOST_ARCH)>)
373
374 LIBDIR ?=
375 ifeq ($(LIBDIR),)
376 ARCHBSZ= $(shell echo $(ARCH) | sed -e 's/.*64.*/64b/')
377 ifeq ($(ARCHBSZ),64b)
378         LIBDIR = lib64
379 else
380         LIBDIR = lib
381 endif
382 endif
383
384 # dirs
385 cfg_dir = etc/$(MAIN_NAME)/
386 bin_dir = sbin/
387 share_dir = share/$(MAIN_NAME)/
388 # lib/$(MAIN_NAME)/modules , lib/$(MAIN_NAME)/modules-s, lib/$(MAIN_NAME)/modules-k
389 modules_dir = $(LIBDIR)/$(MAIN_NAME)/
390 lib_dir = $(LIBDIR)/$(MAIN_NAME)/
391 run_dir = var/run/$(MAIN_NAME)/
392 doc_dir = doc/$(MAIN_NAME)/
393 man_dir = man/
394 data_dir = $(MAIN_NAME)/
395
396 ifeq ($(OS), linux)
397         doc_dir = share/doc/$(MAIN_NAME)/
398         man_dir = share/man/
399         data_dir = share/$(MAIN_NAME)/
400         LOCALBASE ?= /usr/local
401 endif
402
403 ifeq ($(OS), gnu_kfreebsd)
404         doc_dir = share/doc/$(MAIN_NAME)/
405         man_dir = share/man/
406         data_dir = share/$(MAIN_NAME)/
407         LOCALBASE ?= /usr/local
408 endif
409
410 ifeq ($(OS), freebsd)
411         doc_dir = share/doc/$(MAIN_NAME)/
412         man_dir = man/
413         data_dir = share/$(MAIN_NAME)/
414         LOCALBASE ?= /usr/local
415 endif
416
417 ifeq ($(OS), openbsd)
418         doc_dir = share/doc/$(MAIN_NAME)/
419         man_dir = man/
420         data_dir = share/$(MAIN_NAME)/
421         LOCALBASE ?= /usr/local
422 endif
423
424 ifeq ($(OS), netbsd)
425         doc_dir = share/doc/$(MAIN_NAME)/
426         man_dir = man/
427         data_dir = share/$(MAIN_NAME)/
428         LOCALBASE ?= /usr/pkg
429 endif
430
431 ifeq ($(OS), dragonfly)
432         doc_dir = share/doc/$(MAIN_NAME)/
433         man_dir = man/
434         data_dir = share/$(MAIN_NAME)/
435         LOCALBASE ?= /usr/pkg
436 endif
437
438 ifeq ($(OS), darwin)
439         doc_dir = share/doc/$(MAIN_NAME)/
440         man_dir = man/
441         data_dir = share/$(MAIN_NAME)/
442         LOCALBASE ?= /usr/local
443 endif
444
445 LOCALBASE ?= /usr/local
446
447 # Doxygen directory
448 doxygen_dir=doc/doxygen
449
450 BASEDIR ?= $(DESTDIR)
451 basedir = $(BASEDIR)
452 RUNBASEDIR ?= $(DESTDIR)
453 runbasedir = $(RUNBASEDIR)
454
455 # install location
456 PREFIX ?= $(LOCALBASE)
457 prefix = $(PREFIX)
458 # install path is $(basedir) $(prefix)
459 # example:
460 #  creating a bin. archive in /tmp, which unpacks in /usr/local
461 #  basedir=/tmp
462 #  prefix=/usr/local
463
464 # install prefixes for various stuff
465 cfg_prefix = $(basedir)$(prefix)
466 bin_prefix = $(basedir)$(prefix)
467 modules_prefix = $(basedir)$(prefix)
468 lib_prefix = $(basedir)$(prefix)
469 run_prefix = $(runbasedir)
470 doc_prefix = $(basedir)$(prefix)
471 man_prefix = $(basedir)$(prefix)
472 ut_prefix = $(basedir)$(prefix)
473 share_prefix = $(basedir)$(prefix)
474 data_prefix = $(basedir)$(prefix)
475
476
477 # target dirs for various stuff
478 cfg_target = $(prefix)/$(cfg_dir)
479 bin_target = $(prefix)/$(bin_dir)
480 #modules_target = $(prefix)/$(modules_dir)
481 lib_target = $(prefix)/$(lib_dir)
482 run_target = $(run_prefix)/$(run_dir)
483 doc_target = $(prefix)/$(doc_dir)
484 data_target = $(prefix)/$(data_dir)
485
486
487 # compile-time options
488 #
489 # -DSTATS
490 #               allows to print out number of packets processed on CTRL-C;
491 #               implementation still nasty and reports per-process
492 # -DNO_DEBUG
493 #               turns off some of the debug messages (DBG(...)).
494 # -DNO_LOG
495 #               completely turns of all the logging (and DBG(...))
496 # -DEXTRA_DEBUG
497 #               compiles in some extra debugging code
498 # -DDNS_IP_HACK
499 #               faster ip address resolver for ip strings (e.g "127.0.0.1")
500 # -DSHM_MEM
501 #               compiles in shared mem. support, needed by some modules and
502 #               by USE_SHM_MEM
503 # -DSHM_MMAP
504 #               use mmap instead of SYSV shared memory
505 # -DPKG_MALLOC
506 #               uses a faster malloc (exclusive w/ USE_SHM_MEM)
507 # -DUSE_SHM_MEM
508 #               all pkg_malloc => shm_malloc (most mallocs use a common sh.
509 #               mem. segment); don't define PKG_MALLOC if you want this!
510 # -DDBG_QM_MALLOC
511 #               qm_malloc debug code, will cause pkg_malloc and shm_malloc
512 #               to keep and display lot of debuging information: file name,
513 #               function, line number of malloc/free call for each block,
514 #               extra error checking (trying to free the same pointer
515 #               twice, trying to free a pointer alloc'ed with a different
516 #               malloc etc.)
517 # -DVQ_MALLOC
518 #               additional option to PKG_MALLOC which utilizes a fater then
519 #               qm version
520 #               (not true anymore, q_malloc performs approx. the same)
521 # -DQ_MALLOC
522 #               custom quick malloc, recommended for debugging
523 # -DF_MALLOC
524 #               an even faster malloc, not recommended for debugging
525 # -DTLSF_MALLOC
526 #       an implemetation of the "two levels segregated fit" malloc algorithm
527 # -DDL_MALLOC
528 #               a malloc implementation based on Doug Lea's dl_malloc
529 # -DSF_MALLOC
530 #               an experimental multi-CPU, pool based, multi-process safe version of
531 #               F_MALLOC. Should give better performance on machines with lots of CPUs
532 #               after some tunning.
533 # -DLL_MALLOC
534 #               an experimental multi-CPU, pool based, multi-process safe, mostly
535 #               lockless version of SF_MALLOC/F_MALLOC. Not for production use for
536 #               now.
537 # -DDBG_MALLOC
538 #               issues additional debugging information if lock/unlock is called
539 # -DMEM_JOIN_FREE
540 #               enable the join of free memory chunks (see also mem_join cfg param)
541 # -DFAST_LOCK
542 #               uses fast arhitecture specific locking (see the arh. specific section)
543 # -DUSE_SYSV_SEM
544 #               uses sys v sems for locking (slower & limited number)
545 # -DUSE_PTHREAD_MUTEX
546 #               uses pthread mutexes, faster than sys v or posix sems, but do not
547 #               work on all systems inter-processes (e.g. linux)
548 # -DUSE_POSIX_SEM
549 #               uses posix semaphores for locking (faster than sys v)
550 # -DUSE_FUTEX
551 #               uses futexes for locking (linux 2.6+)
552 # -DBUSY_WAIT
553 #               uses busy waiting on the lock (FAST_LOCK)
554 # -DADAPTIVE_WAIT
555 #               try busy waiting for a while and if the lock is still held go to
556 #               force reschedule (FAST_LOCK)
557 # -DADAPTIVE_WAIT_LOOPS=number
558 #               number of loops we busy wait, after "number" loops have elapsed we
559 #               force a reschedule (FAST_LOCK)
560 # -DNOSMP
561 #               don't use smp compliant locking (faster but won't work on SMP machines)
562 #               (not yet enabled) (FAST_LOCK)
563 # -DNO_PINGTEL_TAG_HACK
564 #               if enabled, To-header-field will be less liberal and will not accept
565 #               'tag=' (tag parameter with equal sign and without value); it is called
566 #               this way because such message was sighted from a Pingtel phone
567 # -DUSE_TCP
568 #               compiles in tcp support
569 # -DDISABLE_NAGLE
570 #               disable the tcp Nagle algorithm (lower delay)
571 # -DUSE_TLS
572 #               compiles in tls support, requires -DUSE_TCP. Note: this is only
573 #               generic support (parsing a.s.o.), it does not include the actual
574 #               "tls engine". If you really want tls you need also either
575 #               -DCORE_TLS and a tls/ subdir with the tls code or -DTLS_HOOKS and
576 #               the tls module loaded.
577 # -DCORE_TLS
578 #               compiles tls in-core support. Requires -DUSE_TLS, conflicts
579 #               -DTLS_HOOKS. Please use make CORE_TLS=1 instead  (it will set all the
580 #               needed defines automatically and extra libraries needed for linking).
581 # -DTLS_HOOKS
582 #               compile tls module support (support for having the "tls engine" in a
583 #               module). Requires -DUSE_TLS, conflicts -DCORE_TLS.
584 #               Please use make TLS_HOOKS=1 (or TLS_HOOKS=0 to for disabling) instead
585 #               of setting -DTLS_HOOKS (it will set all the needed defines
586 #               automatically)
587 # -DHAVE_RESOLV_RES
588 #               support for changing some of the resolver parameters present
589 #                (_res structure in <resolv.h>)
590 # -DUSE_COMP
591 #               compiles in comp=[sergz|sigcomp] support (parsing uri & via,
592 #               adding it to via, lumps a.s.o). WARNING: right now this option
593 #               is useless since the compression code doesn't exist yet.
594 # -DHONOR_MADDR
595 #               compiles in checks and use for maddr parameter in uri.
596 #               Required to support Windows Messenger 5.x over TCP connection
597 #               which (mis)uses this parameter.
598 # -DUSE_DNS_CACHE
599 #               use an internal dns cache instead of making dns requests each time
600 # -DUSE_DNS_CACHE_STATS
601 #               turns on DNS cache measurements
602 # -DUSE_DNS_FAILOVER
603 #               if the destination resolves to multiple ips, on send error fall back
604 #               to the others
605 # -DUSE_DST_BLACKLIST
606 #               blacklist bad destination (timeout, failed to connect, error sending
607 #        a.s.o)
608 # -DUSE_DST_BLACKLIST_STATS
609 #               turns on blacklist bad destination measurements
610 # -DPROFILING
611 #               if enabled profiling will be enabled for child processes
612 #               Don't forget to set PROFILE (see below)
613 # -DNO_SIG_DEBUG
614 #        turns off debugging messages in signal handlers (which might be
615 #         unsafe)
616 # -DUSE_NAPTR
617 #                turns on naptr support (but must be also enabled from the config)
618 # -DDNS_WATCHDOG_SUPPORT
619 #               turns on DNS watchdog support which can be used to inform the
620 #               core that the DNS servers are down. No DNS query is performed
621 #               when the servers are unreachable, and even expired resource
622 #               records are used from the cache. (requires external watchdog)
623 # -DWITH_AS_SUPPORT
624 #               adds support for Application Server interface
625 # Sometimes is needes correct non-quoted $OS. HACK: gcc translates known OS to number ('linux'), so there is added underscore
626
627 ifeq ($(OS), dragonfly)
628         # Tell it that dragonflybsd is equivalent to compiling for freebsd, but
629         # define also __OS_dragonfly (for fine-tunning like kqueue support).
630         os_defs := -D__OS_freebsd -D__OS_dragonfly
631         EQUIV_OS = freebsd
632 else
633         os_defs := -D__OS_$(OS)
634         EQUIV_OS = $(OS)
635 endif
636
637 C_DEFS= $(extra_defs) \
638          -DNAME='"$(MAIN_NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
639          -DOS='$(OS)_' -DOS_QUOTED='"$(OS)"' -DCOMPILER='"$(CC_VER)"'\
640          -D__CPU_$(ARCH) $(os_defs) \
641          -DSER_VER=$(SER_VER) \
642          -DCFG_DIR='"$(cfg_target)"'\
643          -DRUN_DIR='"$(run_target)"'\
644          -DPKG_MALLOC \
645          -DSHM_MEM  -DSHM_MMAP \
646          -DDNS_IP_HACK \
647          -DUSE_MCAST \
648          -DUSE_TCP \
649          -DDISABLE_NAGLE \
650          -DHAVE_RESOLV_RES \
651          -DUSE_DNS_CACHE \
652          -DUSE_DNS_FAILOVER \
653          -DUSE_DST_BLACKLIST \
654          -DUSE_NAPTR \
655          -DWITH_XAVP \
656          #-DUSE_DNS_CACHE_STATS \
657          #-DUSE_DST_BLACKLIST_STATS \
658          #-DDNS_WATCHDOG_SUPPORT \
659          #-DLL_MALLOC \
660          #-DSF_MALLOC \
661          #-DDL_MALLOC \
662          #-DDBG_F_MALLOC \
663          #-DNO_DEBUG \
664          #-DEXTRA_DEBUG \
665          #-DVQ_MALLOC  \
666          #-DDBG_LOCK \
667          #-DNOSMP \
668          #-DUSE_SHM_MEM \
669          #-DSTATS \
670          #-DNO_LOG \
671          #-DPROFILING \
672          #-DNO_SIG_DEBUG
673
674 #PROFILE=  -pg  # set this if you want profiling
675                                 # you may also want to set -DPROFILING
676
677 # WARNING: do not add mode=debug or mode=release anymore in the Makefile,
678 # use make mode=debug all instead. Anyway no by default ser is  compiled w/
679 # debugging symbols in all cases (-g). --andrei
680
681 # memory managers and related debug mode
682 C_DEFS+= -DMEM_JOIN_FREE
683 # enable f_malloc
684 C_DEFS+= -DF_MALLOC
685 # enable q_malloc
686 C_DEFS+= -DQ_MALLOC
687 # enable TLSF malloc
688 C_DEFS+= -DTLSF_MALLOC
689 ifeq    ($(MEMDBG), 1)
690         C_DEFS+= -DDBG_SR_MEMORY
691 endif
692
693 ifneq ($(PKG_MEM_SIZE),)
694         C_DEFS+= -DPKG_MEM_SIZE=$(PKG_MEM_SIZE)
695 endif
696 ifeq ($(CORE_TLS), 1)
697         C_DEFS+= -DUSE_TLS -DCORE_TLS
698 endif
699 ifeq ($(TLS_HOOKS), 1)
700         C_DEFS+= -DUSE_TLS -DTLS_HOOKS
701 endif
702 ifeq ($(KMSTATS), 1)
703         C_DEFS+= -DUSE_CORE_STATS -DSTATISTICS
704 endif
705 ifeq ($(FMSTATS), 1)
706         C_DEFS+= -DMALLOC_STATS
707 endif
708 ifeq ($(WITHAS), 1)
709         C_DEFS+= -DWITH_AS_SUPPORT
710 endif
711
712 ifeq ($(SCTP), 1)
713         C_DEFS+= -DUSE_SCTP
714 endif
715
716 ifeq ($(mode),)
717         mode = release
718 endif
719
720 ifeq ($(mode),debug)
721         C_DEFS+= -DEXTRA_DEBUG
722 endif
723
724 # platform dependent settings
725
726 # find ld & as name (gnu or solaris)
727 ifeq ($(OS), solaris)
728 ifeq ($(CC_NAME), gcc)
729                 LDGCC:=$(shell $(CC) -v 2>&1 | grep with-ld| \
730                                    sed -e 's/.*--with-ld=\([^ ][^ ]*\).*/\1/' )
731                 ASGCC:=$(shell $(CC) -v 2>&1 | grep with-as| \
732                                    sed -e 's/.*--with-as=\([^ ][^ ]*\).*/\1/' )
733                 LDPATH:=$(shell  if [ -z "$(LDGCC)" ] ; then echo "ld" ;\
734                                                 else \
735                                                 if $(LDGCC) -V 2>/dev/null 1>/dev/null; then \
736                                                         echo $(LDGCC); \
737                                                 else echo "ld" ; \
738                                                 fi\
739                                                 fi)
740                 ASPATH:=$(shell  if [ -z "$(ASGCC)" ] ; then echo "as" ;\
741                                                 else \
742                                                 if $(ASGCC) -V 2>/dev/null 1>/dev/null </dev/null; \
743                                                 then \
744                                                         echo $(ASGCC); \
745                                                 else echo "as" ; \
746                                                 fi\
747                                                 fi)
748
749                 LDTYPE:=$(shell if $(LDPATH) -V 1>/dev/null  2>/dev/null; then \
750                                                         if $(LDPATH) -V 2>&1|grep GNU >/dev/null; \
751                                                         then echo gnu; \
752                                                         else \
753                                                         if $(LDPATH) -V 2>&1|grep Solaris >/dev/null;\
754                                                         then echo solaris; \
755                                                         else \
756                                                                 echo unknown ; \
757                                                         fi \
758                                                         fi \
759                                                 fi)
760                 ASTYPE:=$(shell if $(ASPATH) -V 1>/dev/null  2>/dev/null </dev/null; \
761                                                 then \
762                                                         if $(ASPATH) -V 2>&1 </dev/null | \
763                                                                 grep GNU >/dev/null; then echo gnu; \
764                                                         else \
765                                                         if $(ASPATH) -V 2>&1 </dev/null | \
766                                                                 grep Sun >/dev/null; then echo solaris; \
767                                                         else \
768                                                                 echo unknown ; \
769                                                         fi \
770                                                         fi \
771                                                 fi)
772 #$(warning "using ld=$(LDPATH)/$(LDTYPE), as=$(ASPATH)/$(ASTYPE)")
773
774 endif
775 endif
776
777 # arch. specific definitions
778 ifeq ($(ARCH), i386)
779         use_fast_lock=yes
780 endif
781
782 ifeq ($(ARCH), x86_64)
783         use_fast_lock=yes
784 endif
785
786 ifeq ($(ARCH), sparc64)
787 ifeq    ($(CC_NAME), gcc)
788         use_fast_lock=yes
789 endif
790 endif
791
792 ifeq ($(ARCH), sparc)
793         use_fast_lock=yes
794 endif
795
796 ifeq ($(ARCH), arm)
797         use_fast_lock=yes
798         C_DEFS+=-DNOSMP # very unlikely to have an smp arm
799 endif
800
801 ifeq ($(ARCH), arm6)
802         use_fast_lock=yes
803         C_DEFS+=-DNOSMP # very unlikely to have an smp arm
804 endif
805
806 ifeq ($(ARCH), ppc)
807         use_fast_lock=yes
808 endif
809
810 ifeq ($(ARCH), ppc64)
811         use_fast_lock=yes
812 endif
813
814 ifeq ($(ARCH), mips)
815 # mips1 arch. (e.g. R3000) - no hardware locking support
816         use_fast_lock=no
817         C_DEFS+=-DMIPS_HAS_LLSC # likely
818         C_DEFS+=-DNOSMP # very likely
819 endif
820
821 ifeq ($(ARCH), mips2)
822 # mips2 arch and newer (mips3=R4000, mips4=R5000 a.s.o)
823         use_fast_lock=yes
824 endif
825
826 ifeq ($(ARCH), mips64)
827 # mips2 arch and newer (mips3=R4000, mips4=R5000 a.s.o)
828         use_fast_lock=yes
829 endif
830
831 ifeq ($(ARCH), alpha)
832         use_fast_lock=yes
833         C_DEFS+=-DNOSMP # very likely
834 endif
835
836 ifeq ($(use_fast_lock), yes)
837         C_DEFS+= -DFAST_LOCK -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024
838         found_lock_method=yes
839 endif
840
841 CFLAGS=
842 LDFLAGS=
843 C_INCLUDES=
844 # setting CFLAGS
845 ifeq ($(mode), release)
846         #if i386
847 ifeq    ($(ARCH), i386)
848                 # if gcc
849 ifeq            ($(CC_NAME), gcc)
850                                 C_DEFS+=-DCC_GCC_LIKE_ASM
851                                 #common stuff
852                                 CFLAGS=-g $(CC_OPT) -funroll-loops  -Wcast-align $(PROFILE)
853                         #if gcc 6.0+, 5.0+, 4.5+ or 4.2+
854 ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+ 6.0+,$(CC_SHORTVER))))
855 $(call                          set_if_empty,CPUTYPE,athlon64)
856                                         CFLAGS+=-m32 -minline-all-stringops \
857                                                         -falign-loops \
858                                                         -ftree-vectorize \
859                                                         -fno-strict-overflow \
860                                                         -mtune=$(CPUTYPE)
861                                         LDFLAGS+=-m32
862 else
863                         #if gcc 4.0+
864 ifeq                    ($(CC_SHORTVER), 4.x)
865 $(call                          set_if_empty,CPUTYPE,athlon64)
866                                         CFLAGS+=-m32 -minline-all-stringops \
867                                                         -falign-loops \
868                                                         -ftree-vectorize \
869                                                         -mtune=$(CPUTYPE)
870                                         LDFLAGS+=-m32
871 else
872                         #if gcc 3.4+
873 ifeq                    ($(CC_SHORTVER), 3.4)
874 $(call                          set_if_empty,CPUTYPE,athlon)
875                                         CFLAGS+=-m32 -minline-all-stringops \
876                                                         -falign-loops \
877                                                         -mtune=$(CPUTYPE)
878                                         LDFLAGS+=-m32
879 else
880                         #if gcc 3.0+
881 ifeq                    ($(CC_SHORTVER), 3.0)
882 $(call                          set_if_empty,CPUTYPE,athlon)
883                                         CFLAGS+=-minline-all-stringops \
884                                                         -falign-loops \
885                                                         -mcpu=$(CPUTYPE)
886                                         # -m32 supported since gcc 3.2
887 else
888 ifeq                    ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
889 $(warning                       Old gcc detected ($(CC_SHORTVER)), use  gcc >= 3.1 \
890                                         for better results)
891
892                                         CFLAGS+=-m486 \
893                                                         -malign-loops=4
894 else
895                                 #really old version
896 $(warning                       You are using an old and unsupported gcc \
897                                          version  ($(CC_SHORTVER)), compile at your own risk!)
898
899 endif                   # CC_SHORTVER, 2.9x
900 endif                   # CC_SHORTVER, 3.0
901 endif                   # CC_SHORTVER, 3.4
902 endif                   # CC_SHORTVER, 4.x
903 endif                   # CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
904
905 else            # CC_NAME, gcc
906 ifeq            ($(CC_NAME), clang)
907 $(call                          set_if_empty,CPUTYPE,athlon64)
908                                         C_DEFS+=-DCC_GCC_LIKE_ASM
909                                         CFLAGS+=-g -m32 $(CC_OPT) -mtune=$(CPUTYPE)
910                                         LDFLAGS+=-m32
911 else                    # CC_NAME, clang
912 ifeq            ($(CC_NAME), icc)
913                         C_DEFS+=-DCC_GCC_LIKE_ASM
914                         CFLAGS=-g -O3  -ipo -ipo_obj -unroll  $(PROFILE) \
915                                          -tpp6 -xK  #-openmp  #optimize for PIII
916                                 # -prefetch doesn't seem to work
917                                 #( ty to inline acroos files, unroll loops,prefetch,
918                                 # optimize for PIII, use PIII instructions & vect.,
919                                 # mutlithread loops)
920 else
921                                 #other compilers
922 $(error                         Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
923 endif           #CC_NAME, icc
924 endif           #CC_NAME, clang
925 endif           #CC_NAME, gcc
926 endif   #ARCH, i386
927
928 #x86_64
929 ifeq    ($(ARCH), x86_64)
930                 # if gcc
931 ifeq            ($(CC_NAME), gcc)
932                                 C_DEFS+=-DCC_GCC_LIKE_ASM
933                                 #common stuff
934                                 CFLAGS=-g $(CC_OPT) -funroll-loops  -Wcast-align $(PROFILE)
935                         #if gcc 4.5+
936                         # don't add '-mtune=$(CPUTYPE)' - gcc failure
937 ifeq                    ($(CC_SHORTVER),$(filter $(CC_SHORTVER),4.5+ 5.0+ 6.0+))
938 $(call                          set_if_empty,CPUTYPE,opteron)
939                                         CFLAGS+=-m64 -minline-all-stringops \
940                                                         -falign-loops \
941                                                         -ftree-vectorize \
942                                                         -fno-strict-overflow
943                                         LDFLAGS+=-m64
944 else
945                         #if gcc 4.2+
946 ifeq                    ($(CC_SHORTVER), 4.2+)
947 $(call                          set_if_empty,CPUTYPE,opteron)
948                                         CFLAGS+=-m64 -minline-all-stringops \
949                                                         -falign-loops \
950                                                         -ftree-vectorize \
951                                                         -fno-strict-overflow \
952                                                         -mtune=$(CPUTYPE)
953                                         LDFLAGS+=-m64
954 else
955                         #if gcc 4.0+
956 ifeq                    ($(CC_SHORTVER), 4.x)
957 $(call                          set_if_empty,CPUTYPE,opteron)
958                                         CFLAGS+=-m64 -minline-all-stringops \
959                                                         -falign-loops \
960                                                         -ftree-vectorize \
961                                                         -mtune=$(CPUTYPE)
962                                         LDFLAGS+=-m64
963 else
964                         #if gcc 3.4
965 ifeq                    ($(CC_SHORTVER), 3.4)
966 $(call                          set_if_empty,CPUTYPE,athlon64)
967                                         CFLAGS+=-m64 -minline-all-stringops \
968                                                         -falign-loops
969                                         LDFLAGS+=-m64
970 else
971                         #if gcc 3.0
972 ifeq                    ($(CC_SHORTVER), 3.0)
973 $(call                          set_if_empty,CPUTYPE,athlon64)
974                                         CFLAGS+=-minline-all-stringops \
975                                                         -falign-loops
976                                                         #-mcpu=$(CPUTYPE) \ # not working on all x86_64 gccs
977                                                         #-mcpu=athlon
978                                         #-m64 on x86_64/x86 works starting with gcc 3.2
979 else
980 ifeq                    ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
981 $(warning                       Old gcc detected ($(CC_SHORTVER)), use  gcc >= 3.1 \
982                                         for better results)
983
984                                         CFLAGS+=-m486 \
985                                                         -malign-loops=4
986 else
987                                 #really old version
988 $(warning                       You are using an old and unsupported gcc \
989                                          version  ($(CC_SHORTVER)), compile at your own risk!)
990
991 endif                   # CC_SHORTVER, 2.9x
992 endif                   # CC_SHORTVER, 3.0
993 endif                   # CC_SHORTVER, 3.4
994 endif                   # CC_SHORTVER, 4.x
995 endif                   # CC_SHORTVER, 4.2+
996 endif                   # CC_SHORTVER, 6.0+, 5.0+, 4.5+
997
998 else            # CC_NAME, gcc
999 ifeq            ($(CC_NAME), clang)
1000 $(call                          set_if_empty,CPUTYPE,opteron)
1001                                         C_DEFS+=-DCC_GCC_LIKE_ASM
1002                                         CFLAGS+=-g -m64 \
1003                                                 $(CC_OPT)
1004                                         LDFLAGS+=-m64
1005 else            # CC_NAME, clang
1006 ifeq            ($(CC_NAME), icc)
1007                         C_DEFS+=-DCC_GCC_LIKE_ASM
1008                         CFLAGS=-g -O3  -ipo -ipo_obj -unroll  $(PROFILE) \
1009                                          -tpp6 -xK  #-openmp  #optimize for PIII
1010                                 # -prefetch doesn't seem to work
1011                                 #( ty to inline acroos files, unroll loops,prefetch,
1012                                 # optimize for PIII, use PIII instructions & vect.,
1013                                 # mutlithread loops)
1014 else
1015                                 #other compilers
1016 $(error                         Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
1017 endif           #CC_NAME, icc
1018 endif           #CC_NAME, clang
1019 endif           #CC_NAME, gcc
1020 endif   #ARCH, x86_64
1021
1022         #if sparc64
1023 ifeq    ($(ARCH), sparc64)
1024                         #if gcc
1025 ifeq            ($(CC_NAME), gcc)
1026                                 C_DEFS+=-DCC_GCC_LIKE_ASM -DSPARC64_MODE
1027                                 #common stuff
1028                                 CFLAGS=-g $(CC_OPT) -funroll-loops  $(PROFILE) \
1029                                         #-Wcast-align \
1030                                         #-Wmissing-prototypes
1031                                 #if gcc 6.0+, 5.0+, 4.5+ or 4.2+
1032 ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+ 6.0+,$(CC_SHORTVER))))
1033 $(call                          set_if_empty,CPUTYPE,ultrasparc)
1034                                         #use 32bit for now
1035                                         CFLAGS+=-m64 -mcpu=ultrasparc  \
1036                                                         -mtune=$(CPUTYPE) \
1037                                                         -fno-strict-overflow \
1038                                                         -ftree-vectorize
1039                                         # use -m64 to force 64 bit (but add it also to LDFLAGS and
1040                                         #  don't forget to define SPARC64_MODE)
1041                                         # -m32 for 32 bit (default on solaris),
1042                                         # nothing for arch. default
1043                                         LDFLAGS+=-m64
1044 else
1045                                 #if gcc 4.x
1046 ifeq                    ($(CC_SHORTVER), 4.x)
1047 $(call                          set_if_empty,CPUTYPE,ultrasparc)
1048                                         #use 32bit for now
1049                                         CFLAGS+=-m64 -mcpu=ultrasparc  \
1050                                                         -mtune=$(CPUTYPE) \
1051                                                         -ftree-vectorize
1052                                         LDFLAGS+=-m64
1053 else
1054                                 #if gcc 3.4
1055 ifeq                    ($(CC_SHORTVER), 3.4)
1056 $(call                          set_if_empty,CPUTYPE,ultrasparc)
1057                                         #use 32bit for now
1058                                         CFLAGS+=-m64 -mcpu=ultrasparc -mtune=$(CPUTYPE)
1059                                         LDFLAGS+=-m64
1060 else
1061                                 #if gcc 3.0
1062 ifeq                    ($(CC_SHORTVER), 3.0)
1063 $(call                          set_if_empty,CPUTYPE,ultrasparc)
1064                                         #use 32bit for now
1065                                         CFLAGS+=-m64 -mcpu=ultrasparc -mtune=$(CPUTYPE)   \
1066                                         # -mcpu=v9 or ultrasparc? # -mtune implied by -mcpu
1067                                         #-mno-epilogue #try to inline function exit code
1068                                         #-mflat # omit save/restore
1069                                         #-,faster-structs #faster non Sparc ABI structure copy ops
1070                                         LDFLAGS+=-m64
1071 else                    # CC_SHORTVER, 3.0
1072 ifeq                    ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
1073 $(warning                       Old gcc detected ($(CC_SHORTVER)), use  gcc >= 3.1 \
1074                                         for better results)
1075 ifneq                           ($(OS), netbsd)
1076                                                 # on netbsd/sparc64,  gcc 2.95.3 does not compile
1077                                                 # ser with -mv8
1078                                                 CFLAGS+= -mv9
1079                                                 # -m64/-m32 on sparc works starting with gcc 3.0
1080 endif
1081 ifeq                                    ($(ASTYPE), solaris)
1082                                                         CFLAGS+= -Wa,-xarch=v8plus
1083 endif
1084 else                    #CC_SHORTVER, 2.9x
1085                                 #really old version
1086 $(warning                       You are using an old and unsupported gcc \
1087                                          version ($(CC_SHORTVER)), compile at your own risk!)
1088
1089                                         CFLAGS+= -mv9
1090 ifeq                                    ($(ASTYPE), solaris)
1091                                                         CFLAGS+= -Wa,-xarch=v8plus
1092 endif
1093
1094 endif                   #CC_SHORTVER, 2.9x
1095 endif                   #CC_SHORTVER, 3.0
1096 endif                   #CC_SHORTVER, 3.4
1097 endif                   #CC_SHORTVER, 4.x
1098 endif                   #CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
1099
1100 else            #CC_NAME, gcc
1101 ifeq            ($(CC_NAME), suncc)
1102                         C_DEFS+=-DCC_GCC_LIKE_ASM
1103                         C_DEFS+=-DSPARC64_MODE
1104                         CFLAGS+= -m64 -g -xO3 -xtarget=native -xmemalign=8i \
1105                                         -fma=fused -fns=yes \
1106                                         -xc99 # C99 support
1107                         LDFLAGS+=-m64
1108                         # -Dinline="" # add this if cc < 5.3 (define inline as null)
1109 else
1110                                 #other compilers
1111 $(error                         Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
1112 endif           #CC_NAME, suncc
1113 endif           #CC_NAME, gcc
1114 endif   #ARCH, sparc64
1115
1116         #if sparc
1117 ifeq    ($(ARCH), sparc)
1118                         #if gcc
1119 ifeq            ($(CC_NAME), gcc)
1120                                 C_DEFS+=-DCC_GCC_LIKE_ASM
1121                                 #common stuff
1122                                 CFLAGS=-g $(CC_OPT) -funroll-loops  $(PROFILE) \
1123                                         #-Wcast-align \
1124                                         #-Wmissing-prototypes
1125                                 #if gcc 5.0+, 4.5+ or 4.2+
1126 ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+ 6.0+,$(CC_SHORTVER))))
1127 $(call                          set_if_empty,CPUTYPE,v8)
1128                                         #use 32bit for now
1129                                         CFLAGS+= -mtune=$(CPUTYPE) \
1130                                                         -fno-strict-overflow \
1131                                                         -ftree-vectorize
1132 else
1133                                 #if gcc 4.x
1134 ifeq                    ($(CC_SHORTVER), 4.x)
1135 $(call                          set_if_empty,CPUTYPE,v8)
1136                                         #use 32bit for now
1137                                         CFLAGS+= -mtune=$(CPUTYPE) \
1138                                                         -ftree-vectorize
1139 else
1140                                 #if gcc 3.4
1141 ifeq                    ($(CC_SHORTVER), 3.4)
1142 $(call                          set_if_empty,CPUTYPE,v8)
1143                                         #use 32bit for now
1144                                         CFLAGS+= -mtune=$(CPUTYPE)
1145 else
1146                                 #if gcc 3.0
1147 ifeq                    ($(CC_SHORTVER), 3.0)
1148 $(call                          set_if_empty,CPUTYPE,v8)
1149                                         #use 32bit for now
1150                                         CFLAGS+= -mtune=$(CPUTYPE)   \
1151                                         #-mno-epilogue #try to inline function exit code
1152                                         #-mflat # omit save/restore
1153                                         #-,faster-structs #faster non Sparc ABI structure copy ops
1154 else                    # CC_SHORTVER, 3.0
1155 ifeq                    ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
1156 $(warning                       Old gcc detected ($(CC_SHORTVER)), use  gcc >= 3.1 \
1157                                         for better results)
1158 else                    #CC_SHORTVER, 2.9x
1159                                 #really old version
1160 $(warning                       You are using an old and unsupported gcc \
1161                                          version ($(CC_SHORTVER)), compile at your own risk!)
1162
1163 endif                   #CC_SHORTVER, 2.9x
1164 endif                   #CC_SHORTVER, 3.0
1165 endif                   #CC_SHORTVER, 3.4
1166 endif                   #CC_SHORTVER, 4.x
1167 endif                   #CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
1168
1169 else            #CC_NAME, gcc
1170 ifeq            ($(CC_NAME), suncc)
1171                         C_DEFS+=-DCC_GCC_LIKE_ASM
1172                         CFLAGS+= -g -xO3 -xtarget=native -xmemalign=4i \
1173                                         -fma=fused -fns=yes \
1174                                         -xc99 # C99 support
1175                         # -Dinline="" # add this if cc < 5.3 (define inline as null)
1176 else
1177                                 #other compilers
1178 $(error                         Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
1179 endif           #CC_NAME, suncc
1180 endif           #CC_NAME, gcc
1181 endif   #ARCH, sparc
1182
1183         #if ipaq/netwinder
1184 ifeq    ($(ARCH), arm)
1185                 # if gcc
1186 ifeq            ($(CC_NAME), gcc)
1187                                 C_DEFS+=-DCC_GCC_LIKE_ASM
1188                                 #common stuff
1189                                 CFLAGS=-marm -march=armv5t $(CC_OPT) -funroll-loops -fsigned-char $(PROFILE)
1190                         #if gcc 4.5+ or 4.2+
1191 ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+ 6.0+,$(CC_SHORTVER))))
1192                                         CFLAGS+= -ftree-vectorize -fno-strict-overflow
1193                                         # not supported on arm: -minline-all-stringops
1194 else
1195                         #if gcc 4.x+
1196 ifeq                    ($(CC_SHORTVER), 4.x)
1197                                         CFLAGS+= -ftree-vectorize
1198                                         # not supported on arm: -minline-all-stringops
1199 else
1200                         #if gcc 3.4+
1201 ifeq                    ($(CC_SHORTVER), 3.4)
1202                                         CFLAGS+=
1203 else
1204                         #if gcc 3.0
1205 ifeq                    ($(CC_SHORTVER), 3.0)
1206                                         CFLAGS+=
1207                                                         #-mcpu=athlon
1208 else
1209 ifeq                    ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
1210 $(warning                       Old gcc detected ($(CC_SHORTVER)), use  gcc 3.0.x \
1211                                         for better results)
1212
1213                                         CFLAGS+=
1214 else
1215                                 #really old version
1216 $(warning                       You are using an old and unsupported gcc \
1217                                          version ($(CC_SHORTVER)), compile at your own risk!)
1218
1219 endif                   # CC_SHORTVER, 2.9x
1220 endif                   # CC_SHORTVER, 3.0
1221 endif                   # CC_SHORTVER, 3.4
1222 endif                   # CC_SHORTVER, 4.x
1223 endif                   # CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
1224
1225 else            # CC_NAME, gcc
1226                                 #other compilers
1227 $(error                         Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
1228 endif           #CC_NAME, gcc
1229 endif   #ARCH, arm
1230
1231         #if armv6 cpu
1232 ifeq    ($(ARCH), arm6)
1233                 # if gcc
1234 ifeq            ($(CC_NAME), gcc)
1235                                 C_DEFS+=-DCC_GCC_LIKE_ASM
1236                                 #common stuff
1237                                 CFLAGS=-march=armv6 $(CC_OPT) -funroll-loops -fsigned-char \
1238                                                 $(PROFILE)
1239                         #if gcc 6.0+, 5.0+, 4.5+ or 4.2+
1240 ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+ 6.0+,$(CC_SHORTVER))))
1241                                         CFLAGS+= -ftree-vectorize -fno-strict-overflow
1242 else
1243                         #if gcc 4.x+
1244 ifeq                    ($(CC_SHORTVER), 4.x)
1245                                         CFLAGS+= -ftree-vectorize
1246 else
1247                         #if gcc 3.4+
1248 ifeq                    ($(CC_SHORTVER), 3.4)
1249                                         CFLAGS+=
1250 else
1251                         #if gcc 3.0
1252 ifeq                    ($(CC_SHORTVER), 3.0)
1253                                         CFLAGS+=
1254                                                         #-mcpu=athlon
1255 else
1256 ifeq                    ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
1257 $(warning                       Old gcc detected ($(CC_SHORTVER)), use  gcc 3.0.x \
1258                                         for better results)
1259
1260                                         CFLAGS+=
1261 else
1262                                 #really old version
1263 $(warning                       You are using an old and unsupported gcc \
1264                                          version ($(CC_SHORTVER)), compile at your own risk!)
1265
1266 endif                   # CC_SHORTVER, 2.9x
1267 endif                   # CC_SHORTVER, 3.0
1268 endif                   # CC_SHORTVER, 3.4
1269 endif                   # CC_SHORTVER, 4.x
1270 endif                   # CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
1271
1272 else            # CC_NAME, gcc
1273                                 #other compilers
1274 $(error                         Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
1275 endif           #CC_NAME, gcc
1276 endif   #ARCH, arm6
1277
1278         #if  mips (R3000)
1279 ifeq    ($(ARCH), mips)
1280                 # if gcc
1281 ifeq            ($(CC_NAME), gcc)
1282                                 C_DEFS+=-DCC_GCC_LIKE_ASM
1283                                 #common stuff
1284                                 CFLAGS=$(CC_OPT) -funroll-loops  $(PROFILE)
1285                         #if gcc 6.0, 5.0+, 4.5+ or 4.2+
1286 ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+ 6.0+,$(CC_SHORTVER))))
1287                                         CFLAGS+=-mfp32 -march=r3000 \
1288                                                         -ftree-vectorize -fno-strict-overflow
1289                         # not supported on mips: -minline-all-stringops
1290 else
1291                         #if gcc 4.0+
1292 ifeq                    ($(CC_SHORTVER), 4.x)
1293                                         CFLAGS+=-march=r3000 \
1294                                                         -ftree-vectorize
1295                         # not supported on mips: -minline-all-stringops
1296 else
1297                         #if gcc 3.4+
1298 ifeq                    ($(CC_SHORTVER), 3.4)
1299                                         CFLAGS+= -march=r3000
1300 else
1301                         #if gcc 3.0
1302 ifeq                    ($(CC_SHORTVER), 3.0)
1303                                         CFLAGS+= -march=r3000
1304 else
1305 ifeq                    ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
1306 $(warning                       Old gcc detected ($(CC_SHORTVER)), use  gcc 3.0.x \
1307                                         for better results)
1308
1309                                         CFLAGS+=-march=r3000
1310 else
1311                                 #really old version
1312 $(warning                       You are using an old and unsupported gcc \
1313                                          version ($(CC_SHORTVER)), compile at your own risk!)
1314
1315 endif                   # CC_SHORTVER, 2.9x
1316 endif                   # CC_SHORTVER, 3.0
1317 endif                   # CC_SHORTVER, 3.4
1318 endif                   # CC_SHORTVER, 4.x
1319 endif                   # CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
1320
1321 else            # CC_NAME, gcc
1322                                 #other compilers
1323 $(error                         Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
1324 endif           #CC_NAME, gcc
1325 endif   #ARCH, mips
1326
1327         #if  >=mips2 (R4000, R5000, R6000 ....)
1328 ifeq    ($(ARCH), mips2)
1329                 # if gcc
1330 ifeq            ($(CC_NAME), gcc)
1331                                 C_DEFS+=-DCC_GCC_LIKE_ASM
1332                                 #common stuff
1333                                 CFLAGS= -mips2 $(CC_OPT) -funroll-loops $(PROFILE)
1334                         #if gcc 6.0+, 5.0+, 4.5+ or 4.2+
1335 ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+ 6.0+,$(CC_SHORTVER))))
1336                                         CFLAGS+=-ftree-vectorize -fno-strict-overflow
1337                         # not supported on mips: -minline-all-stringops
1338 else
1339                         #if gcc 4.0+
1340 ifeq                    ($(CC_SHORTVER), 4.x)
1341                                         CFLAGS+=-ftree-vectorize
1342                         # not supported on mips: -minline-all-stringops
1343 else
1344                         #if gcc 3.4+
1345 ifeq                    ($(CC_SHORTVER), 3.4)
1346                                         CFLAGS+=
1347 else
1348                         #if gcc 3.0
1349 ifeq                    ($(CC_SHORTVER), 3.0)
1350                                         CFLAGS+=
1351 else
1352 ifeq                    ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
1353 $(warning                       Old gcc detected ($(CC_SHORTVER)), use  gcc 3.0.x \
1354                                         for better results)
1355                                         CFLAGS+=
1356 else
1357                                 #really old version
1358 $(warning                       You are using an old and unsupported gcc \
1359                                          version ($(CC_SHORTVER)), compile at your own risk!)
1360
1361 endif                   # CC_SHORTVER, 2.9x
1362 endif                   # CC_SHORTVER, 3.0
1363 endif                   # CC_SHORTVER, 3.4
1364 endif                   # CC_SHORTVER, 4.x
1365 endif                   # CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
1366
1367 else            # CC_NAME, gcc
1368                                 #other compilers
1369 $(error                         Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
1370 endif           #CC_NAME, gcc
1371 endif   #ARCH, mips2
1372
1373 #if  >=mips64
1374 ifeq    ($(ARCH), mips64)
1375                 # if gcc
1376 ifeq            ($(CC_NAME), gcc)
1377                                 C_DEFS+=-DCC_GCC_LIKE_ASM
1378                                 #common stuff
1379                                 CFLAGS= -mips64 $(CC_OPT) -funroll-loops $(PROFILE)
1380                         #if gcc 6.0+, 5.0+, 4.5+ or 4.2+
1381 ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+ 6.0+,$(CC_SHORTVER))))
1382                                         CFLAGS+=-ftree-vectorize -fno-strict-overflow
1383                         # not supported on mips: -minline-all-stringops
1384
1385 else
1386                         #if gcc 4.0+
1387 ifeq                    ($(CC_SHORTVER), 4.x)
1388                                         CFLAGS+=-ftree-vectorize
1389                         # not supported on mips: -minline-all-stringops
1390 else
1391                         #if gcc 3.4+
1392 ifeq                    ($(CC_SHORTVER), 3.4)
1393                                         CFLAGS+=
1394 else
1395                         #if gcc 3.0
1396 ifeq                    ($(CC_SHORTVER), 3.0)
1397                                         CFLAGS+=
1398 else
1399 ifeq                    ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
1400 $(warning                       Old gcc detected ($(CC_SHORTVER)), use  gcc 3.0.x \
1401                                         for better results)
1402                                         CFLAGS+=
1403 else
1404                                 #really old version
1405 $(warning                       You are using an old and unsupported gcc \
1406                                          version ($(CC_SHORTVER)), compile at your own risk!)
1407
1408 endif                   # CC_SHORTVER, 2.9x
1409 endif                   # CC_SHORTVER, 3.0
1410 endif                   # CC_SHORTVER, 3.4
1411 endif                   # CC_SHORTVER, 4.x
1412 endif                   # CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
1413
1414 else            # CC_NAME, gcc
1415                                 #other compilers
1416 $(error                         Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
1417 endif           #CC_NAME, gcc
1418 endif   #ARCH, mips64
1419
1420 #if  alpha
1421 ifeq    ($(ARCH), alpha)
1422                 # if gcc
1423 ifeq            ($(CC_NAME), gcc)
1424                                 C_DEFS+=-DCC_GCC_LIKE_ASM
1425                                 #common stuff
1426                                 CFLAGS= $(CC_OPT) -funroll-loops $(PROFILE)
1427                         #if gcc 5.0+, 4.5 or 4.2+
1428 ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+ 6.0+,$(CC_SHORTVER))))
1429                                         CFLAGS+= -fno-strict-overflow
1430                                         # not supported: -minline-all-stringops
1431 else
1432                         #if gcc 4.0+
1433 ifeq                    ($(CC_SHORTVER), 4.x)
1434                                         CFLAGS+=
1435                                         # not supported: -minline-all-stringops
1436 else
1437                         #if gcc 3.4+
1438 ifeq                    ($(CC_SHORTVER), 3.4)
1439                                         CFLAGS+=
1440 else
1441                         #if gcc 3.0
1442 ifeq                    ($(CC_SHORTVER), 3.0)
1443                                         CFLAGS+=
1444 else
1445 ifeq                    ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
1446 $(warning                       Old gcc detected ($(CC_SHORTVER)), use  gcc 3.0.x \
1447                                         for better results)
1448                                         CFLAGS+=
1449 else
1450                                 #really old version
1451 $(warning                       You are using an old and unsupported gcc \
1452                                          version ($(CC_SHORTVER)), compile at your own risk!)
1453
1454 endif                   # CC_SHORTVER, 2.9x
1455 endif                   # CC_SHORTVER, 3.0
1456 endif                   # CC_SHORTVER, 3.4
1457 endif                   # CC_SHORTVER, 4.x
1458 endif                   # CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
1459
1460 else            # CC_NAME, gcc
1461                                 #other compilers
1462 $(error                         Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
1463 endif           #CC_NAME, gcc
1464 endif   #ARCH, alpha
1465
1466 #if  ppc
1467 ifeq    ($(ARCH), ppc)
1468                 # if gcc
1469 ifeq            ($(CC_NAME), gcc)
1470                                 C_DEFS+=-DCC_GCC_LIKE_ASM
1471                                 #common stuff
1472                                 CFLAGS=
1473                         #if gcc 6.0+, 5.0+, 4.5+ or 4.2+
1474 ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+ 6.0+,$(CC_SHORTVER))))
1475 $(call                          set_if_empty,CPUTYPE,powerpc)
1476 ifeq                            ($(NOALTIVEC),)
1477                                                 CFLAGS += $(CC_OPT) -funroll-loops -fsigned-char $(PROFILE)
1478                                                 CFLAGS += -ftree-vectorize
1479                                                 CFLAGS += -maltivec
1480                                                 CFLAGS += -fno-strict-overflow
1481                                                 CFLAGS += -mtune=$(CPUTYPE)
1482 endif
1483 else
1484                         #if gcc 4.0+
1485 ifeq                    ($(CC_SHORTVER), 4.x)
1486 $(call                          set_if_empty,CPUTYPE,powerpc)
1487 ifeq                            ($(NOALTIVEC),)
1488                                                 CFLAGS += $(CC_OPT) -funroll-loops -fsigned-char $(PROFILE)
1489                                                 CFLAGS += -ftree-vectorize
1490                                                 CFLAGS += -maltivec
1491                                                 CFLAGS += -mtune=$(CPUTYPE)
1492 endif
1493 else
1494                         #if gcc 3.4+
1495 ifeq                    ($(CC_SHORTVER), 3.4)
1496                                         CFLAGS+=
1497 else
1498                         #if gcc 3.0
1499 ifeq                    ($(CC_SHORTVER), 3.0)
1500                                         CFLAGS+=
1501 else
1502 ifeq                    ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
1503 $(warning                       Old gcc detected ($(CC_SHORTVER)), use  gcc 3.0.x \
1504                                         for better results)
1505                                         CFLAGS+=
1506 else
1507                                 #really old version
1508 $(warning                       You are using an old and unsupported gcc \
1509                                          version ($(CC_SHORTVER)), compile at your own risk!)
1510
1511 endif                   # CC_SHORTVER, 2.9x
1512 endif                   # CC_SHORTVER, 3.0
1513 endif                   # CC_SHORTVER, 3.4
1514 endif                   # CC_SHORTVER, 4.x
1515 endif                   # CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
1516
1517 else            # CC_NAME, gcc
1518                                 #other compilers
1519 $(error                         Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
1520 endif           #CC_NAME, gcc
1521 endif   #ARCH, ppc
1522
1523 #if  ppc64
1524 ifeq    ($(ARCH), ppc64)
1525                 # if gcc
1526 ifeq            ($(CC_NAME), gcc)
1527                                 C_DEFS+=-DCC_GCC_LIKE_ASM
1528                                 #common stuff
1529                                 CFLAGS= $(CC_OPT) -funroll-loops -fsigned-char $(PROFILE)
1530                         #if gcc 6.0+, 5.0+, 4.5+ or 4.2+
1531 ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+ 6.0+,$(CC_SHORTVER))))
1532 $(call                          set_if_empty,CPUTYPE,powerpc64)
1533                                         CFLAGS+=-ftree-vectorize \
1534                                                         -fno-strict-overflow \
1535                                                         -mtune=$(CPUTYPE) -maltivec
1536 else
1537                         #if gcc 4.0+
1538 ifeq                    ($(CC_SHORTVER), 4.x)
1539 $(call                          set_if_empty,CPUTYPE,powerpc64)
1540                                         CFLAGS+=-ftree-vectorize \
1541                                                         -mtune=$(CPUTYPE) -maltivec
1542 else
1543                         #if gcc 3.4+
1544 ifeq                    ($(CC_SHORTVER), 3.4)
1545                                         CFLAGS+=
1546 else
1547                         #if gcc 3.0
1548 ifeq                    ($(CC_SHORTVER), 3.0)
1549                                         CFLAGS+=
1550 else
1551 ifeq                    ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
1552 $(warning                       Old gcc detected ($(CC_SHORTVER)), use  gcc 3.0.x \
1553                                         for better results)
1554                                         CFLAGS+=
1555 else
1556                                 #really old version
1557 $(warning                       You are using an old and unsupported gcc \
1558                                          version ($(CC_SHORTVER)), compile at your own risk!)
1559
1560 endif                   # CC_SHORTVER, 2.9x
1561 endif                   # CC_SHORTVER, 3.0
1562 endif                   # CC_SHORTVER, 3.4
1563 endif                   # CC_SHORTVER, 4.x
1564 endif                   # CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
1565
1566 else            # CC_NAME, gcc
1567                                 #other compilers
1568 $(error                         Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
1569 endif           #CC_NAME, gcc
1570 endif   #ARCH, ppc
1571
1572 CFLAGS+= $(CC_EXTRA_OPTS)
1573
1574
1575 # setting LDFLAGS
1576 ifeq    ($(CC_NAME), gcc)
1577 ifeq            ($(LDTYPE), solaris)
1578                 # solaris ld
1579                 LDFLAGS+=-O2 $(PROFILE)
1580                 MOD_LDFLAGS:=-G $(LDFLAGS)
1581                 LIB_LDFLAGS:=-G $(LDFLAGS)
1582                 LIB_SONAME=-Wl,-h,
1583                 LD_RPATH=-Wl,-R,
1584 else
1585                 #gcc and maybe others, => gnu ld
1586                 LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE)
1587                 MOD_LDFLAGS:=-shared $(LDFLAGS)
1588                 LIB_LDFLAGS:=-shared $(LDFLAGS)
1589                 LIB_SONAME=-Wl,-soname,
1590                 LD_RPATH=-Wl,-rpath,
1591 endif
1592 endif
1593 ifeq    ($(CC_NAME), icc)
1594         #gcc and maybe others
1595         LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE)
1596         MOD_LDFLAGS:=-shared $(LDFLAGS)
1597         LIB_LDFLAGS:=-shared $(LDFLAGS)
1598         LIB_SONAME=-Wl,-soname,
1599         LD_RPATH=-Wl,-rpath,
1600 endif
1601 ifeq    ($(CC_NAME), suncc)
1602         # -dy?
1603         LDFLAGS+=-xO3 $(PROFILE)
1604         MOD_LDFLAGS:=-G $(LDFLAGS)
1605         LIB_LDFLAGS:=-G $(LDFLAGS)
1606         LIB_SONAME=-Wl,-h,
1607         LD_RPATH=-Wl,-R,
1608 endif
1609         # we need -fPIC -DPIC only for shared objects, we don't need them for
1610         # the executable file, because it's always loaded at a fixed address
1611         # -andrei
1612
1613 ifeq ($(CC_NAME), clang)
1614         LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE)
1615         MOD_LDFLAGS:=-shared $(LDFLAGS)
1616         LIB_LDFLAGS:=-shared $(LDFLAGS)
1617         LIB_SONAME=-Wl,-soname,
1618         LD_RPATH=-Wl,-rpath,
1619 endif
1620
1621 LDFLAGS+= $(LD_EXTRA_OPTS)
1622 MOD_LDFLAGS+= $(LD_EXTRA_OPTS)
1623 LIB_LDFLAGS+= $(LD_EXTRA_OPTS)
1624
1625 else    #mode,release
1626 ifeq    ($(CC_NAME), gcc)
1627                 CFLAGS=-g -Wcast-align $(PROFILE)
1628                 C_DEFS+=-DCC_GCC_LIKE_ASM
1629 ifeq            ($(ARCH), sparc64)
1630                         C_DEFS+=SPARC64_MODE
1631                         CFLAGS+= -mcpu=ultrasparc -m64
1632                         LDFLAGS+=-m64
1633 endif
1634 ifeq            ($(LDTYPE), solaris)
1635                         #solaris ld
1636                         LDFLAGS+=-g $(PROFILE)
1637                         MOD_LDFLAGS:=-G $(LDFLAGS)
1638                         LIB_LDFLAGS:=-G $(LDFLAGS)
1639                         LIB_SONAME=-Wl,-h,
1640                         LD_RPATH=-Wl,-R,
1641 else
1642                         #gnu or other ld type
1643                         LDFLAGS+=-g -Wl,-E $(PROFILE)
1644                         MOD_LDFLAGS:=-shared $(LDFLAGS)
1645                         LIB_LDFLAGS:=-shared $(LDFLAGS)
1646                         LIB_SONAME=-Wl,-soname,
1647                         LD_RPATH=-Wl,-rpath,
1648 endif
1649 endif
1650 ifeq    ($(CC_NAME), icc)
1651                 C_DEFS+=-DCC_GCC_LIKE_ASM
1652                 CFLAGS=-g  $(PROFILE)
1653                 LDFLAGS+=-g -Wl,-E $(PROFILE)
1654                 MOD_LDFLAGS:=-shared $(LDFLAGS)
1655                 LIB_LDFLAGS:=-shared $(LDFLAGS)
1656                 LIB_SONAME=-Wl,-soname,
1657                 LD_RPATH=-Wl,-rpath,
1658 endif
1659 ifeq    ($(CC_NAME), suncc)
1660                 CFLAGS= -g $(PROFILE)
1661                 LDFLAGS+=-g $(PROFILE)
1662                 MOD_LDFLAGS:=-G $(LDFLAGS)
1663                 LIB_LDFLAGS:=-G $(LDFLAGS)
1664                 LIB_SONAME=-Wl,-h,
1665                 LD_RPATH=-Wl,-R,
1666 endif
1667
1668 endif #mode=release
1669
1670
1671 # set pedantic compiler options
1672 ifeq ($(CC_NAME), gcc)
1673                 CFLAGS+= -Wall
1674 else # no gcc
1675 ifeq ($(CC_NAME), icc)
1676                 CFLAGS+= -Wall
1677 else # no icc
1678 ifeq ($(CC_NAME), suncc)
1679                 # FIXME: is the default (-Xa ?) enough?
1680 endif # CC_NAME=suncc
1681 endif # CC_NAME=icc
1682 endif # CC_NAME=gcc
1683
1684 #CFLAGS used for compiling the modules, libraries and utils
1685 ifeq    ($(CC_NAME), gcc)
1686 MOD_CFLAGS=-fPIC -DPIC $(CFLAGS)
1687 LIB_CFLAGS=-fPIC -DPIC $(CFLAGS)
1688 endif
1689 ifeq    ($(CC_NAME), icc)
1690 MOD_CFLAGS=-Kpic $(CFLAGS)
1691 LIB_CFLAGS=-Kpic $(CFLAGS)
1692 endif
1693 ifeq    ($(CC_NAME), suncc)
1694 MOD_CFLAGS=-xcode=pic32 $(CFLAGS)
1695 LIB_CFLAGS=-xcode=pic32 $(CFLAGS)
1696 endif
1697 ifeq    ($(CC_NAME), clang)
1698 MOD_CFLAGS=-fPIC -DPIC $(CFLAGS)
1699 LIB_CFLAGS=-fPIC -DPIC $(CFLAGS)
1700 endif
1701
1702 UTILS_CFLAGS=$(CFLAGS)
1703 # LDFLAGS uses for compiling the utils
1704 UTILS_LDFLAGS=$(LDFLAGS)
1705
1706 ifeq ($(LEX),)
1707         LEX=flex
1708 endif
1709 ifeq ($(YACC),)
1710         YACC=bison
1711 endif
1712 YACC_FLAGS=-d -b cfg
1713 # on solaris add -lxnet (e.g. LIBS= -lxnet)
1714 LIBS= -ldl -lresolv
1715 LIB_PREFIX:=lib
1716 LIB_SUFFIX:=.so
1717
1718
1719 #os specific stuff
1720 ifeq ($(OS), linux)
1721 # by default use futexes if available
1722         use_futex= yes
1723         C_DEFS+=-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
1724                         -DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H \
1725                         -DHAVE_TIMEGM -DHAVE_SCHED_SETSCHEDULER
1726         ifneq ($(RAW_SOCKS), yes)
1727                 C_DEFS+= -DUSE_RAW_SOCKS
1728         endif
1729         ifneq ($(found_lock_method), yes)
1730                 #C_DEFS+= -DUSE_POSIX_SEM
1731                 C_DEFS+=-DUSE_PTHREAD_MUTEX
1732                 LIBS+= -lpthread
1733                 #C_DEFS+= -DUSE_SYSV_SEM  # try posix sems
1734                 found_lock_method=yes
1735         else
1736                 ifneq (,$(findstring -DUSE_POSIX_SEM, $(C_DEFS)))
1737                         LIBS+=-lpthread
1738                 endif
1739                 ifneq (,$(findstring -DUSE_PTHREAD_MUTEX, $(C_DEFS)))
1740                         LIBS+=-lpthread
1741                 endif
1742         endif
1743
1744         # check for >= 2.5.44
1745         ifeq ($(shell [ $(OSREL_N) -ge 2005044 ] && echo has_epoll), has_epoll)
1746                 ifeq ($(NO_EPOLL),)
1747                         C_DEFS+=-DHAVE_EPOLL
1748                         # linux + gcc >= 3.0 + -malign-double + epoll => problems
1749                         CFLAGS_RM+=-malign-double
1750                         #CFLAGS:=$(filter-out -malign-double, $(CFLAGS))
1751                 endif
1752         endif
1753         # check for >= 2.2.0
1754         ifeq ($(shell [ $(OSREL_N) -ge 2002000 ] && echo has_sigio), has_sigio)
1755                 ifeq ($(NO_SIGIO),)
1756                         C_DEFS+=-DHAVE_SIGIO_RT -DSIGINFO64_WORKARROUND
1757                 endif
1758         endif
1759         # check for >= 2.5.70
1760         ifeq ($(shell [ $(OSREL_N) -ge 2005070 ] && echo has_futex), has_futex)
1761                 ifeq ($(use_futex), yes)
1762                         C_DEFS+=-DUSE_FUTEX
1763                 endif
1764         endif
1765         ifeq ($(NO_SELECT),)
1766                 C_DEFS+=-DHAVE_SELECT
1767         endif
1768 endif
1769
1770 ifeq ($(OS), gnu_kfreebsd)
1771 # by default use futexes if available
1772         use_futex= yes
1773         C_DEFS+=-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
1774                         -DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H \
1775                         -DHAVE_TIMEGM -DHAVE_SCHED_SETSCHEDULER
1776         ifneq ($(RAW_SOCKS), yes)
1777                 C_DEFS+= -DUSE_RAW_SOCKS
1778         endif
1779         ifneq ($(found_lock_method), yes)
1780                 #C_DEFS+= -DUSE_POSIX_SEM
1781                 C_DEFS+=-DUSE_PTHREAD_MUTEX
1782                 LIBS+= -lpthread
1783                 #C_DEFS+= -DUSE_SYSV_SEM  # try posix sems
1784                 found_lock_method=yes
1785         else
1786                 ifneq (,$(findstring -DUSE_POSIX_SEM, $(C_DEFS)))
1787                         LIBS+=-lpthread
1788                 endif
1789                 ifneq (,$(findstring -DUSE_PTHREAD_MUTEX, $(C_DEFS)))
1790                         LIBS+=-lpthread
1791                 endif
1792         endif
1793
1794         # check for ver >= 4.1
1795         ifeq ($(shell [ $(OSREL_N) -gt 4001 ] && echo has_kqueue), has_kqueue)
1796                 ifeq ($(NO_KQUEUE),)
1797                         C_DEFS+=-DHAVE_KQUEUE
1798                 endif
1799         endif
1800         ifeq ($(NO_SELECT),)
1801                 C_DEFS+=-DHAVE_SELECT
1802         endif
1803 endif
1804
1805 ifeq  ($(OS), solaris)
1806         C_DEFS+= -DHAVE_GETIPNODEBYNAME -DHAVE_SYS_SOCKIO_H -DHAVE_SCHED_YIELD \
1807                         -DHAVE_ALLOCA_H -DUSE_SIGACTION
1808         ifneq ($(found_lock_method), yes)
1809                 C_DEFS+= -DUSE_PTHREAD_MUTEX  # try pthread sems
1810                 found_lock_method=yes
1811         endif
1812         # check for ver >= 5.7
1813         ifeq ($(shell [ $(OSREL_N) -gt 5007 ] && echo has_devpoll), has_devpoll)
1814                 ifeq ($(NO_DEVPOLL),)
1815                         C_DEFS+=-DHAVE_DEVPOLL
1816                 endif
1817         endif
1818         ifeq ($(NO_SELECT),)
1819                 C_DEFS+=-DHAVE_SELECT
1820         endif
1821         # check for filio.h
1822         filio_h_locations= /usr/include/sys/filio.h \
1823                                                 $(LOCALBASE)/include/sys/filio.h
1824         has_filio_h=$(shell for r in $(filio_h_locations); do \
1825                                                 if  [ -r "$$r" ] ; then echo yes; exit; fi \
1826                                                 done;\
1827                                 )
1828         ifeq ($(has_filio_h), yes)
1829                 C_DEFS+=-DHAVE_FILIO_H
1830         endif
1831         ifeq ($(mode), release)
1832                 #use these only if you're using gcc with Solaris ld
1833                 #LDFLAGS=-O2 $(PROFILE)
1834                 #MOD_LDFLAGS=-O2 -G
1835         else
1836                 #LDFLAGS=-g $(PROFILE)
1837                 #MOD_LDFLAGS=-g -G
1838         endif
1839         YACC=yacc
1840
1841 ifeq ($(CC_NAME), suncc)
1842         LIBS= -ldl -lresolv
1843 endif
1844         OLD_SOLARIS= $(shell echo "$(OSREL)" | \
1845                                 sed -e 's/^5\.[0-6][^0-9]*$$/yes/' )
1846         LIBS+= -L$(LOCALBASE)/lib -lxnet -lsocket -lnsl -lmd5
1847 ifeq    ($(OLD_SOLARIS), yes)
1848                 LIBS+=-lposix4
1849 else
1850                 LIBS+=-lrt
1851 endif
1852         # -lrt needed for sched_yield
1853 endif
1854
1855 ifeq ($(OS), freebsd)
1856         C_DEFS+=-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN \
1857                 -DHAVE_SCHED_YIELD -DHAVE_MSGHDR_MSG_CONTROL \
1858                 -DHAVE_CONNECT_ECONNRESET_BUG -DHAVE_TIMEGM \
1859                 -DHAVE_NETINET_IN_SYSTM
1860         ifneq ($(RAW_SOCKS), yes)
1861                 C_DEFS+= -DUSE_RAW_SOCKS
1862         endif
1863         ifneq ($(found_lock_method), yes)
1864                 C_DEFS+= -DUSE_PTHREAD_MUTEX  # try pthread sems
1865                 found_lock_method=yes
1866                 LIBS+= -pthread   #dlopen is in libc
1867         else
1868                 LIBS=   #dlopen is in libc
1869         endif
1870         # check for ver >= 4.1
1871         ifeq ($(shell [ $(OSREL_N) -gt 4001 ] && echo has_kqueue), has_kqueue)
1872                 ifeq ($(NO_KQUEUE),)
1873                         C_DEFS+=-DHAVE_KQUEUE
1874                 endif
1875         endif
1876         ifeq ($(NO_SELECT),)
1877                 C_DEFS+=-DHAVE_SELECT
1878         endif
1879         YACC=yacc
1880 endif
1881
1882 ifeq ($(OS), dragonfly)
1883         C_DEFS+=-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN \
1884                 -DHAVE_SCHED_YIELD -DHAVE_MSGHDR_MSG_CONTROL \
1885                 -DHAVE_CONNECT_ECONNRESET_BUG -DHAVE_TIMEGM \
1886                 -DHAVE_NETINET_IN_SYSTM
1887         ifneq ($(found_lock_method), yes)
1888                 C_DEFS+= -DUSE_PTHREAD_MUTEX  # try pthread sems
1889                 found_lock_method=yes
1890                 LIBS+= -pthread   #dlopen is in libc
1891         else
1892                 LIBS=   #dlopen is in libc
1893         endif
1894         # dragonfly was forked from freebsd 4.8 => all version have kqueue
1895         ifeq ($(NO_KQUEUE),)
1896                 C_DEFS+=-DHAVE_KQUEUE
1897         endif
1898         ifeq ($(NO_SELECT),)
1899                 C_DEFS+=-DHAVE_SELECT
1900         endif
1901         YACC=yacc
1902 endif
1903
1904 ifeq ($(OS), openbsd)
1905         C_DEFS+=-DHAVE_SOCKADDR_SA_LEN  -DHAVE_GETHOSTBYNAME2 \
1906                 -DHAVE_UNION_SEMUN -DHAVE_MSGHDR_MSG_CONTROL \
1907                 -DHAVE_CONNECT_ECONNRESET_BUG -DHAVE_TIMEGM \
1908                 -DHAVE_NETINET_IN_SYSTM -DUSE_SIGWAIT \
1909                 -DHAVE_SCHED_YIELD
1910         ifneq ($(found_lock_method), yes)
1911                 C_DEFS+= -DUSE_PTHREAD_MUTEX  # try pthread sems
1912                 found_lock_method=yes
1913         endif
1914         # check for ver >=2 9
1915         ifeq ($(shell [ $(OSREL_N) -ge 2009 ] && echo has_kqueue), has_kqueue)
1916                 ifeq ($(NO_KQUEUE),)
1917                         C_DEFS+=-DHAVE_KQUEUE
1918                 endif
1919         endif
1920         ifeq ($(NO_SELECT),)
1921                 C_DEFS+=-DHAVE_SELECT
1922         endif
1923         # (symbols on openbsd are prefixed by "_")
1924         YACC=yacc
1925         # unfortunately pthread is needed for sigwait
1926         LIBS= -lpthread
1927 endif   # if opensd
1928
1929 ifeq ($(OS), netbsd)
1930         C_DEFS+=-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 \
1931                 -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_CONNECT_ECONNRESET_BUG -DHAVE_TIMEGM
1932         ifneq ($(found_lock_method), yes)
1933                 C_DEFS+= -DUSE_SYSV_SEM  # try pthread sems
1934                 found_lock_method=yes
1935         endif
1936         # check for ver >= 2.0.0
1937         ifeq ($(shell [ $(OSREL_N) -ge 2000000 ] && echo has_kqueue), has_kqueue)
1938                 ifeq ($(NO_KQUEUE),)
1939                         C_DEFS+=-DHAVE_KQUEUE
1940                         # netbsd + kqueue and -malign-double don't work
1941                         CFLAGS_RM+=-malign-double
1942                         #CFLAGS:=$(filter-out -malign-double, $(CFLAGS))
1943                 endif
1944         endif
1945         ifeq ($(NO_SELECT),)
1946                 C_DEFS+=-DHAVE_SELECT
1947         endif
1948         YACC=yacc
1949         LIBS=
1950 endif
1951
1952 # OS X support, same as freebsd
1953 ifeq ($(OS), darwin)
1954         C_DEFS+=-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN \
1955                 -DHAVE_SCHED_YIELD -DHAVE_MSGHDR_MSG_CONTROL \
1956                 -DUSE_ANON_MMAP \
1957                 -DNDEBUG -DHAVE_CONNECT_ECONNRESET_BUG -DHAVE_TIMEGM \
1958                 -DUSE_SIGWAIT
1959         # -DNDEBUG used to turn off assert (assert wants to call
1960         # eprintf which doesn't seem to be defined in any shared lib
1961         ifneq ($(found_lock_method), yes)
1962                 C_DEFS+= -DUSE_PTHREAD_MUTEX  # try pthread sems
1963                 found_lock_method=yes
1964                 C_DEFS+= -DUSE_SYSV_SEM  # try sys v sems (pthread don't work for
1965                                        # processes and unnamed posix sems are not
1966                                        # supported)
1967         endif
1968         LIBS= -lresolv  #dlopen is in libc
1969         ifeq ($(NO_KQUEUE),)
1970                 C_DEFS+=-DHAVE_KQUEUE
1971         endif
1972         ifeq ($(NO_SELECT),)
1973                 C_DEFS+=-DHAVE_SELECT
1974         endif
1975         LDFLAGS=        # darwin doesn't like -O2 or -E
1976         # the modules uses symbols from ser => either
1977         # -flat_namespace -undefined_suppress or -bundle_loader ../../$(MAIN_NAME)
1978         MOD_LDFLAGS:= -bundle -flat_namespace -undefined suppress
1979         # for libs using symbols from ser (e.g srdb2, kcore a.s.o) we
1980         # need -flat_namespace -undefined suppress
1981         LIB_LDFLAGS:= -dynamiclib -flat_namespace -undefined suppress
1982         LIB_SUFFIX:=.dylib
1983         # on darwin soname should include the full path
1984         # (it kind of combines rpath & soname)
1985         LIB_SONAME=
1986         # no equiv. for rpath on darwin
1987         LD_RPATH=
1988         YACC=yacc
1989 endif
1990
1991 ifneq (,$(findstring cygwin, $(OS)))
1992         # cygwin does support IPV6 starting from version 1.7, but (still?) doesn't support fd passing so no TCP
1993         #C_DEFS:=$(filter-out -DUSE_TCP, $(C_DEFS))
1994         DEFS_RM+=-DUSE_TCP
1995         C_DEFS+=-DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
1996                         -DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H \
1997                         -DHAVE_TIMEGM -DHAVE_SCHED_SETSCHEDULER
1998         ifneq ($(found_lock_method), yes)
1999                 C_DEFS+= -DUSE_POSIX_SEM
2000                 #C_DEFS+= -DUSE_SYSV_SEM  # try posix sems
2001                 # PTHREAD_MUTEX do not work for processes (try test/pthread_test.c)
2002                 #LIBS+= -lpthread
2003                 found_lock_method=yes
2004         else
2005                 ifneq (,$(findstring -DUSE_POSIX_SEM, $(C_DEFS)))
2006                         #LIBS+=-lpthread
2007                 endif
2008                 ifneq (,$(findstring -DUSE_PTHREAD_MUTEX, $(C_DEFS)))
2009 $(error PTHREAD_MUTEX do not work for processes on Windows/CYGWIN)
2010                 endif
2011         endif
2012         # check for >= 2.5.70
2013         ifeq ($(NO_SELECT),)
2014                 C_DEFS+=-DHAVE_SELECT
2015         endif
2016 endif
2017
2018 #add libssl if needed
2019 ifeq ($(CORE_TLS), 1)
2020 C_INCLUDES+= -I$(LOCALBASE)/ssl/include
2021 LIBS+= -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib -lssl -lcrypto \
2022                 $(TLS_EXTRA_LIBS)
2023 # NOTE: depending on the way in which libssl was compiled you might
2024 #       have to add -lz -lkrb5   (zlib and kerberos5).
2025 #       E.g.: make CORE_TLS=1 EXTRA_TLS_LIBS="-lz -lkrb5"
2026 endif
2027
2028 ifneq ($(found_lock_method), yes)
2029 $(warning       No locking method found so far, trying SYS V sems)
2030                 C_DEFS+= -DUSE_SYSV_SEM  # try sys v sems
2031                 found_lock_method=yes
2032 endif
2033
2034
2035 endif # ifeq (,$(main_makefile))
2036 endif  # ifeq ($(makefile_defs), 1)
2037
2038 # if incomplete or missing config.mak, or already exported vars, don't
2039 # try to export/re-export
2040 ifeq ($(makefile_defs),1)
2041 ifneq ($(exported_vars),1)
2042
2043
2044 override exported_vars:=1
2045 export exported_vars
2046
2047 # variable changeable only at configure time (once saved in config.mak they
2048 #  cannot be overwritten from environment or command line, unless make cfg
2049 #  is run)
2050 saved_fixed_vars:=      MAIN_NAME  CFG_NAME SCR_NAME FLAVOUR INSTALL_FLAVOUR \
2051                 SRC_NAME RELEASE OS ARCH \
2052                 C_DEFS DEFS_RM PROFILE CC LD MKDEP MKTAGS LDFLAGS C_INCLUDES \
2053                 CC_MKDEP_OPTS \
2054                 MOD_LDFLAGS LIB_LDFLAGS UTILS_LDFLAGS LIB_SONAME LD_RPATH \
2055                 LIB_SUFFIX LIB_PREFIX \
2056                 LIBS \
2057                 LEX YACC YACC_FLAGS \
2058                 PREFIX LOCALBASE \
2059                 TAR \
2060                 INSTALL INSTALL_CFG INSTALL_BIN INSTALL_MODULES INSTALL_DOC \
2061                 INSTALL_MAN INSTALL_LIB INSTALL_TOUCH INSTALL_SHARE \
2062                 Q
2063
2064 # variable changeable at compile time
2065 # extra: prefix DESTDIR BASEDIR basedirt
2066 saved_chg_vars:=\
2067                 CC_EXTRA_OPTS CPUTYPE CFLAGS_RM CFLAGS MOD_CFLAGS LIB_CFLAGS UTILS_CFLAGS \
2068                 BASEDIR basedir DESTDIR LIBDIR RUNBASEDIR runbasedir \
2069                 PREFIX prefix \
2070                 cfg_prefix cfg_dir bin_prefix bin_dir modules_prefix modules_dir \
2071                 doc_prefix doc_dir man_prefix man_dir ut_prefix ut_dir \
2072                 share_prefix share_dir lib_prefix lib_dir data_prefix data_dir \
2073                 cfg_target lib_target data_target run_prefix run_dir run_target
2074
2075
2076 #export relevant variables to the sub-makes
2077 export $(saved_fixed_vars)
2078 export $(saved_chg_vars)
2079
2080
2081 endif # ifneq ($(exported_vars),1)
2082 endif # ifeq ($(makefile_defs),1)
2083