#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

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

include /usr/share/cdbs/1/class/mingw64.mk
include /usr/share/cdbs/1/rules/mingw64-cmake.mk

CONFIGOPTS32 := $(CONFIGOPTS32) \
	-DCMAKE_INSTALL_PREFIX=$(MINGW32_SYSROOT)mingw/

CONFIGOPTS64 := $(CONFIGOPTS64) \
	-DCMAKE_INSTALL_PREFIX=$(MINGW64_SYSROOT)mingw/
	
CONFIGOPTS := $(CONFIGOPTS) -DBUILD_PKGCONFIG_FILES=ON

export BUILD_ROOT MINGW32_SYSROOT MINGW64_SYSROOT

configure: configure-stamp
configure-stamp:
	dh_testdir
	
	mkdir -p build-64
	if [ -f debian/pre64_config.sh ]; then /bin/bash debian/pre64_config.sh; fi
	cd build-64 && $(MINGW64_ENVARS) cmake .. $(CONFIGOPTS) $(CONFIGOPTS64)
	if [ -f debian/post64_config.sh ]; then /bin/bash debian/post64_config.sh; fi
	
	mkdir -p build-32
	if [ -f debian/pre32_config.sh ]; then /bin/bash debian/pre32_config.sh; fi
	cd build-32 && $(MINGW32_ENVARS) cmake .. $(CONFIGOPTS) $(CONFIGOPTS32)
	if [ -f debian/post32_config.sh ]; then /bin/bash debian/post32_config.sh; fi
		
	touch configure-stamp
