#!/usr/bin/make -f
# -*- makefile -*-
%:
	dh ${@}

override_dh_auto_install:
	PREFIX=/usr sh compile.sh
	dh_auto_install
	
override_dh_installdirs:
	$(MAKE) x11
	sed -e 's,\@PREFIX\@,/usr,' ./lib/x11/libglfw.pc.in > ./lib/x11/libglfw.pc
	make x11-install PREFIX=$(CURDIR)/debian/tmp/usr
	cp lib/x11/libglfw.so debian/tmp/usr/lib/libglfw.so.2.6

override_dh_installdocs:
	dh_installdocs readme.html

verride_dh_clean:
	[ ! -f Makefile ] || $(MAKE) x11-clean
	find -name '*.o' -or -name '*.a' -or -name '*.so' | xargs rm
	find -type f -executable -not -wholename "*debian*" -delete
	rm config.log examples/Makefile.x11 lib/x11/Makefile.x11
	lib/x11/libglfw.pc lib/x11/libglfw.pc.in tests/Makefile.x11
	dh_clean
