#!/usr/bin/make -f

DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
export DEB_LDFLAGS_MAINT_APPEND

%:
	dh ${@} --parallel

override_dh_auto_configure:
	autoreconf -fi
	dh_auto_configure

override_dh_install:
	DESTDIR=$(CURDIR)/debian/install-gui po/make_po.sh install-gui.mo
	dh_install

override_dh_clean:
	rm -f	depcomp \
		INSTALL \
		missing \
		install-sh \
		configure \
		config.h.in \
		aclocal.m4
	dh_clean

create-icons:
	# requires inkscape and imagemagick to be installed
	@if [ ! -x /usr/bin/inkscape ]; then \
		echo "ERROR: inkscape not installed!" ; \
		false ; \
	fi
	
	for f in install-gui; do \
		[ -r  $(CURDIR)/icons/$${f}.svg ] || false ; \
		for i in 16 22 32 48 64 128; do \
			mkdir -p "icons/hicolor.$${f}/$${i}x$${i}/apps" ; \
			inkscape --export-width=$${i} \
				 --export-height=$${i} \
				 --export-png="$(CURDIR)/icons/hicolor.$${f}/$${i}x$${i}/apps/$${f}.png" \
					$(CURDIR)/icons/$${f}.svg ; \
		done ; \
	done
	for f in install-gui-title aptosid-logo; do \
		mkdir -p "$(CURDIR)/pixmaps" ; \
		[ -r  $(CURDIR)/icons/$${f}.svg ] || false ; \
		inkscape --export-png="$(CURDIR)/pixmaps/$${f}.png" \
				$(CURDIR)/icons/$${f}.svg ; \
	done
