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

include /usr/share/GNUstep/debian/config.mk
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

projects := SERIAL_SUBDIRECTORIES="Source Tools"

%:
	dh $@

override_dh_auto_build-arch:
	rm -rf libtool Tests/obj Tests/DBusKitTests.bundle
	dh_auto_build -- $(optim) $(verbose) $(projects) \
	  $(shell dpkg-buildflags --export=cmdline)

override_dh_auto_build-indep:
ifdef docs
	dh_auto_build -- -C Documentation $(verbose)
	cp debian/dbuskit-doc.install.in debian/dbuskit-doc.install
	cp debian/dbuskit-doc.links.in debian/dbuskit-doc.links
endif

override_dh_auto_test-arch:
	xvfb-run --auto-servernum \
	  dbus-test-runner --max-wait=900 --bus-type=both \
	  --task=dh_auto_test --parameter -- --parameter messages=yes \
	  || (cat tests.log; exit 1)

override_dh_auto_test-indep: ;

override_dh_auto_install-arch:
	dh_auto_install -- $(projects)

override_dh_auto_install-indep:
ifdef docs
	dh_auto_install -- -C Documentation
	$(RM) -r debian/tmp$(GNUSTEP_SYSTEM_DOC)/Developer/DBusKit/ReleaseNotes
endif

override_dh_clean:
	rm -rf Tests/obj Tests/DBusKitTests.bundle
	dh_clean libtool

execute_before_dh_link:
	gsdh_gnustep --no-move
