#!/usr/bin/make -f
#export DH_VERBOSE=1

DPKG_EXPORT_BUILDFLAGS = 1
-include /usr/share/dpkg/buildflags.mk
# http://bugs.debian.org/653916
CFLAGS   += $(CPPFLAGS)
CXXFLAGS += $(CPPFLAGS)

DEB_HOST_ARCH:=$(shell dpkg-architecture -qDEB_HOST_ARCH)
# http://bugs.debian.org/658273
CFLAGS   += -fPIC
CXXFLAGS += -fPIC
LDFLAGS  += -Wl,--as-needed

%:
	dh $@  --parallel --sourcedirectory=VolViewPlatformComplete

override_dh_auto_configure:
	dh_auto_configure -- -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo

override_dh_compress:
	dh_compress -X.pdf

override_dh_installdocs:
	# I could not figure out how to handle space in the filename with dh_installdocs
	#echo "$(DEB_BUILD_GNU_TYPE)"
	mkdir -p debian/volview/usr/share/doc/volview/
	mv "debian/volview/usr/doc/VolView 3 User Manual.pdf" debian/volview/usr/share/doc/volview/VolView3UserManual.pdf
	rmdir debian/volview/usr/doc
	dh_installdocs

override_dh_auto_install:
	dh_auto_install
	mv debian/volview/usr/bin/Plugins debian/volview/usr/lib/VolView
	mv debian/volview/usr/bin/VolView debian/volview/usr/lib/VolView

get-orig-source:
	./debian/get-orig-source
