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

DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

CFLAGS = -O2 -Wall -g
LDFLAGS = -Wl,--as-needed

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
    CFLAGS += -O0
else
    CFLAGS += -O2
endif

PYVER=$(shell pyversions -vr debian/control)

configure_flags += \
			-DCMAKE_INSTALL_PREFIX="/usr" \
			-DPYTHON_VERSION=$(PYVER)

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- 	$(configure_flags)

override_dh_install:
	mv $(CURDIR)/debian/tmp/usr/bin/plutil-* \
		$(CURDIR)/debian/tmp/usr/bin/plutil
	dh_install --fail-missing

override_dh_strip:
	dh_strip --dbg-package=libplist-dbg

#override_dh_auto_test:
#Make the test suit fatal on supported arches (See README.Debian)
#ifneq (,$(filter $(DEB_HOST_ARCH),amd64 i386 kfreebsd-amd64 kfreebsd-amd64))
#	dh_auto_test
#else
#	dh_auto_test || true
#endif
