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

include /usr/share/GNUstep/debian/config.mk
export DEB_LDFLAGS_MAINT_APPEND = -Wl,-z,defs -Wl,--as-needed

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
optim := debug=yes
endif

%:
	dh $@

override_dh_auto_build:
# Use a Debian-specific SONAME because of the silent ABI break
# introduced by upstream in 0.4.
	$(MAKE) $(optim) messages=yes INTERFACE_VERSION=0d \
	  $(shell dpkg-buildflags --export=cmdline)
# Rebuild the API docs, taking care to preserve the original ones.
	mv Documentation upstream-doc
	doxygen ./doxygen

override_dh_auto_install:
	$(MAKE) install INTERFACE_VERSION=0d DESTDIR=$(CURDIR)/debian/tmp

override_dh_clean:
	[ ! -d upstream-doc ] || ($(RM) -r Documentation; mv \
	  upstream-doc Documentation)
	dh_clean

override_dh_link:
	gsdh_gnustep
	dh_link

override_dh_strip:
	dh_strip --dbg-package=librsskit0d-dbg
