+include /usr/share/quilt/quilt.make
+QUILT = QUILT_PATCHES=$(QUILT_PATCH_DIR) quilt --quiltrc /dev/null
+
+###################### user serviceable parts ######################
+
+###
+# build a separate mutt-patched package?
+BUILD_PATCHED := yes
+###
+# header cache backend
+# HCACHE_DB := bdb
+# HCACHE_DB := gdbm
+# HCACHE_DB := qdbm
+HCACHE_DB := tokyocabinet
+###
+# GPGME backend
+GPGME := --enable-gpgme
+###
+
+###################### variables ######################
+
+ifneq ($(BUILD_PATCHED),yes)
+export DH_OPTIONS := -Nmutt-patched
+endif
+
+# Configure arguments
+
+ifeq ($(HCACHE_DB),bdb)
+ hcache_db := --without-gdbm --without-qdbm --without-tokyocabinet
+endif
+ifeq ($(HCACHE_DB),gdbm)
+ hcache_db := --without-qdbm --without-bdb --without-tokyocabinet
+endif
+ifeq ($(HCACHE_DB),qdbm)
+ hcache_db := --without-gdbm --without-bdb --without-tokyocabinet
+endif
+ifeq ($(HCACHE_DB),tokyocabinet)
+ hcache_db := --without-gdbm --without-bdb --without-qdbm
+ ifeq ($(shell dpkg --print-architecture),hurd-i386)
+ hcache_db := --without-bdb --without-qdbm
+ endif
+endif
+
+confflags = --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --with-sharedir=/usr/share/mutt \
+ --with-docdir=/usr/share/doc \
+ --with-mailpath=/var/mail \
+ \
+ --disable-dependency-tracking \
+ \
+ --enable-compressed \
+ --enable-debug \
+ --enable-fcntl \
+ --enable-hcache \
+ $(GPGME) \
+ --enable-imap \
+ --enable-smtp \
+ --enable-inodesort \
+ --enable-pop \
+ \
+ --with-curses \
+ --with-gnutls \
+ --with-gss \
+ --with-idn \
+ --with-mixmaster \
+ --with-sasl \
+ \
+ $(hcache_db)
+
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+confflags += --build $(DEB_BUILD_GNU_TYPE)
+# Only specify --host when cross-compiling
+ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
+ confflags += --host $(DEB_HOST_GNU_TYPE)
+endif
+
+# CFLAGS
+CFLAGS = -Wall -g
+CPPFLAGS = -I/usr/include/qdbm
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+
+# Directory to make the build on
+objdir = $(CURDIR)/obj-$(DEB_HOST_GNU_TYPE)
+
+###################### main ######################
+
+$(objdir)-patched/build-stamp: $(QUILT_STAMPFN)
+ dh_testdir