#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

# 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

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

%:
	dh $@ --with quilt

override_dh_auto_build:
ifeq ($(DEB_BUILD_ARCH), i386)
	$(MAKE) -f Makefile linux32
else	
ifeq ($(DEB_BUILD_ARCH), amd64)
	$(MAKE) -f Makefile linux64
else	
	$(MAKE) -f Makefile 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

