#!/usr/bin/make -f
# -*- makefile -*-

export DH_VERBOSE=1

ifneq ($(filter nodoc,$(DEB_BUILD_PROFILES)),)
export MAKEINFO = true
endif

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND = -O3
export DEB_CPPFLAGS_MAINT_APPEND = -DHAVE_DYNAMIC_LIBPCRE
export DEB_LDFLAGS_MAINT_APPEND = -Wl,-z,defs

export LIBS=-Wl,--no-as-needed -ldl -Wl,--as-needed

include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/buildopts.mk

USE_INCLUDED_REGEX = --without-included-regex
ifeq (musl,$(DEB_HOST_ARCH_LIBC))
	USE_INCLUDED_REGEX = --with-included-regex
endif

%:
	dh $@

override_dh_auto_clean:
	[ ! -f Makefile ] || dh_auto_clean

# remove this after trixie has been released.
# for the moment, dh-sequence-movetousr is a Build-Dependency, so it would make
# it easier to backport grep, if needed.
override_dh_auto_configure:
	dh_auto_configure -- --exec-prefix=/ $(USE_INCLUDED_REGEX)
