#!/usr/bin/make -f
# Simple set of debian/rules that uses debhelper.
# Based on an example by Joey Hess. 

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

build: build-stamp
build-stamp:
	dh_testdir

	# Add here commands to compile the package.
	cd src && ./configure --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man
	(cd src; $(MAKE))
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp

	# Add here commands to clean up after the build process.
	cd src && ./configure --prefix=/usr --sysconfdir=/etc
	cd src && $(MAKE) clean -s
	rm -f Makefile.inc

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	#start the install
	mkdir -p debian/tmp
	-(cd debian/extras && find . |cpio -pdmuv ../tmp)
	(cd src; export DESTDIR=`pwd`/../debian/tmp; $(MAKE) $@)
	mkdir -p debian/tmp/usr/lib debian/tmp/usr/include
	cp -va include debian/tmp/usr/include/emc2
	cp -a lib/*.a debian/tmp/usr/lib
	dh_movefiles

# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_installexamples
	dh_installman
	dh_link
	dh_strip
	dh_compress -X.pdf -X.txt
	dh_fixperms -X/emc_module_helper
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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