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

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


DEBDIR = $(CURDIR)/debian/opendict-plugins-lingvosoft

DICTIONARIES =	ensq enar enaz enbs enbg enzhs enzht enhr encs ennl \
		enet enfi enfr ende enel enhe enhu enid enit enjap \
		enjakana enjakanji enjaromaji enko enlv enlt enfa enpl enpt  enro \
                enru ensr ensk enes ensv entl enth entr enuk  envi \
                enyi enmul
# enla - not works yet	

build: build-stamp

build-stamp:
	dh_testdir
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp

	dh_clean 

install: build
	dh_testdir
	dh_testroot
	dh_clean -k 
	dh_installdirs

	for DICT in $(DICTIONARIES); do \
		$(MAKE) install DESTDIR=$(DEBDIR) DICT=$$DICT; \
	done

	for DICT in $(DICTIONARIES); do \
		rm -f $(DEBDIR)/usr/share/opendict/dictionaries/plugins/Lingvosoft-$$DICT/weblingvosoft.py; \
	done
	
	rm -f $(DEBDIR)/usr/share/opendict/dictionaries/plugins/weblingvosoft.py

	mkdir -p $(DEBDIR)//usr/lib/python2.7/dist-packages/opendict-plugins-lingvosoft
	cp  $(CURDIR)/weblingvosoft.py $(DEBDIR)/usr/lib/python2.7/dist-packages/opendict-plugins-lingvosoft

# Build architecture-independent files here.
binary-arch:

# Build architecture-dependent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installdirs
	dh_installchangelogs 
	dh_installdocs

	dh_install
	dh_strip
	dh_compress
	dh_fixperms
	dh_python2 /usr/share/opendict/dictionaries/plugins
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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

