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

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
CXXFLAGS += -Wno-error=cast-qual -Wno-error=cast-align
LDFLAGS += -L$(CURDIR)/src/.libs
export LDFLAGS CXXFLAGS

# Set install ruby locations for configure
export RUBY_LIB = $(shell ruby -r rbconfig -e 'print RbConfig::CONFIG["rubylibdir"]' | sed 's,/ruby/,/ruby/vendor_ruby/,')
export RUBY_LIB_ARCH = $(shell ruby -r rbconfig -e 'print RbConfig::CONFIG["archdir"]' | sed 's,/ruby/,/ruby/vendor_ruby/,')
export RUBY_INC_ARCH = $(shell ruby -r rbconfig -e 'print RbConfig::CONFIG["rubyarchhdrdir"]')

override_dh_auto_clean:
	dh_clean
	find $(CURDIR) -name \*.pyc -exec rm {} +
	rm -f $(CURDIR)/bindings/qpid/perl/Makefile.old

override_dh_auto_configure:
	dh_auto_configure -- --with-sasl --with-xml --with-rdma --with-ssl --with-swig --libexecdir='/usr/lib' --enable-fast-install

override_dh_auto_test:

%:
	dh  $@ --with python2 --with autoreconf
