#!/usr/bin/make -f

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

export DH_COMPAT=3

build: link-stamp build-stamp
build-stamp:
	dh_testdir
	./configure --prefix=/usr --mandir=/usr/share/man
	$(MAKE)
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp
	-$(MAKE) distclean
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	$(MAKE) INSTALL_PREFIX=`pwd`/debian/ticker install

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

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdocs README
	dh_installexamples sysinfo-ticker
	dh_installmenu
	dh_installman *.1
	dh_installchangelogs
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# Fix links when checking out of cvs by calling this target.
link-stamp:
	sh -e debian/fixlinks
	touch link-stamp

VERSION=$(shell expr "`dpkg-parsechangelog 2>/dev/null |grep Version:`" : '.*Version: \(.*\)')

# Update the web page. Not intended for use by anyone except the
# author.
installhook:
	-rm -f /home/ftp/pub/code/ticker/*
	cp debian/changelog /home/pub/programs/ticker/CHANGES
	echo -n $(VERSION) > /home/pub/programs/ticker/LATEST-VERSION-IS
	cd /home/ftp/pub/code/ticker && \
		ln -sf ../debian/ticker_$(VERSION).tar.gz ticker_$(VERSION).tar.gz && \
		ln -sf ../debian/ticker_$(VERSION).tar.gz ticker.tar.gz 

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