#!/usr/bin/make -f

%:
	dh $@ --parallel --list-missing

override_dh_auto_configure:
	aclocal
	autoheader
	automake --add-missing --copy
	autoconf
ifeq ($(DEB_HOST_ARCH_OS),linux)
  ifneq ($(DEB_HOST_ARCH),hppa)
	$(MAKE) -C classes/ssl/src update_jars
	$(MAKE) -C classes/ssl/src clean
  endif
endif
	dh_auto_configure -- --with-system-libvncserver

override_dh_auto_clean:
	dh_auto_clean
	rm -rf autom4te.cache
	rm -f aclocal.m4 config.guess config.sub configure \
		depcomp install-sh missing \
		rfbconfig.h.in rfb/rfbconfig.h rfb/rfbint.h
	find . -type f -name Makefile.in -delete
ifeq ($(DEB_HOST_ARCH_OS),linux)
  ifneq ($(DEB_HOST_ARCH),hppa)
	find . -type f -name '*.jar' -delete
  endif
endif

override_dh_auto_install:
	dh_auto_install
	find debian -type f -name 'x11vnc' | xargs chrpath -d

.PHONY: override_dh_auto_test
