#!/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

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
include /usr/share/dpkg/architecture.mk


#ifneq (,$(findstring hppa-linux-gnu,$(DEB_BUILD_GNU_TYPE)))
#        NO_EMBED = --disable-embedded-perl
#endif
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -g
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	INSTALL_PROGRAM += -s
endif

# Can be dropped after https://github.com/The-McGrail-Foundation/MIMEDefang/commit/f8125fccf2ca2588df806503bcd783347acd6e19
export CFLAGS += -std=gnu89

include /usr/share/dpkg/buildflags.mk

CFLAGS += $(CPPFLAGS)
export CFLAGS

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- --disable-anti-virus --with-confsubdir=/ --with-quarantinedir=/var/spool/MIMEDefang $(NO_EMBED)

override_dh_auto_build:
	dh_auto_build
	pod2man contrib/graphdefang-0.91/graphdefang.pl > graphdefang.pl.1

override_dh_auto_clean:
	dh_auto_clean
	[ ! -f Makefile ] || $(MAKE) distclean
	rm -f graphdefang.pl.1
	debconf-updatepo
	dh_clean

override_dh_auto_install:
	mkdir -p debian/tmp/etc/mail debian/tmp/etc/logrotate.d
	cp examples/redhat-logrotate-file debian/tmp/etc/logrotate.d/mimedefang
	dh_auto_install -- INSTALL_STRIP_FLAG=''

override_dh_installsystemd:
	dh_installsystemd --no-enable --no-start

override_dh_auto_test:
