#!/usr/bin/make -f
#
# © 2009 Cyril Brulebois <kibi@debian.org>


##### INCLUDE
#

include /usr/share/quilt/quilt.make


##### VARIABLES
#

DEB_BUILD_ARCH      ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
NO_MAKE_CHECK_ARCHS := arm ia64 hppa


##### OVERRIDES
#

# Need to pass an extra flag:
override_dh_auto_configure:
	dh_auto_configure -- --with-openexr-prefix=/usr

# Need to disable the test suite on some architectures (additionally,
# use 'make check' rather than 'make test'):
override_dh_auto_test:
	touch no_test
#ifeq (,$(filter $(DEB_BUILD_ARCH),$(NO_MAKE_CHECK_ARCHS)))
#ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
#	$(MAKE) check
#endif
#endif

# No need to compress .h/.cpp files:
override_dh_compress:
	dh_compress -X.h -X.cpp

# Need to remove the directories, since they're getting replaced with
# symlinks:
override_dh_link:
	rm -rf debian/libopenexr-dev/usr/share/doc/libopenexr-dev
	rm -rf debian/openexr/usr/share/doc/openexr
	dh_link

# Need to pass an extra parameter:
override_dh_makeshlibs:
	dh_makeshlibs -V

# Need to remember package versions:
override_dh_installdeb:
	dh_buildinfo -plibopenexr6
	dh_installdeb


##### TARGETS
#

# Need to patch:
build: $(QUILT_STAMPFN) build-stamp
build-stamp:
	cp /usr/share/misc/config.guess .
	cp /usr/share/misc/config.sub   .
	dh build
	touch $@

# Need to unpatch:
clean: unpatch
	dh $@
	rm -f config.guess config.sub

# Everything else:
%:
	dh $@
