#!/usr/bin/make -f
# ssystem debian build rules
# Made with the aid of debmake, by Christoph Lameter,
# based on the sample debian/rules file for GNU hello by Ian Jackson.
 
package=hmmer

INSTALL=/usr/bin/install
INSTDIR=`pwd`

build:
	$(checkdir)
	-rm config.cache
	./configure
	make
#	make CC=cc CFLAGS="-g -O3 -Wall -funroll-loops  -ffast-math"  \
#	      BINDIR=/usr/bin  MANDIR=/usr/man  COMPRESS=gzip

clean:
	$(checkdir)
	-rm -f build
	-rm -rf binaries
	-make clean
	-rm config.cache
	-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 directories
	install -d debian/tmp/usr/bin
	install -d debian/tmp/usr/share/man/man1
	install -d debian/tmp/usr/share/doc/$(package)
	install -d debian/tmp/usr/lib/$(package)
	install -d debian/tmp/DEBIAN
	export INSTDIR=`pwd`;    \
	make  BINDIR=$(INSTDIR)/debian/tmp/usr/bin   \
              MANDIR=$(INSTDIR)/debian/tmp/usr/share/man    install
#

	chmod 644 debian/tmp/usr/share/man/man1/*
	gzip -9v debian/tmp/usr/share/man/man1/*
	strip --strip-unneeded debian/tmp/usr/bin/*

#
	$(INSTALL) -m 644 INSTALL NOTES 00README  debian/tmp/usr/share/doc/$(package)/.
	$(INSTALL) -m 644 debian/README.debian debian/tmp/usr/share/doc/$(package)
	cp debian/changelog debian/tmp/usr/share/doc/$(package)/changelog.Debian
	cd Userguide; tar -C ../debian/tmp/usr/share/doc/$(package) -xzf hmmer-html.tar.Z
	install -m 644  Userguide/Userguide.ps debian/tmp/usr/share/doc/$(package)
	chmod  644  debian/tmp/usr/share/doc/$(package)/hmmer-html/*
	chmod  755  debian/tmp/usr/share/doc/$(package)/hmmer-html/l2h*
	chmod  644  debian/tmp/usr/share/doc/$(package)/hmmer-html/l2h*/*
	rm -rf debian/tmp/usr/share/doc/$(package)/hmmer-html/TMP
	-gzip -9fv debian/tmp/usr/share/doc/$(package)/*

# don't gzip these
#
	cp debian/copyright debian/tmp/usr/share/doc/$(package)/copyright
	cp -r Demos debian/tmp/usr/share/doc/$(package)
	chmod 644 debian/tmp/usr/share/doc/$(package)/Demos/*

#
	   dpkg-shlibdeps binaries/*
	   dpkg-gencontrol
	   chown -R root.root debian/tmp
	   chmod -R go=rX debian/tmp
	   dpkg --build debian/tmp ..



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




