#! /usr/bin/make -f
## debian/rules for saytime
## (C) 2001 Gergely Nagy <algernon@debian.org>
## (C) 2000-2013 Holger Levsen <holger@debian.org>
##
## Released under the terms of the GNU GPLv2.

-include /usr/share/dpkg/buildtools.mk

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

## dpkg-buildpackage specific variables
PKGDIR   = $(CURDIR)/debian/saytime
BINDIR   = /usr/bin
SHAREDIR = /usr/share/saytime

%:
	dh $@

override_dh_auto_build:
	(cd debian && unshar sounds-david.shar)
	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -DSOUND_DIR="$(SHAREDIR)" saytime.c -o saytime

override_dh_auto_clean:
	dh_auto_clean
	rm -rf debian/sounds

override_dh_auto_install:
	dh_auto_install
	## The upstream makefile does not have an install target, so
	## copy the files by hand
	install -m 0755 saytime $(PKGDIR)/$(BINDIR)/saytime
	(cd debian && install -m 0644 sounds/*.au $(PKGDIR)/$(SHAREDIR)/)
