#!/usr/bin/make -f
# -*- makefile -*-

export DEB_BUILD_MAINT_OPTIONS=hardening=+bindnow
export CFLAGS=$(shell dpkg-buildflags --get CFLAGS) $(shell dpkg-buildflags --get CPPFLAGS)

%:
	find ./logos -type f | LC_ALL=C sort > logo_config 
	PREFIX=$(CURDIR)/debian/linuxlogo/usr ./configure 
	cp -r po/ potmp/
	dh $@
	rm -rf potmp/

override_dh_auto_clean:
	[ -d potmp/ ] && rm -rf potmp/
	[ ! -f Makefile ] || ./configure && make distclean

override_dh_install:
	if [ -r debian/local/linux_logo.`dpkg-vendor --query vendor`.conf ]; then \
	    cp -pv debian/local/linux_logo.`dpkg-vendor --query vendor`.conf debian/local/linux_logo.conf; \
	elif [ -r debian/local/linux_logo.`dpkg-vendor --query parent`.conf ]; then \
	    cp -pv debian/local/linux_logo.`dpkg-vendor --query parent`.conf debian/local/linux_logo.conf; \
	else \
	    cp -pv debian/local/linux_logo.Debian.conf debian/local/linux_logo.conf; \
	fi
	dh_install
