#!/usr/bin/make -f

export PTHREAD_CFLAGS=-lpthread

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- --program-prefix=ctemplate-

override_dh_auto_test:
	# the tests don't run fine together in parallel or in different order,
	# so run them sequentially
	dh_auto_test --max-parallel=1
	# remove temporary directories not cleaned up automatically
	rm -rf \
	  /tmp/diff_tpl_auto_escape_unittest_sh_dir \
	  /tmp/make_tpl_varnames_h_unittest_sh_dir \
	  /tmp/template_unittest_dir

execute_after_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/NEWS \
	  debian/tmp/usr/share/doc/ctemplate/README
