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

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

# This has to be exported to make some magic below work.
export DH_OPTIONS

SVN_ROOT ?= ../svnroot
DEST = debian
DEST_MAIN = debian/yandex-svn-release

build:
	echo nop

binary: install
	echo nop

clean:
	dh_testdir
	dh_testroot
	dh_clean
	rm -f build-arch-stamp build-indep-stamp #CONFIGURE-STAMP#

	# Add here commands to clean up after the build process.
	-$(MAKE) clean

	dh_clean

install:
	dh_testdir
	dh_testroot
	dh_clean -k -i
	dh_installdirs
	dh_installcron

	# main
	install -T $(SVN_ROOT)/SvnRelease/MkFiles.pm $(DEST_MAIN)/usr/share/perl5/SvnRelease/MkFiles.pm

	cp $(SVN_ROOT)/mk-* $(DEST_MAIN)/usr/local/bin/
	install -T $(SVN_ROOT)/dh-svn-release $(DEST_MAIN)/usr/local/bin/dh-svn-release
	install -T $(SVN_ROOT)/svn-hotfix $(DEST_MAIN)/usr/local/bin/svn-hotfix
	install -T $(SVN_ROOT)/cleanup-repos $(DEST_MAIN)/usr/local/bin/cleanup-repos
	install -T $(SVN_ROOT)/direct-pkg-version $(DEST_MAIN)/usr/local/bin/direct-pkg-version
	chmod -R g-w $(DEST_MAIN)/

	dh_perl
	#dh_makeshlibs
	dh_installdeb
	#dh_shlibdeps
	dh_gencontrol -- -v`cat debian/version`
	dh_md5sums
	dh_builddeb

.PHONY: build clean install
