#!/usr/bin/make -f

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

ifneq (,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
  NJOBS := -j $(subst parallel=,,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
endif

CONFIGURE_FLAGS += --disable-werror --docdir=/usr/share/doc/libcdr-doc --without-docs

# see https://cgit.freedesktop.org/libreoffice/core/commit/?id=fabad007c60958f2ff87e8f636ff6a798ad1f963 
ifeq "$(shell dpkg --compare-versions `pkg-config --modversion icu-i18n` ge 59 && echo true)" "true"
	export DEB_CXXFLAGS_MAINT_APPEND := -DUCHAR_TYPE=uint16_t
endif
export DPKG_EXPORT_BUILDFLAGS=y 
include /usr/share/dpkg/buildflags.mk

%:
	dh $@ --with autoreconf

override_dh_auto_configure:

override_dh_auto_build-arch:
	dh_auto_configure -- $(CONFIGURE_FLAGS)
	$(MAKE) $(NJOBS)

override_dh_auto_build-indep:
	dh_auto_configure -- $(filter-out --without-docs,$(CONFIGURE_FLAGS))
	$(MAKE) $(NJOBS)

