#!/usr/bin/make -f

# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

#
# This version is for a multibinary package. It also allows you to build any
# of the binary packages independantly, via binary-<package> targets.

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

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

# This has to be exported to make some magic below work.
export DH_OPTIONS

#
# Modified to be a prototype for debmake by Christoph Lameter <clameter@debian.org>
#

INST=install -p
DEBSTD=debstd
package=gmgaclock

allpackages= debian/tmp

build:
	$(checkdir)
	./configure
	$(MAKE) -j 4
	touch build

cleanB:
	$(checkdir)
	rm -rf core debian/files* debian/substvars debian/*.debhelper
	rm -rf core `find debian/* -type d ! -name CVS `

clean: cleanB
	$(checkdir)
	if [ -f Makefile ]; then $(MAKE) distclean ; fi
	rm -rf core `find . -name "*~"`
	@rm -f build

binary-indep:
# There are no architecture-independent files to be uploaded
# generated by this package.  If there were any they would be
# made here.

binary-arch: cleanB checkroot checkscripts build
	$(checkdir)
	@echo ":: Preparing packages"
#	@$(INST) -d debian
	dh_testdir
	dh_testroot
	dh_installdirs

	@$(INST) -s src/gmgaclock debian/tmp/usr/bin/

	dh_installdocs NEWS README
# conforms standard debian changelog name	
	@cp -a ChangeLog debian/tmp/usr/share/doc/gmgaclock/changelog
	@cp -a pixmaps/logo.xpm debian/tmp/usr/share/pixmaps/gmgaclock/

	dh_installexamples
	dh_installchangelogs

# this way we are saving few inodes and making it more user friendly

#	@cp -a doc/*.html debian/$(docs)/usr/share/doc/$(docs)

	dh_installmenu
	dh_installcron
	dh_installmanpages -pgmgaclock
	dh_movefiles
	dh_fixperms
	dh_strip
	dh_compress
	dh_shlibdeps
	dh_gencontrol
	dh_makeshlibs
	dh_installdeb
	dh_md5sums
	dh_builddeb -v

define checkdir
	@test -f debian/rules
endef

checkscripts:
	@echo ":: Checking scripts"

# Below here is fairly generic really

binary: binary-indep binary-arch

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

checkroot:
	$(checkdir)
	@echo ":: Checking ROOT user"
	@test root = "`whoami`"

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