#!/usr/bin/make -f

export PTHREAD_CFLAGS=-lpthread

%:
	dh $@ --parallel --with autoreconf

override_dh_auto_configure:
	dh_auto_configure -- --program-prefix=ctemplate- --libdir=/usr/lib

override_dh_auto_test:
	# There are some random failures in the tests.
	-dh_auto_test

override_dh_auto_install:
	dh_auto_install
	# kill libtool .la files
	find debian/tmp -name '*.la' -print -delete
	# remove documentation installed by upstream, which is either
	# not useful at all or installed with other tools
	rm -fv \
	  debian/tmp/usr/share/doc/ctemplate-*/AUTHORS \
	  debian/tmp/usr/share/doc/ctemplate-*/ChangeLog \
	  debian/tmp/usr/share/doc/ctemplate-*/COPYING \
	  debian/tmp/usr/share/doc/ctemplate-*/INSTALL \
	  debian/tmp/usr/share/doc/ctemplate-*/NEWS \
	  debian/tmp/usr/share/doc/ctemplate-*/README \
	  debian/tmp/usr/share/doc/ctemplate-*/README_windows.txt

override_dh_install:
	dh_install --list-missing
