#!/usr/bin/make -f

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

include /usr/share/dpkg/architecture.mk

export DEB_BUILD_MAINT_OPTIONS=hardening=+all
FRIBIDI_UDEB=libfribidi0-udeb

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
OBJS += xmalloc.o
else
export DEB_CFLAGS_MAINT_APPEND=-Os -fomit-frame-pointer -g
endif

%:
	dh $@

override_dh_auto_configure:
ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
	dpkg-architecture -a$(DEB_BUILD_ARCH) -f -c dh_auto_configure --reload-all-buildenv-variables -- --enable-malloc --enable-static
	dpkg-architecture -a$(DEB_BUILD_ARCH) -f -c dh_auto_build -- -C bin fribidi.1
	dpkg-architecture -a$(DEB_BUILD_ARCH) -f -c dh_auto_clean
endif
	dh_auto_configure -- --enable-malloc --enable-static

ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
execute_before_dh_auto_build:
	dh_auto_build -- -C bin fribidi
	touch bin/fribidi.1
endif

override_dh_makeshlibs:
	dh_makeshlibs -V --add-udeb="$(FRIBIDI_UDEB)"
