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

VERSION := $(shell dpkg-parsechangelog | \
	     perl -ne 'if (s/Version:\s+//) { s/-[^-]+$$//; print }')

# Include cdbs rules files.
include /usr/share/cdbs/1/class/perlmodule.mk
include /usr/share/cdbs/1/rules/debhelper.mk

DEB_INSTALL_DOCS_libxml-xerces-perl = \
	$(DEB_BUILDDIR)/FAQ \
	$(DEB_BUILDDIR)/README
DEB_INSTALL_EXAMPLES_libxml-xerces-perl = \
	$(DEB_BUILDDIR)/samples/*
DEB_COMPRESS_EXCLUDE = examples

# Turn off optimization on some slower architectures because compiles
# take too long and use too much memory otherwise
l_ARCH := -$(shell dpkg --print-architecture)-
ifeq ($(findstring $(l_ARCH),-arm- -m68k-), $(l_ARCH))
CFLAGS := $(filter-out -O%,$(CFLAGS)) -O0
CXXFLAGS := $(filter-out -O%,$(CFXXFLAGS)) -O0
endif

# Skip the test suite.  It seems to have problems that don't indicate
# problems with the actual package.
override DEB_MAKE_CHECK_TARGET =

export XERCES_INCLUDE=/usr/include
export XERCES_LIB=/usr/lib
export XERCES_CONFIG=/usr/lib/libxerces28/config.status
# force regeneration of the SWIG wrappers
export XERCES_DEVEL=1

# As 0.4.21, cdbs creates but doesn't debian/compat.  It creates it
# conditionally, so this doesn't have a trivial fix.
clean::
	$(RM) debian/compat *.cdbs-config_list

pre-build::
	chmod +x $(DEB_BUILDDIR)/samples/*.pl
