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

DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
BINARY_DIR        := $(CURDIR)/bindir

override_dh_auto_build:
	rm -rf .pc build patches stamp-*
	mkdir -p $(BINARY_DIR)
	make BINARY_DIR=$(BINARY_DIR) MINGW_HOST=i686-w64-mingw32
ifeq ($(DEB_HOST_ARCH_CPU),x86_64)
	rm -rf .pc build patches stamp-*
	make BINARY_DIR=$(BINARY_DIR) MINGW_HOST=x86_64-w64-mingw32
endif

override_dh_auto_install:
	make install BINARY_DIR=$(BINARY_DIR) INSTALL_DIR=$(CURDIR)/debian/tmp
	
override_dh_auto_clean:
	make clean BINARY_DIR=$(BINARY_DIR)
	rm -rf debian/*.log

override_dh_strip:
	# We choose which object we strip since this is not trivial here..
	strip --remove-section=.comment --remove-section=.note \
	   $(CURDIR)/debian/flexdll/usr/lib/flexdll/flexlink.exe

%:
	dh $@
