#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

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

BASE   := tkabber-plugins
DESTDIR = $(CURDIR)/debian/$(BASE)
PREFIX := /usr
PLUGDIR = $(DESTDIR)/$(PREFIX)/share/$(BASE)
DOCDIR  = $(DESTDIR)/$(PREFIX)/share/doc/$(BASE)

build: build-arch build-indep

build-arch:

build-indep:
	dh_testdir


clean:
	dh_testdir
	dh_testroot

	dh_clean 


install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	$(MAKE) CURDIR=$(CURDIR) DESTDIR=$(DESTDIR) PREFIX=$(PREFIX) install-bin

	find $(PLUGDIR) -mindepth 1 -maxdepth 1 -type d \
		-exec $(SHELL) $(CURDIR)/debian/docify.sh $(DOCDIR) '{}' \;

	mv $(PLUGDIR)/georoster/howto.txt $(DOCDIR)/README.georoster

	mkdir $(DOCDIR)/checkers
	mv $(PLUGDIR)/checkers/rules $(DOCDIR)/checkers
	mv $(DOCDIR)/proto.checkers $(DOCDIR)/checkers/proto

	chmod 664 $(PLUGDIR)/whiteboard/svgrender.tcl

binary-arch:

binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs ChangeLog
	dh_installdocs
	dh_installman $(CURDIR)/debian/tkabber-plugins.7
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-arch binary-indep

.PHONY: build clean binary-indep binary install

