#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

clean:
	rm -rf build-shared
	rm -rf build-static
	dh_clean

build:
	dh_testdir
	test -d build-shared || mkdir build-shared
	(cd build-shared ; cmake .. \
		-DBUILD_SHARED_LIBS=ON \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_VERBOSE_MAKEFILE=ON )
	$(MAKE) -C build-shared
	test -d build-static || mkdir build-static
	(cd build-static ; cmake .. \
		-DBUILD_SHARED_LIBS=OFF \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_VERBOSE_MAKEFILE=ON )
	$(MAKE) -C build-static

binary-indep:
	@echo No binary-independent parts

binary-arch: build
	dh_auto_test
	dh_testroot
	dh_prep
	dh_installdirs
	$(MAKE) -C build-shared install DESTDIR=$(shell pwd)/debian/tmp
	$(MAKE) -C build-static install DESTDIR=$(shell pwd)/debian/tmp
	dh_install
	dh_installdocs
	dh_installchangelogs
	dh_lintian
	dh_link
	dh_compress
	dh_fixperms
	dh_strip
	dh_makeshlibs
	dh_shlibdeps
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch

%:
	dh $@ 
