#!/usr/bin/make -f

# export DH_VERBOSE=1
export DH_OPTIONS

configure: configure-stamp
configure-stamp:
	dh_testdir
	touch configure-stamp


build: build-stamp
build-stamp: configure-stamp 
	dh_testdir
	$(MAKE) all
	touch build-stamp

distclean: clean
clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp

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

	dh_clean 

DESTDIR=$(CURDIR)/debian/pydsh
install: build
	dh_testdir
	dh_testroot
	dh_clean -k 
	dh_installdirs
	mkdir -p $(DESTDIR)
	$(MAKE) install prefix=/usr DESTDIR=$(DESTDIR)
	
binary: binary-arch binary-indep

binary-arch: install

binary-indep: install
	dh_testdir
	dh_testroot
	dh_python
	mkdir -p $(DESTDIR)/usr/share/doc/pydsh/
	install --mode=644 debian/changelog $(DESTDIR)/usr/share/doc/pydsh/changelog.DEBIAN
	gzip -f9 $(DESTDIR)/usr/share/doc/pydsh/changelog.DEBIAN
	install --mode=644 debian/copyright $(DESTDIR)/usr/share/doc/pydsh/copyright
	gzip -f9 $(DESTDIR)/usr/share/doc/pydsh/copyright
	mkdir -p $(DESTDIR)/DEBIAN
#	cd $(DESTDIR) && find * -path DEBIAN -prune -o -type f -print | xargs md5sum > DEBIAN/md5sums
#	dpkg-gencontrol -isp -P$(DESTDIR)
#	dpkg-deb --build $(DESTDIR) ..
	dh_strip
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb
	

	

