#!/bin/sh
set -x

# path of nfdump sources
NFDUMP=../../../nfdump-current

# path of rrd include file rrd.h
# RRDINCLUDE=/usr/local/include
RRDINCLUDE=/usr/local/rrdtool-1.2.11/include

# path of rrd library 
LIBRRD=/usr/local/rrdtool-1.2.11/lib

# nfdump objects
NFDUMP_OBJ="$NFDUMP/util.o $NFDUMP/nftree.o $NFDUMP/grammar.o $NFDUMP/scanner.o $NFDUMP/nffile.o $NFDUMP/flist.o $NFDUMP/nf_common.o $NFDUMP/panonymizer.o $NFDUMP/rijndael.o $NFDUMP/ipconv.o"
INCLUDES="-I $NFDUMP -I$RRDINCLUDE"

CC='gcc -c -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -g -O2'

$CC -c $INCLUDES nftrack.c
$CC -c $INCLUDES nftrack_rrd.c 
$CC -c $INCLUDES nftrack_stat.c
gcc -o nftrack nftrack.o nftrack_rrd.o nftrack_stat.o $NFDUMP_OBJ -L$LIBRRD -lrrd -L/usr/X11R6/lib -L/usr/local/lib
