#!/usr/bin/make -f

export PATH := $(PATH):/usr/lib/qt6/libexec
DEB_DH_SHLIBDEPS_ARGS_ALL=-l/usr/lib/$(DEB_HOST_MULTIARCH)/gecode-flatzinc

ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))$(filter ia64 mipsel,$(DEB_HOST_ARCH)))
	CFLAGS += -O3
	CXXFLAGS += -O3
endif

CFLAGS += -D_REENTRANT $(CPPFLAGS)
CXXFLAGS += -D_REENTRANT $(CPPFLAGS)
DEB_CONFIGURE_EXTRA_FLAGS += DLLFLAGS="$(LDFLAGS)" GLDFLAGS="$(LDFLAGS)"

%: configure.ac
	dh $@ --with=autoreconf

override_dh_auto_configure:
	dh_auto_configure -- --enable-gist --enable-qt --enable-float-vars --enable-cppprofiler --enable-cbs --disable-examples --disable-qecode --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)/gecode-flatzinc --with-host-os=linux  --enable-static --disable-shared

override_dh_auto_build: changelog
	dh_auto_build

changelog:
	$(MAKE) ChangeLog
	mv ChangeLog changelog

configure.ac:
	$(MAKE) -f Makefile.contribs

override_dh_install-arch:
	dh_install
	rm -rf $(CURDIR)/debian/gecode-flatzinc/usr/include $(CURDIR)/debian/gecode-flatzinc/usr/lib
