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

include /usr/share/GNUstep/debian/config.mk
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--no-undefined

%:
	dh $@

override_dh_auto_clean:
	$(MAKE) -C Goodies distclean
	dh_auto_clean
	$(RM) AddressManager.png

override_dh_auto_build:
	dh_auto_build -- $(optim) $(verbose) \
	  $(shell dpkg-buildflags --export=cmdline)
	dh_auto_build -- -C Goodies $(optim) $(verbose) \
	  $(shell dpkg-buildflags --export=cmdline) \
	  disable-ldapaddressbook=yes
	convert AddressManager/AddressManager.tiff -resize 64x64 \
	  AddressManager.png

override_dh_auto_install:
	dh_auto_install -- -C Goodies install disable-ldapaddressbook=yes
	dh_auto_install

execute_before_dh_link:
	gsdh_gnustep -paddressmanager.app --app
	gsdh_gnustep -paddresses-goodies-for-gnustep --bundle --bug-script
	gsdh_gnustep --remaining-packages

override_dh_fixperms:
	find debian/addressmanager.app -name Add.tiff -perm 0755 \
	  -exec chmod -v 644 '{}' \;
	find debian -name "*.strings" -perm 0755 -exec chmod -v 644 '{}' \;
	find debian/addressmanager.app -name data.classes -perm 0755 \
	  -exec chmod -v 644 '{}' \;
	find debian/addressmanager.app -name objects.gorm -perm 0755 \
	  -exec chmod -v 644 '{}' \;
	find debian/addressmanager.app -name ISOCountryCodes.dict -perm 0755 \
	  -exec chmod -v 644 '{}' \;
	dh_fixperms
