#!/usr/bin/make -f
# -*- makefile -*-

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

CORE_ABIVERSION := $(shell sed -rn 's/^\#define[[:space:]]+CORE_ABIVERSION[[:space:]]+//p' /usr/include/compiz/compiz-core.h )

export DEB_BUILD_HARDENING=1

# the following are generated by autoconf and have no way of being deleted
# gracefully. 
AUTOFOO_DELETE:=Makefile.in aclocal.m4 backend/Makefile.in config/Makefile.in \
	configure include/Makefile.in intltool-extract.in intltool-merge.in \
	intltool-update.in metadata/Makefile.in plugin/Makefile.in \
	po/Makefile.in.in src/Makefile.in config.guess config.h.in config.sub \
	depcomp install-sh ltmain.sh missing mkinstalldirs


%:
	dh $@

override_dh_clean:
	[ ! -f Makefile ] || $(MAKE) distclean
	rm -f $(AUTOFOO_DELETE)
	dh_clean

override_dh_auto_configure:
	autoreconf -vi
	glib-gettextize -c -f
	intltoolize --automake -c -f
	dh_auto_configure -- --prefix=/usr --enable-maintainer-mode

override_dh_gencontrol:
	dh_gencontrol -- -Vcoreabiversion=$(CORE_ABIVERSION)
