#!/usr/bin/make -f

PACKAGE = $(shell dh_listpackages)
SVN_ROOT ?= .
DEST_MAIN = $(SVN_ROOT)/debian/$(PACKAGE)

build:

clean:
	dh_clean
	rm -rf $(DEST_MAIN)/opt

binary-arch:

binary-indep:
	dh_testdir
	dh_testroot
	dh_install
	mkdir -p $(DEST_MAIN)/opt
	svn co https://svn.yandex.ru/rt-research/trunk/broadmatching $(DEST_MAIN)/opt/broadmatching
	find $(DEST_MAIN) -name .svn | xargs rm -Rf
	rm -Rf $(DEST_MAIN)/opt/broadmatching/packages
	rm -Rf $(DEST_MAIN)/opt/broadmatching/dicts
	rm -Rf $(DEST_MAIN)/opt/broadmatching/scripts/mapreduce
	install $(SVN_ROOT)/subphraser $(DEST_MAIN)/opt/broadmatching/scripts/cpp-source/subphraser/
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch

.PHONY: build clean binary-arch binary-indep binary
