Makefile.defs
247c2b65
 #
 # $Id$
 #
 # makefile defs (CC, LD,a.s.o)
 #
 
 
 #version number
 VERSION = 0
 PATCHLEVEL = 8
b2dec9c6
 SUBLEVEL = 6
0eb1315e
 EXTRAVERSION = -3
247c2b65
 
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
b2dec9c6
 OS = $(shell uname -s)
 ARCH = $(shell uname -m |sed -e s/i.86/i386/ -e s/sun4u/sparc64/ )
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
ea6721d7
 # -DDBG_MALLOC
 #		issues additional debugging information if lock/unlock is called
b2dec9c6
 # -DFAST_LOCK
 #		uses fast arhitecture specific locking (see the arh. specific section)
dda9dab1
 #
 
404073d3
 DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
b2dec9c6
 	 -DOS='"$(OS)"' -DCOMPILER='"$(CC_VER)"'\
2c65bd8b
 	 -DDNS_IP_HACK  -DPKG_MALLOC -DSHM_MEM  -DSHM_MMAP \
0eb1315e
 	 -DUSE_SYNONIM -DF_MALLOC \
e3b42c42
 	 #-DEXTRA_DEBUG 
340bddb4
 	 #-DVQ_MALLOC  -DDBG_LOCK  #-DSTATS
 	 #-DDBG_QM_MALLOC #-DNO_DEBUG
247c2b65
 #-DEXTRA_DEBUG
 # -DUSE_SHM_MEM
efd6c2fe
 #-DNO_DEBUG
247c2b65
 #-DPKG_MALLOC
efd6c2fe
 #-DNO_DEBUG#-DSTATS -DNO_DEBUG
247c2b65
 #-DNO_LOG
 
b2dec9c6
 # arh. specific definitions
 ifeq ($(ARCH), i386)
0eb1315e
 	DEFS+= -DFAST_LOCK
b2dec9c6
 endif
 
c4217e61
 ifeq ($(ARCH), sparc64)
0eb1315e
 	DEFS+= -DFAST_LOCK
c4217e61
 endif
 
b2dec9c6
 
 #PROFILE=  -pg #set this if you want profiling
 #mode = debug
 mode = release
247c2b65
 
 # platform dependent settings
 
 
 #common
da3257c8
 CC=gcc
b2dec9c6
 LD= $(CC)
 CC_VER= $(CC) $(shell $(CC) --version)
247c2b65
 MKDEP=gcc -MM $(DEFS)
3b06abf2
 MKTAGS=ctags -R .
247c2b65
 
 ifeq ($(mode), release)
e3b42c42
 	CFLAGS=-O9 -funroll-loops  -Wcast-align $(PROFILE) -Winline\
2781889b
 			-malign-loops=4
b2dec9c6
 			#-Wmissing-prototypes \
 	
 ifneq (,$(findstring 3.0, $(CC_VER)))
2781889b
 	CFLAGS=-minline-all-stringops -malign-double \
b2dec9c6
 				-march=athlon \
 				#-mcpu=athlon
 endif
 	LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE)
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
 else
e3b42c42
 	CFLAGS=-g -Wcast-align -Winline $(PROFILE)
b2dec9c6
 	LDFLAGS+=-g -Wl,-E $(PROFILE)
247c2b65
 endif
 
 #*FLAGS used for compiling the modules
 MOD_CFLAGS=-fPIC -DPIC $(CFLAGS)
7c0265cc
 MOD_LDFLAGS=-shared $(LDFLAGS)
247c2b65
 
 LEX=flex
 YACC=bison
 YACC_FLAGS=-d -b cfg
 # on linux and freebsd keep it empty (e.g. LIBS= )
 # on solaris add -lxnet (e.g. LIBS= -lxnet)
 LIBS=-lfl -ldl
 
 
 #arch specific stuff
b2dec9c6
 ifeq ($(OS), Linux)
247c2b65
 
 endif
b2dec9c6
 ifeq  ($(OS), SunOS)
7c0265cc
 	ifeq ($(mode), release)
 		LDFLAGS=-O2 $(PROFILE)
 		MOD_LDFLAGS=-O2 -G
 	else
 		LDFLAGS=-g $(PROFILE)
 		MOD_LDFLAGS=-g -G
 	endif
2d9c6d80
 	ifeq ($(ARCH), sparc64)
da87d067
 #		CFLAGS+= -mv8 -Wa,-xarch=v8plus
2d9c6d80
 	endif
b2dec9c6
 
247c2b65
 YACC=yacc
2781889b
 LIBS+=-L/usr/local/lib -lxnet -lrt # or -lnsl -lsocket or -lglibc ?
9dfcca3a
 # -lrt needed for sched_yield
247c2b65
 
 endif
b2dec9c6
 ifeq ($(OS), FreeBSD)
247c2b65
 
 YACC=yacc
 LIBS= -lfl  #dlopen is in libc
 
 endif
b2dec9c6
 ifneq (,$(findstring CYGWIN, $(OS)))
247c2b65
 
 #cygwin is the same as common
 
 endif