
#   Makefile for FlowScan.
#   Copyright (C) 1999-2001  Dave Plonka
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
# $Id: Makefile.in,v 1.15 2001/02/13 19:24:41 dplonka Exp $
# Dave Plonka <plonka@doit.wisc.edu>

INSTALL = @INSTALL_SH@
prefix = @prefix@

SHELL = @KSH_PATH@

mkdir = @MKDIR_PATH@
perl = @PERL_PATH@
rm = @RM_PATH@

# these are only necessary for the "dist" target:
find = @FIND_PATH@
gzip = @GZIP_PATH@
ln = @LN_PATH@
tar = @TAR_PATH@
rcs = @RCS_PATH@
sed = @SED_PATH@
xargs = @XARGS_PATH@

distfiles = COPYING VERSION Changes TODO \
Makefile.in configure configure.in config.guess config.sub install-sh \
flowscan.in FlowScan.pm CampusIO.pm SubNetIO.pm graphs.mf.in \
cf/flowscan.cf cf/CampusIO.cf cf/SubNetIO.cf \
cf/local_nets.boulder cf/our_subnets.boulder cf/Napster_subnets.boulder \
rc/linux/cflowd rc/linux/flowscan \
rc/solaris/cflowd rc/solaris/flowscan \
util/locker.in \
util/README.add_ds \
util/add_ds.pl.in \
util/add_txrx.in \
util/event2vrule.in \
util/ip2hostname.in \
example/crontab.in \
example/events.txt \
README.pod \
README.html \
README \
INSTALL.pod \
INSTALL.html \
INSTALL \
CampusIO.html \
CampusIO.README \
SubNetIO.html \
SubNetIO.README

.SUFFIXES: .pod .html .pm .README

all:	flowscan

myall: all README README.html INSTALL INSTALL.html MANIFEST Changes

install: flowscan
	test -d $(prefix)/bin || $(mkdir) -p $(prefix)/bin
	$(INSTALL) -c flowscan $(prefix)/bin
	$(INSTALL) -c FlowScan.pm $(prefix)/bin
	$(INSTALL) -c CampusIO.pm $(prefix)/bin
	$(INSTALL) -c SubNetIO.pm $(prefix)/bin
	$(INSTALL) -c util/locker $(prefix)/bin
	$(INSTALL) -c util/add_ds.pl $(prefix)/bin
	$(INSTALL) -c util/add_txrx $(prefix)/bin
	$(INSTALL) -c util/event2vrule $(prefix)/bin
	$(INSTALL) -c util/ip2hostname $(prefix)/bin

clean:

realclean: clean
	$(rm) -f config.status config.log config.cache Makefile flowscan graphs.mf util/locker example/crontab

spotless: realclean
	$(rm) -f README README.html INSTALL INSTALL.html MANIFEST Changes

MANIFEST: Makefile.in
	echo $(distfiles) |$(perl) -pe 's/\s+/\n/g' > $@ || $(rm) -f $@

README: README.pod
	pod2text README.pod > $@

INSTALL: INSTALL.pod
	pod2text INSTALL.pod > $@

Changes: Changes.PL cf/RCS/CampusIO.cf,v cf/RCS/Napster_subnets.boulder,v cf/RCS/our_subnets.boulder,v cf/RCS/SubNetIO.cf,v cf/RCS/flowscan.cf,v cf/RCS/local_nets.boulder,v RCS/flowscan.in,v RCS/VERSION,v RCS/FlowScan.pm,v RCS/Denied.pm,v RCS/CampusIO.pm,v RCS/INSTALL.pod,v RCS/SubNetIO.pm,v RCS/graphs.mf.in,v RCS/Makefile.in,v RCS/configure.in,v RCS/TODO,v RCS/README.pod,v rc/linux/RCS/cflowd,v rc/linux/RCS/flowscan,v rc/solaris/RCS/cflowd,v rc/solaris/RCS/flowscan,v example/RCS/crontab.in,v
	$(perl) Changes.PL

dist:	$(distfiles) MANIFEST
	version=$$(ident VERSION |$(perl) -ne 'if (m/\s+(\d+)\.(\d+)/) { printf "%d.%03d\n", $$1, $$2; exit }') && \
	$(mkdir) FlowScan-$${version} && \
	cd FlowScan-$${version} && \
	$(mkdir) -p cf rc/linux rc/solaris util example && \
	for file in $(distfiles) ; \
	do \
	   $(ln) -s $$(echo $${file?}|$(sed) -e 's/[^/]*\//..\//g' -e 's/[^/]*$$/../')/$${file?} $${file?} || exit 1 ; \
	done && \
	cd .. && \
	$(find) . -name '*,v' -print |$(xargs) $(rcs) -n$$($(perl) -le "\$$_ = 'V$${version}'; s/\\./_/g; print"): && \
	$(tar) chf FlowScan-$${version}.tar FlowScan-$${version} && \
	$(gzip) FlowScan-$${version}.tar && \
	$(rm) -rf FlowScan-$${version}

.pod.html:
	pod2html --index --infile=$< --outfile=$@

.pm.html:
	pod2html --index --infile=$< --outfile=$@

.pm.README:
	pod2text $< > $@
