#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk

DEB_INSTALL_CHANGELOGS_ALL := History.rdoc

build: build-stamp

build-stamp:
	INLINEDIR=. help2man --no-info --include=debian/spec.h2m "ruby1.8 bin/spec" >spec.1
	INLINEDIR=. help2man --no-info --include=debian/spec1.9.1.h2m "ruby1.8 bin/spec" >spec1.9.1.1
	patch spec.1 <debian/spec.1.diff
	patch spec1.9.1.1 <debian/spec.1.diff
	patch spec1.9.1.1 <debian/spec1.9.1.1.diff
	touch build-stamp

install/librspec-ruby1.8::
	INLINEDIR=. ruby1.8 bin/spec --options spec/spec.opts spec/spec

install/librspec-ruby1.9.1::
	mv spec/spec/interop/test debian/test.backup
	INLINEDIR=. ruby1.9.1 -I. bin/spec --options spec/spec.opts spec/spec

clean::
	[ ! -d debian/test.backup ] || mv debian/test.backup spec/spec/interop/test
	rm -f spec*.1 build-stamp
	rm -rf .ruby_inline
