#!/usr/bin/make -f

%:
	dh $@

override_dh_auto_configure:
	./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
		--prefix=/usr/share \
		--disable-javadx

override_dh_auto_install:
	$(MAKE) install prefix=$(CURDIR)/debian/dxsamples/usr/share

	# We don't need no precompiled binaries.
	$(RM) -f $(CURDIR)/debian/dxsamples/usr/share/dx/samples/data/externalfilter_*
	
	# Some scripts are not marked executable by mistake.  Need to
	# fixup.
	for i in `find $(CURDIR)/debian/dxsamples/usr/share/dx/samples -type f`; do \
		m_head=`head -1 $$i`; \
		test -n "$$m_head" || continue; \
		echo "$$m_head" | egrep -qv '#![[:space:]]*/bin/.*sh' || chmod a+x "$$i"; \
	done
