# # $Id$ # # makefile defs (CC, LD,a.s.o) # #version number VERSION = 0 PATCHLEVEL = 8 SUBLEVEL = 6 EXTRAVERSION = -6x RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) OS = $(shell uname -s) ARCH = $(shell uname -m |sed -e s/i.86/i386/ -e s/sun4u/sparc64/ ) # compile-time options # # -DSTATS # allows to print out number of packets processed on CTRL-C; # implementation still nasty and reports per-process # -DNO_DEBUG # turns off some of the debug messages (DBG(...)). # -DNO_LOG # completely turns of all the logging (and DBG(...)) # -DEXTRA_DEBUG # compiles in some extra debugging code # -DDNS_IP_HACK # faster ip address resolver for ip strings (e.g "127.0.0.1") # -DSHM_MEM # compiles in shared mem. support, needed by some modules and # by USE_SHM_MEM # -DSHM_MMAP # use mmap instead of SYSV shared memory # -DPKG_MALLOC # uses a faster malloc (exclusive w/ USE_SHM_MEM) # -DUSE_SHM_MEM # all pkg_malloc => shm_malloc (most mallocs use a common sh. # 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.) # -DVQ_MALLOC # additional option to PKG_MALLOC which utilizes a fater then # qm version # (not true anymore, q_malloc performs approx. the same) # -DF_MALLOC # an even faster malloc, not recommended for debugging # -DDBG_MALLOC # issues additional debugging information if lock/unlock is called # -DFAST_LOCK # uses fast arhitecture specific locking (see the arh. specific section) # DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \ -DOS='"$(OS)"' -DCOMPILER='"$(CC_VER)"'\ -DDNS_IP_HACK -DPKG_MALLOC -DSHM_MEM -DSHM_MMAP \ -DUSE_SYNONIM -DF_MALLOC \ #-DEXTRA_DEBUG #-DVQ_MALLOC -DDBG_LOCK #-DSTATS #-DDBG_QM_MALLOC #-DNO_DEBUG #-DEXTRA_DEBUG # -DUSE_SHM_MEM #-DNO_DEBUG #-DPKG_MALLOC #-DNO_DEBUG#-DSTATS -DNO_DEBUG #-DNO_LOG # arh. specific definitions ifeq ($(ARCH), i386) DEFS+= -DFAST_LOCK endif ifeq ($(ARCH), sparc64) DEFS+= -DFAST_LOCK endif #PROFILE= -pg #set this if you want profiling #mode = debug mode = release # platform dependent settings #common CC=gcc LD= $(CC) CC_VER= $(CC) $(shell $(CC) --version) MKDEP=gcc -MM $(DEFS) MKTAGS=ctags -R . ifeq ($(mode), release) CFLAGS=-O9 -funroll-loops -Wcast-align $(PROFILE) -Winline\ -malign-loops=4 #-Wmissing-prototypes \ ifneq (,$(findstring 3.0, $(CC_VER))) CFLAGS+=-minline-all-stringops -malign-double \ -march=athlon \ #-mcpu=athlon endif LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE) # 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 CFLAGS=-g -Wcast-align -Winline $(PROFILE) LDFLAGS+=-g -Wl,-E $(PROFILE) endif #*FLAGS used for compiling the modules MOD_CFLAGS=-fPIC -DPIC $(CFLAGS) MOD_LDFLAGS=-shared $(LDFLAGS) 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 ifeq ($(OS), Linux) endif ifeq ($(OS), SunOS) ifeq ($(mode), release) LDFLAGS=-O2 $(PROFILE) MOD_LDFLAGS=-O2 -G else LDFLAGS=-g $(PROFILE) MOD_LDFLAGS=-g -G endif ifeq ($(ARCH), sparc64) CFLAGS+= -mv8 -Wa,-xarch=v8plus endif YACC=yacc LIBS+=-L/usr/local/lib -lxnet -lrt # or -lnsl -lsocket or -lglibc ? # -lrt needed for sched_yield endif ifeq ($(OS), FreeBSD) YACC=yacc LIBS= -lfl #dlopen is in libc endif ifneq (,$(findstring CYGWIN, $(OS))) #cygwin is the same as common endif