#!/usr/bin/make -f

# $Id: rules,v 1.6 2003/08/30 13:53:10 davidw Exp $

TCL_VERSION=8.4

package=rivet

configs.tcl:
	( cd src ; tclsh$(TCL_VERSION) ./configure.tcl )

build: configs.tcl
	$(checkdir)
	( cd src ; ./make.tcl shared )
	touch build

clean:
	$(checkdir)
	-rm -f build
	( cd src ; rm -f *.so *.o *.a )
	-rm -f `find . -name "*~"`
	-rm -rf debian/tmp debian/files* core debian/substvars

binary-indep: checkroot build
	$(checkdir)
# There are no architecture-independent files to be uploaded
# generated by this package.  If there were any they would be
# made here.

binary-arch: checkroot build
	$(checkdir)
	-rm -rf debian/tmp
	install -d debian/tmp
	cd debian/tmp && install -d `cat ../dirs`
	( cd src ; ./make.tcl install PREFIX=$(CURDIR)/debian/tmp/usr/lib LIBEXECDIR=$(CURDIR)/debian/tmp/usr/lib/apache/1.3/ )
	cp debian/500mod_rivet.info debian/tmp/usr/lib/apache/1.3/
	dh_installdocs doc/
	dh_installchangelogs
	dh_movefiles
	dh_strip
	dh_compress
	dh_fixperms
	find debian/tmp/ -name CVS | xargs rm -rf
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_makeshlibs
	dh_md5sums
	dh_builddeb

define checkdir
	test -f debian/rules
endef

binary: binary-indep binary-arch

checkroot:
	$(checkdir)
	test root = "`whoami`"

.PHONY: binary binary-arch binary-indep clean checkroot
