#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

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

CPPFLAGS=	$(shell dpkg-buildflags --get CPPFLAGS)
CXXFLAGS=	$(shell dpkg-buildflags --get CXXFLAGS)
LDFLAGS=	$(shell dpkg-buildflags --get LDFLAGS)

include /usr/share/hardening-includes/hardening.make
ifeq (,$(filter nohardening,$(DEB_BUILD_OPTIONS)))
CXXFLAGS+=	$(HARDENING_CFLAGS) -DHAVE_RULES
LDFLAGS+=	$(HARDENING_LDFLAGS)
endif

CXXFLAGS+=	-DHAVE_RULES

export CPPFLAGS CXXFLAGS LDFLAGS
DB2MAN = /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl
XP     = xsltproc -''-nonet -''-param man.charmap.use.subset "0"

override_dh_auto_build:
	sed -i.nocppflags -e 's/\$$(CXX) \$$(CXXFLAGS)/$$(CXX) $$(CPPFLAGS) $$(CXXFLAGS)/' Makefile
	dh_auto_build -- HAVE_RULES=yes TINYXML=-ltinyxml
	$(XP) $(DB2MAN) man/cppcheck.1.xml

override_dh_auto_clean:
	dh_auto_clean
	[ ! -f Makefile.nocppflags ] || mv -f Makefile.nocppflags Makefile

override_dh_auto_test:
	dh_auto_test -- HAVE_RULES=yes TINYXML=-ltinyxml

override_dh_auto_install:
	dh_auto_install -- HAVE_RULES=yes TINYXML=-ltinyxml

%:
	dh $@
