#!/usr/bin/make -f
#
# This is a special rules files for handling alien or binary packages
# Christoph Lameter, October 30, 1996
# Modified for xswallow by Javier Fernandez-Sanguino <jfs@computer.org> May 3, 1998

package=xswallow

debian/build:
	$(checkdir)
	cd xswallow && make -f makefile.linux && cp xswallow.so ../usr/local/lib/netscape/plugins
	touch debian/build

clean:
	$(checkdir)
	-rm -f debian/build
	cd $(package) && make -f makefile.linux clean
	-rm -rf *~ debian/tmp debian/*~ debian/files*

binary-indep:	checkroot debian/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 debian/build
	$(checkdir)
	-rm -rf debian/tmp
# Install binary package
# Setting up control area
	mkdir debian/tmp
	cd debian/tmp && install -d `cat ../dirs`
#	 cp debian/{postinst,prerm} debian/tmp/DEBIAN/.
#        chmod +x debian/tmp/DEBIAN/{postinst,prerm}
	strip $(package)/$(package).so
	cp $(package)/$(package).so debian/tmp/usr/lib/netscape/plugins
	cp common/$(package).conf debian/tmp/usr/lib/netscape
	dh_installdocs doc/*
	dh_installchangelogs
	dpkg-shlibdeps debian/tmp/usr/lib/netscape/plugins/$(package).so
#	install -m644 debian/shlibs debian/tmp/DEBIAN
	dh_md5sums
	dpkg-gencontrol
	chmod a+rwX debian/tmp
	chown -R root.root debian/tmp
	chmod -R g-ws debian/tmp
	dpkg --build debian/tmp ..

define checkdir
	test -f debian/rules
endef

# ftp
# Should ftp to http://skynet.csn.ul.ie/~caolan/docs/XSwallow.html
# check! 

# Below here is fairly generic really

binary:		binary-indep binary-arch

build:	debian/build

source diff:
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

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

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