#/*************************************************************************
#***	Authentication, authorization, accounting + firewalling package
#***	(c) 1998-2002 Anton Vinokurov <anton@netams.com>
#***	(c) 2002-2005 NeTAMS Development Team
#***	All rights reserved. See 'Copying' file included in distribution
#***	For latest version and more info, visit this project web page
#***	located at http://www.netams.com
#***		 					
#*************************************************************************/
# This is automatically generated Makefile for NeTAMS
# Created Mon Dec  5 18:37:41 MSK 2005
# Run 'make -f Makefile.run' to compile
DEFINE = -DLINUX -D_BSD_SOURCE -I/usr/include/pcap -I/usr/libipq
LIB = -pthread -lpcap -lcrypt -lipq
INSTALL = /usr/bin/install
PATH_TO_ETC=/etc
PATH_TO_CONFIG=/etc/netams/netams.conf
PATH_TO_LOG=/var/log/netams/netams.log
PATH_TO_SCRIPTS=/etc/init.d
DAEMONDIR=/usr/sbin
SBINDIR=/usr/sbin
MANDIR=/usr/man
#DEFINE += -DIPTBL_NONE
DEFINE += -DUSE_MYSQL -I/usr/include/mysql
LIB += -lmysqlclient -L/usr/lib
DEFINE += -DUSE_POSTGRES -I/usr/include/pgsql
LIB += -lpq -L/usr/lib
DEFINE += -DHAVE_BILLING
SRC += billing.c s_billing.c
HEADERFILES += billing.h
DEFINE += -DDEBUG
FLAGS += -g -Wall
DEFINE += -DUSE_LIBRADIUS
#
#Optional params - uncomment if needed
DEFINE += -DHAVE_BW
#DEFINE += -DMEMORY_DEBUG 
#DEFINE += -DMUTEX_DEBUG
#DEFINE += -DUSE_TICKS
DEFINE += -DFAST_FW_CHECK
#DEFINE += -DUSE_HASH
#
#Optional for profiler support
#LIB += -pg -static -lssl -lm -lintl -lz -liconv
#FLAGS += -pg 
#
############################################################
# Common part of Makefile for NeTAMS project
# $Id: Makefile.common,v 1.36.2.2 2005/11/19 21:31:00 jura Exp $
#
PROG += netams
SRC += main.c common.c versions.c connections.c parse.c security.c services.c \
 s_server.c users.c net_units.c s_processor.c messages_fifo.c s_datasource.c \
 policy.c s_storage.c st_hash.c st_sql.c p_prefix.c alert_report.c s_scheduler.c \
 ds_netflow.c s_html.c s_monitor.c s_quotactl.c s_quota.c s_pvmgate.c \
 st_sql_mysql.c st_sql_oracle.c st_sql_postgres.c ds_mailstat.c iptree.c \
 s_login.c flow.c ds_ipq.c ds_libpcap.c ds_ipfw.c memory.c events.c html.c \
 lib.c bw.c sql_config.c libipulog.c ds_ulog.c ds_netgraph.c attrlist.c time.c \
 st_radius.c s_acl_server.c mutex.c lang.c

HEADERFILES += netams.h connections.h common.h security.h services.h users.h iptree.h\
 net_units.h messages_fifo.h policy.h st_any.h policy_prefix.h alert_report.h  flow.h\
 memory.h lib.h config.h bw.h sql_config.h libipulog.h attrlist.h cycle.h mutex.h \
 versions.sh versions_build.dat lang.h

CC	= g++
FLAGS  += -pipe -O2
DEFINE += -D_REENTRANT -D_THREAD_SAFE 
INCLUDE=/usr/include
OBJ	= $(SRC:.c=.o)
CFLAGS	= $(FLAGS) -I$(INCLUDE) $(DEFINE)
LIB += -lcrypto
NLIB = ../lib/radlib/radlib.o
FREEBSD_KMOD += 

all: lib/radlib/radlib.o
	cd src && make $(PROG)

distclean: clean
	cp addon/Makefile.boot Makefile ; rm -rf *.[0-9] ; 

lib/radlib/radlib.o:	lib/radlib/radlib.c
	cd lib/radlib && $(CC) $(CFLAGS) -c radlib.c 

clean:
	cd src && rm -rf $(OBJ) $(PROG) netamsctl flowprobe netamsctl.o flowprobe.o \
	versions_build.o core *.core ipfw2netflow.o ipfw2netflow ulog2netflow.o ulog2netflow netflow.o
	$(FREEBSD_KMOD) 
	cd src && rm -rf $(NLIB)
