#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.
#
# Modified to make a template file for a multi-binary package with separated
# build-arch and build-indep targets  by Bill Allombert 2001

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

DPKG_EXPORT_BUILDFLAGS=1
include /usr/share/dpkg/buildflags.mk
LDFLAGS += -Wl,--as-needed

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk

DEB_CONFIGURE_EXTRA_FLAGS := --with-optim=$(DEB_OPTFLAGS) --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) --mandir=/usr/share/man --enable-static --enable-debug --with-pdftops-renderer=pdftops --with-pdftops-maxres=360

DEB_MAKE_INSTALL_TARGET := install BUILDROOT=$(DEB_DESTDIR)
DEB_INSTALL_CHANGELOGS_ALL := CHANGES.txt

#DEB_DH_STRIP_ARGS := --dbg-package=cups-filters-dbg
DEB_DH_INSTALL_SOURCEDIR := debian/tmp
DPKG_GENSYMBOLS_CHECK_LEVEL=4
export DPKG_GENSYMBOLS_CHECK_LEVEL

cleanbuilddir::
	[ ! -f Makedefs ] || make distclean

binary-post-install/cups-filters::
	# Ubuntu-specific stuff
	#  - Install Apport hook
	#  - Replace standard test page template by Ubuntu-branded one
	if dpkg-vendor --is ubuntu; then \
	   install -D -m 644 debian/local/apport-hook.py debian/$(cdbs_curpkg)/usr/share/apport/package-hooks/source_cups-filters.py; \
	   install -D -m 644 debian/local/default-testpage.pdf debian/$(cdbs_curpkg)/usr/share/cups/data/default-testpage.pdf; \
	fi

	# Make the serial backend run as root, since /dev/ttyS* are
	# root:dialout and thus not accessible as user lp
	chmod go-x debian/$(cdbs_curpkg)/usr/lib/cups/backend/serial
