#!/usr/bin/make -f
# GNU copyright 1997 to 1999 by Joey Hess.

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

export DH_OPTIONS += -O-Bdebian/build-tree

CFLAGS		?= $(shell dpkg-buildflags --get CFLAGS)
LDFLAGS		?= $(shell dpkg-buildflags --get LDFLAGS)

ifneq (,$(filter debug,$(DEB_BUILD_OPTIONS)))
    EXTRA_CONFIGURE_OPTS += "--enable-debug --enable-trace"
endif

ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
    CFLAGS += -O0
else
    CFLAGS += -O2
endif

override_dh_auto_configure:
	dh_auto_configure -- \
		--prefix=/usr \
		--mandir=\$${prefix}/share/man \
		--infodir=\$${prefix}/share/info \
		--sysconfdir=/etc \
		--libexecdir=\$${libdir}/libzorpll \
		$(EXTRA_CONFIGURE_OPTS) \
		--localstatedir=/var \
		--disable-werror

# And for the rest, there is debhelper!
%:
	dh $@ --list-missing --automatic-dbgsym
