#!/usr/bin/make -f
# Made with the aid of debmake, by Christoph Lameter,
# based on the sample debian/rules file for GNU hello by Ian Jackson.

package=gcipher
version=1.0

TAR_DIR := $(package)-$(version)

include /usr/share/dbs/dbs-build.mk

build: setup
	$(checkdir)
	
	touch $(STAMP_DIR)/build

clean:
	$(checkdir)
	rm -rf $(STAMP_DIR) $(SOURCE_DIR)
	rm -f debian/files.saved debian/files
	rm -f $$(find . -name "*~" -o -name core -o -name "*.orig")
	rm -rf debian/*.debhelper
	rm -rf debian/tmp debian/files* core debian/substvars

binary-arch: checkroot build
	$(checkdir)
# There are no architecture-independent files to be uploaded
# generated by this package.  If there were any they would be
# made here.

binary-indep: checkroot build
	$(checkroot)
	dh_clean -k
	dh_installdirs -A

	cwd=`pwd` ; \
	set -e ; \
	( cd $(BUILD_TREE) && \
		for file in CONTRIB README ; do \
			install -m 644 $$file $$cwd/debian/tmp/usr/share/doc/$(package); \
		done && \
		install -m 644 gcipher.1 $$cwd/debian/tmp/usr/share/man/man1; \
		cd src && \
		install -m 755 gcipher $$cwd/debian/tmp/usr/bin; \
		install -m 644 gcipher.desktop $$cwd/debian/tmp/usr/share/applications; \
		for file in $$(find . -name "*.py" -o -name "*.glade" -o -name "*.gladep") ; do \
			install -m 644 $$file $$cwd/debian/tmp/usr/share/gcipher/lib/$$file; \
		done && \
		cd .. && \
		cd plugins && \
		for file in $$(find . -name "*.py") ; do \
			install -m 644 $$file $$cwd/debian/tmp/usr/share/gcipher/plugins/$$file; \
		done )
	
	dh_installdocs
	dh_installmenu
	dh_installchangelogs
	dh_link
	dh_compress
	dh_pysupport /usr/share/gcipher/lib
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_fixperms
	dh_builddeb

define checkdir
	test -f debian/rules
endef

binary: binary-indep binary-arch

checkroot:
	$(checkdir)
	test root = "`whoami`"

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