#
#	The Berkeley Packet Filter tcp/udp Traffic collector.
#
#	Copyright (c) 1993 The CAD lab of the
#	Novosibirsk Institute of Broadcasting and Telecommunication.
#
#	BPFT $Id: Makefile,v 1.4 1993/12/05 16:15:55 bob Exp $
#
#	$Log: Makefile,v $
# Revision 1.4  1993/12/05  16:15:55  bob
# Changes for traflog.format
#
# Revision 1.3  1993/11/20  12:18:30  bob
# Append trafshow program
#
# Revision 1.2  1993/11/18  15:00:06  bob
# Removed -g (debug info) and added -O (optimize) flags for compile
#
# Revision 1.1  1993/10/20  15:59:25  bob
# Initial revision
#
#
#	Main Makefile. Build everything in directories...
#

# Target directory for install execution files.
BINDIR=	/usr/local/bin/

# Full pathname where locate tarfstat program.
TSEXEC=	/usr/local/bin/trafstat

# Trailing slash directory, summary traffic log files will be put there.
SAVDIR=	/var/log/

# Where locate trafstatd log file, if you want log then file must exist.
TSLOGF=	/var/log/trafstat.log

# File with user defined descriptions of the traflog output format.
TRAFFMT= /usr/local/etc/traflog.format

# Only group wheel can execute binary files.
MODE	= 750
GROUP	= wheel

CC=	gcc
CFLAGS=	-O \
	-DPATH_TOSAVE=\"$(SAVDIR)\"\
	-DPATH_TRAFSTAT=\"$(TSEXEC)\"\
	-DPATH_TRAFSTAT_LOG=\"$(TSLOGF)\"\
	-DPATH_TRAFLOG_FMT=\"$(TRAFFMT)\"

all:
	@(cd lib; echo "Build library in `pwd`"; $(MAKE) CC=$(CC))
	@(cd trafd; echo "Build trafd in `pwd`"; $(MAKE) CC=$(CC) CFLAGS='$(CFLAGS)')
	@(cd trafstat; echo "Build trafstat in `pwd`"; $(MAKE) CC=$(CC) CFLAGS='$(CFLAGS)')
	@(cd trafstatd; echo "Build trafstatd in `pwd`"; $(MAKE) CC=$(CC) CFLAGS='$(CFLAGS)')
	@(cd traflog; echo "Build tarflog in `pwd`"; $(MAKE) CC=$(CC) CFLAGS='$(CFLAGS)')
	@(cd trafshow; echo "Build trafshow in `pwd`"; $(MAKE) CC=$(CC))
	@echo Done.

install: all
	install -s -o root -g $(GROUP) -m $(MODE) trafd/trafd $(BINDIR)
	install -c -o root -g $(GROUP) -m $(MODE) trafd/trafstart $(BINDIR)
	install -c -o root -g $(GROUP) -m $(MODE) trafd/trafstop $(BINDIR)
	install -c -o root -g $(GROUP) -m $(MODE) trafd/trafsave $(BINDIR)
	install -c -o root -g $(GROUP) -m $(MODE) trafd/trafdump $(BINDIR)
	install -s -o root -g $(GROUP) -m $(MODE) trafstat/trafstat $(BINDIR)
	install -s -o root -g $(GROUP) -m $(MODE) trafstatd/trafstatd $(BINDIR)
	install -s -o root -g $(GROUP) -m $(MODE) traflog/traflog $(BINDIR)
	install -c -o root -g $(GROUP) -m $(MODE) traflog/traflog.format $(TRAFFMT)
	install -s -o root -g $(GROUP) -m $(MODE) trafshow/trafshow $(BINDIR)
	@echo Done.

clean:
	@(cd lib; $(MAKE) clean)
	@(cd trafd; $(MAKE) clean)
	@(cd trafstat; $(MAKE) clean)
	@(cd trafstatd; $(MAKE) clean)
	@(cd traflog; $(MAKE) clean)
	@(cd trafshow; $(MAKE) clean)
	@echo Done.
