#! /usr/bin/make -f

Makefile:
	./configure --prefix=/usr
	@if ! grep -q "HAVE_LIBGC=1" Makefile; then \
		echo "***** Error: bock should be built with libgc installed" 1>&2; \
		exit 1; \
	fi

build: Makefile
	make
	make check

clean:
	if test -e Makefile; then make distclean; fi

install-bock:
	make prefix=$(ROOT)/usr install
	mkdir -p $(ROOT)/usr/share
	mv $(ROOT)/usr/doc $(ROOT)/usr/man $(ROOT)/usr/share/.
	$(RM) $(ROOT)/usr/share/doc/bock/COPYING
	echo '// Please refer to /usr/share/doc/bock/copyright for legal' \
			> $(ROOT)/usr/share/bock/lib/LEGAL
	echo '// details pertaining to the files in this directory.' \
			>> $(ROOT)/usr/share/bock/lib/LEGAL
	install -m 755 debian/postinst debian/prerm $(CONTROL)
	dpkg-shlibdeps -pbock $(ROOT)/usr/bin/*

finalise-bock:
