#!/usr/bin/make -f
# debian/rules file for autotools-dev
# GNU copyright 1997 to 1999 by Joey Hess & Henrique M. Holschuh
# $Id: rules,v 1.13 2002/02/24 12:17:27 hmh Exp $

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

# This is the debhelper compatability version to use.
export DH_COMPAT=3

# Version of the dh_autotools file
DHAVERSION=`sed -e '/[$$]Id: .*[$$]/! d' <dh_autotools |cut -f 3 -d ' '`

# Fetches new upstream from cvs. Depends: cvs devscripts.
# dch -v is used as new-version-detector: if it fails, there were no
# new updates to config/ChangeLog
cvsfetch:
	mkdir temp-cvs ; cd temp-cvs;\
	cvs -z 4 -d :pserver:anoncvs@subversions.gnu.org:/cvsroot/config export -rHEAD config  ;\
	mv -f config/* ../config ;\
	cd .. ; rm -rf temp-cvs
	CVSVERSIONTAG=`head -1 config/ChangeLog | tr -d - | cut -f 1 -d ' '` ;\
	SUBDATE=`config/config.sub --time-stamp | tr -d -` ;\
	GUESSDATE=`config/config.guess --time-stamp | tr -d -` ;\
	dch -v "$${CVSVERSIONTAG}.1" \
	  "Sync to CVS $$CVSVERSIONTAG (config.sub $$SUBDATE; config.guess $$GUESSDATE)"

build: build-stamp
build-stamp:
	dh_testdir
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	-rm -f build-stamp
	-rm -rf temp-cvs
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	install config/config.guess config/config.sub $(CURDIR)/debian/autotools-dev/usr/share/misc
	install debian/configurewrapper $(CURDIR)/debian/autotools-dev/usr/bin

# Build architecture-dependent files here.
binary-arch: build install
# We have nothing to do by default.

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
#	dh_installdebconf	
	dh_installdocs
	dh_installexamples
#	dh_installmenu
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_installinit
#	dh_installcron
	dh_installman
#	dh_installinfo
#	dh_undocumented
#	dh_installchangelogs
	install -D debian/changelog $(CURDIR)/debian/autotools-dev/usr/share/doc/autotools-dev/changelog.Debian
	install -D config/ChangeLog $(CURDIR)/debian/autotools-dev/usr/share/doc/autotools-dev/changelog
	dh_strip
	dh_compress
	dh_fixperms
#	dh_makeshlibs
	dh_installdeb
#	dh_perl
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure cvsfetch
