#!/usr/bin/make -f
# Sample debian/rules file - for GNU Hello (1.3).
# Copyright 1994,1995 by Ian Jackson.
# I hereby give you perpetual unlimited permission to copy,
# modify and relicense this file, provided that you do not remove
# my name from the file itself.  (I assert my moral right of
# paternity under the Copyright, Designs and Patents Act 1988.)
# This file may have to be extensively modified

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

clean:
	dh_testdir
	dh_clean
	rm -f build install install-indep install-arch
	rm -f src/evolver src/*.o src/makemark
	QUILT_PATCHES=debian/patches quilt pop -a || test $$? = 2
	-rm -rf .pc
	rm -f *-stamp
	dh_clean

patch-stamp:
	QUILT_PATCHES=debian/patches quilt push -a || test $$? = 2
	touch $@

build: build-arch
build-arch: patch-stamp
	dh_testdir
	make -C src evolver
	touch build

build-indep:

# These two are only usefull if you can selectively
# install for arch and indep stuff.
install-arch: build
	dh_installdirs -a
	install -d debian/evolver/usr/bin
	cp -p src/evolver debian/evolver/usr/bin/evolver
	dh_installman evolver.1
	touch install-arch

install-indep: patch-stamp
	dh_installdirs -i
	install -d debian/evolver-doc/usr/share/doc/evolver-doc/examples
	cp -p doc/* debian/evolver-doc/usr/share/doc/evolver-doc
	cp -p fe/* debian/evolver-doc/usr/share/doc/evolver-doc/examples
	chmod -x debian/evolver-doc/usr/share/doc/evolver-doc/examples/*
	rm debian/evolver-doc/usr/share/doc/evolver-doc/evolver.htm
	ln -s default.htm \
	  debian/evolver-doc/usr/share/doc/evolver-doc/evolver.htm
	touch install-indep

install: install-arch install-indep
	touch install

binary-indep: install-indep
	dh_testdir -i
	dh_testroot -i
	dh_installdocs -i
	dh_installchangelogs -i
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

binary-arch: install-arch
	dh_testdir -a
	dh_testroot -a
	dh_installdocs -a
	dh_installmanpages -a
	dh_installchangelogs -a
	dh_strip -a
	dh_compress -a
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

# Below here is fairly generic really

binary:		binary-indep binary-arch

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