#!/usr/bin/make -f

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

# This is the debhelper compatibility version to use.
#export DH_COMPAT=4

#
# The directory where the test programs and shared library are going to live
#
RUNDIR=/usr/lib/paxtest
export RUNDIR

#
# The directory where the test script (paxtest) is going to live
#
BINDIR=/usr/bin
export BINDIR

include /usr/share/dpkg/architecture.mk

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -g
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	INSTALL_PROGRAM += -s
endif

%:
	dh $@

override_dh_auto_build:
ifeq ($(DEB_HOST_ARCH), i386)
	dh_auto_build -- linux32
else
ifeq ($(DEB_HOST_ARCH), amd64)
	dh_auto_build -- linux64
else
	dh_auto_build -- linux
endif
endif
	/usr/bin/docbook-to-man debian/paxtest.sgml > paxtest.1


override_dh_auto_clean:
	dh_auto_clean
	$(MAKE) -f Makefile.psm clean
	rm -f paxtest.1 test

override_dh_install:
	dh_install
	$(MAKE) -f Makefile.psm install DESTDIR=$(CURDIR)/debian/paxtest
