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

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

export DEB_BUILD_HARDENING=1

# fix build problems on the sparc buildd
ifeq ($(DEB_HOST_ARCH),sparc)
export DEB_BUILD_HARDENING=0
#export MALLOC_CHECK_=0
endif

# fix build problems on the hurd
ifeq ($(DEB_HOST_ARCH),hurd-i386)
CONFIGURE_LIBS = LIBS="-Wl,--no-as-needed -Wl,-lpthread -Wl,--as-needed"
endif

%:
	dh $@ 

override_dh_auto_build:
	make	
	make doc

override_dh_auto_clean:
	[ ! -f Makefile ] || make distclean
# remove files which are updated by autoreconf:
	-rm aclocal.m4 configure

override_dh_auto_configure:
	-autoreconf -vfi
	./configure --build $(DEB_HOST_GNU_TYPE) \
		--docdir=/usr/share/doc/gle-graphics/ \
		--with-rpath=no --with-scripts=no \
		$(CONFIGURE_LIBS)

override_dh_auto_install:
	dh_auto_install
	cp debian/qgle.1 debian/gle-graphics/usr/share/man/man1/
	cp debian/manip.1 debian/gle-graphics/usr/share/man/man1/
# do not ship helper that is only used during build
	[ ! -f debian/gle-graphics/usr/bin/glebtool ] || rm debian/gle-graphics/usr/bin/glebtool

# do not compress LICENSE.txt as it needs to be read by qgle
# qgle can now read compressed files
#override_dh_compress:
#	dh_compress -X usr/share/doc/gle-graphics/LICENSE.txt
