#!/usr/bin/make -f
#
# rules --- Debian packaging rules for gtklp
# Copyright (C) 2006 Zak B. Elep <zakame@spunge.org>
#
# $Id: rules,v 1.2 2006-06-03 12:16:34 zakame Exp $

# Let's use CDBS!

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/simple-patchsys.mk
include /usr/share/cdbs/1/class/autotools.mk

# Specify what source docs should go in /usr/share/doc/gtklp
DEB_INSTALL_DOCS_ALL := README AUTHORS TODO

# Use touch-fu before build to avoid remaking the autotools.  Wrap this in
# `test' so we don't call `configure' again upon `binary'
configure/gtklp::
	test -f debian/stamp-configure-gtklp || \
		(touch config.h.in && touch stamp-h1 && touch config.h && \
		 touch -r m4/glibc2.m4 m4/gettext.m4 && \
		 touch debian/stamp-configure-gtklp )

# Remove extra ch{s,t} locales (we already have zh_{CN,TW}
install/gtklp::
	rm -rf debian/gtklp/usr/share/locale/chs
	rm -rf debian/gtklp/usr/share/locale/cht
	install -m 0644 $(CURDIR)/debian/gtklp.desktop $(CURDIR)/debian/gtklp/usr/share/applications/hildon
	cp $(CURDIR)/debian/icons/gtklp.png $(CURDIR)/debian/gtklp/usr/share/icons/hicolor/48x48/apps/gtklp.png

# Ensure the we distclean the source first, before unapplying patches.  This
# should allow us to do a quicker clean by avoiding to rerun `configure' due to
# the reversion of 20_autotools_update.patch .
cleanbuilddir/gtklp::
	test -f $(DEB_SRCDIR)/Makefile && \
	     $(MAKE) -C $(DEB_SRCDIR) -k distclean || true

# Remove generated .gmo files
clean::
	rm -f debian/stamp-configure-gtklp
	rm -f po/*.gmo po/stamp-po
