#!/usr/bin/make -f

DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

ifeq ($(DEB_HOST_ARCH), ppc64)
  export DEB_GCC_NO_O3=1
  export CFLAGS=-g -O0
endif

ifneq ($(DEB_HOST_ARCH_OS), linux)
  EXTRA_DH_ARG=-Nlinuxvnc
endif

%:
	dh $(EXTRA_DH_ARG) --dbg-package=libvncserver0-dbg $@

override_dh_auto_configure:
	aclocal
	autoheader
	automake --add-missing --copy
	autoconf
	dh_auto_configure

override_dh_clean:
	dh_clean
	rm -rf autom4te.cache
	rm -f aclocal.m4 config.guess config.sub configure \
		depcomp install-sh missing _configs.sed \
		rfbconfig.h.in rfb/rfbconfig.h rfb/rfbint.h
	find . -name Makefile -delete
	find . -name Makefile.in -delete

.PHONY: dh_auto_test
