## Process this file with automake to produce Makefile.in
##
## $Id: Makefile.am,v 1.30 2007/10/26 17:50:49 adeniz Exp $
##
## automake input for the ARM Research SNFServer scripts.
##
## Author:  Alban Deniz
##
## Copyright (C) 2008 ARM Research Labs, LLC.
## See www.armresearch.com for the copyright terms.
##

sbin_SCRIPTS = 					\
	getRulebase.sample			\
	snfSniffer.sample			\
	snfSnifferFilter.sample			\
	snfscan-standalone.sample

rcexec_SCRIPTS =				\
	snf-server

if OpenBSD
snf-server.in:	snf-server.openbsd Makefile
	cp @top_srcdir@/Scripts/snf-server.openbsd snf-server.in
	chmod +x $@

rcexecdir = @sbindir@
else

if FreeBSD
snf-server.in:	snf-server.freebsd Makefile
	cp @top_srcdir@/Scripts/snf-server.freebsd snf-server.in
	chmod +x $@

rcexecdir = @sysconfdir@/rc.d
else
rcexecdir = @sysconfdir@/init.d
endif

endif

if Ubuntu
snf-server.in:	snf-server.ubuntu Makefile
	cp @top_srcdir@/Scripts/snf-server.ubuntu snf-server.in
	chmod +x $@
endif

if RedHat
snf-server.in:	snf-server.redhat Makefile
	cp @top_srcdir@/Scripts/snf-server.redhat snf-server.in
	chmod +x $@
endif

if Suse
snf-server.in:	snf-server.suse Makefile
	cp @top_srcdir@/Scripts/snf-server.suse snf-server.in
	chmod +x $@
endif

getRulebase.sample:	getRulebase.in Makefile
	cat @top_srcdir@/Scripts/getRulebase.in | sed -e s+PREFIX+@prefix@+ -e s+PACKAGE_NAME+@PACKAGE_NAME@+ > $@
	chmod +x $@

snf-server:	snf-server.in Makefile
	cat @top_srcdir@/Scripts/snf-server.in | sed -e s+PREFIX+@prefix@+g -e s+CONFFILE+@sysconfdir@/@PACKAGE_NAME@/SNFServer.xml+g -e s+SYSCONFDIR+@sysconfdir@+g -e s+PACKAGE_NAME+@PACKAGE_NAME@+g > $@
	chmod +x $@

snfSniffer.sample:	snfSniffer.in Makefile
	cat @top_srcdir@/Scripts/snfSniffer.in | sed -e s+DATADIR+@datadir@+ -e s+PREFIX+@prefix@+ -e s+PACKAGE_NAME+@PACKAGE_NAME@+ > $@
	chmod +x $@

snfSnifferFilter.sample:	snfSnifferFilter.in Makefile
	cat @top_srcdir@/Scripts/snfSnifferFilter.in | sed -e s+DATADIR+@datadir@+ -e s+PREFIX+@prefix@+ -e s+PACKAGE_NAME+@PACKAGE_NAME@+ > $@
	chmod +x $@

snfscan-standalone.sample:	snfscan-standalone.in Makefile
	cat @top_srcdir@/Scripts/snfscan-standalone.in | sed -e s+DATADIR+@datadir@+ -e s+PREFIX+@prefix@+ -e s+PACKAGE_NAME+@PACKAGE_NAME@+ > $@
	chmod +x $@

pkgdata_DATA =                       		\
	junkmsg.txt				\
	cleanmsg.txt

EXTRA_DIST = 					\
	getRulebase.in				\
	snfSniffer.in				\
	snfSnifferFilter.in			\
	snfscan-standalone.in			\
	snf-server.openbsd			\
	snf-server.freebsd			\
	snf-server.redhat			\
	snf-server.ubuntu			\
	snf-server.suse				\
	$(pkgdata_DATA)

clean-local:
	rm -f *.gcno *.gcov *.gcda *~ $(sbin_SCRIPTS) $(rcexec_SCRIPTS) snf-server.in
