#!/usr/bin/make -f

#export DH_VERBOSE=1

%:
	dh $@ --with autoreconf

override_dh_auto_configure:
	./configure --host=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) --build=$(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) LLVM_CONFIG=/usr/bin/llvm-config-3.5

override_dh_auto_clean:
	dh_auto_clean
	find . -name ".action" |xargs rm -Rfv
	find . -name ".gambas" |xargs rm -Rfv
	find . -name "*.gambas" |xargs rm -Rfv
	find . -name "DISABLED" |xargs rm -Rfv
	find . -name "DISABLED.gb*" |xargs rm -Rfv
	find . -name "warnings.log" |xargs rm -Rfv
	find . -name ".info" |xargs rm -Rfv
	find . -name ".list" |xargs rm -Rfv
	find . -name ".startup" |xargs rm -Rfv
	rm -fv aclocal.m4 main/aclocal.m4
	rm -fv gb.media/src/Makefile
	rm -fv gb.media/DISABLED.gb.media

override_dh_auto_install:
	XDG_UTILS_INSTALL_MODE=user dh_auto_install
	chmod 644 $(CURDIR)/debian/tmp/usr/share/appdata/gambas3.appdata.xml
	find $(CURDIR)/debian/tmp/usr -name "*.la" -delete
	find $(CURDIR)/debian/tmp/usr -type d -empty -delete
	find $(CURDIR)/debian/tmp/usr -name *.png -perm /ugo+x -exec chmod 644 \{} \;

override_dh_install:
	dh_install -XCOPYING -XLicense --list-missing
