#/*************************************************************************
#***	Authentication, authorization, accounting + firewalling package
#***	(c) 1998-2003 Anton Vinokurov <anton@netams.com>
#***	(c) 2003 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
#***		 					
#*************************************************************************/
# $Id: Makefile,v 1.25.2.7 2004/05/06 10:37:08 jura Exp $
##########################################################################
# for FreeBSD, uncomment this
DEFINE = -DFREEBSD -D_THREAD_SAFE
LIB = -lpcap -lcrypt -lz
#
# For FreeBSD-4.x uncomment this
LIB += -pthread
# For FreeBSD-5.x uncomment this
# LIB += -lc_r
#
# DB1 support
# DEFINE+= -DUSE_HASH
#
# MySQL storage support
DEFINE += -DUSE_MYSQL
LIB += -lmysqlclient -L/usr/local/lib/mysql
#
# PostgreSQL storage support
# DEFINE += -DUSE_POSTGRES
# LIB += -lpq -L/usr/local/lib 
#
##########################################################################
# for Linux, uncomment this
# DEFINE = -pthread -DLINUX -D_GNU_SOURCE -Wno-trigraphs -I/usr/include/pcap
# LIB = -pthread -lpcap -lipq -lcrypt -lz
#
# DB1 support
# DEFINE+= -DUSE_HASH
# LIB += -ldb1
#
# MySQL storage support
# DEFINE += -DUSE_MYSQL -I/usr/include/mysql
# LIB += -lmysqlclient -L/usr/lib/mysql 
#
# PostgreSQL storage support
# DEFINE += -DUSE_POSTGRES
# LIB += -lpq -L/usr/local/lib 
#
# Uncomment this if you are using iptables 1.2.5 or greater
# DEFINE += -DIPTBL_PFSET
# Uncomment this if you want to build NeTAMS without IPQ support (2.2.x kernels)
# and remove -lipq at LIB definition above 
# DEFINE += -DIPTBL_NONE
##########################################################################
# Define here a PATH variables
PATH_TO_CONFIG="/usr/local/etc/netams.cfg"
PATH_TO_LOG="/var/log/netams.log"
# 
# Uncomment this if you want to log dropped packets
# DEFINE += -DLOG_DROP
# Uncomment this if you want to enable debug features 
DEFINE += -DDEBUG
FLAGS += -g -Wall
# Uncomment this if you want to enable profiler support
# LIB += -lm -pg
# FLAGS += -pg
##########################################################################
# EXPERIMENTAL!!! DO NOT UNCOMMENT!!!
# DEFINE += -DPVM
# LIB += -L/usr/local/lib -lgpvm3 -lpvm3
##########################################################################
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_weblogin.c s_pvmgate.c \
 st_sql_mysql.c st_sql_postgres.c ds_mailstat.c iptree.c s_login.c ds_flowmodule.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 \
 flowmodule.h versions.sh versions_build.dat

CC	= g++
INCLUDE=/usr/local/include
OBJ	= $(SRC:.c=.o)
CFLAGS	= $(FLAGS) -I$(INCLUDE) $(DEFINE)

all: 
	cd src && make $(PROG)

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

backup:
	rm -rf TEMP; mkdir TEMP; mkdir TEMP/netams-3.1.`cat src/versions_build.dat`; \
	cp -Rp src doc cgi-bin Copyright Makefile addon TEMP/netams-3.1.`cat src/versions_build.dat`; \
	cd TEMP ; tar -z -c -v --exclude *.ttf --exclude *CVS*  --exclude *.o --exclude *.bak --exclude *~ \
	 -f netams-3.1.`cat ../src/versions_build.dat`.tar.gz netams-3.1.`cat ../src/versions_build.dat`; \
	mv netams-3.1.`cat ../src/versions_build.dat`.tar.gz ../../web/netams/files/ ; cd .. ; rm -rf TEMP 

distrib: clean backup
