#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

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

# This is the debhelper compatability version to use.
export DH_COMPAT=3

DEBINSTALL = install -p -o root -g root -m 644
TARGETDIR = $(CURDIR)/debian/tmp
GMETADOM_MODULES = "gdome_caml gdome_cpp_smart"
# GMETADOM_MODULES = "gdome_caml"

configure: configure-stamp
configure-stamp:
	dh_testdir
	# Add here commands to configure the package.
	./configure --with-modules=$(GMETADOM_MODULES) --prefix=/usr

	touch configure-stamp

build: build-stamp

build-stamp: configure-stamp 
	dh_testdir

	# Add here commands to compile the package.
	$(MAKE)

	touch build-stamp

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

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

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# Add here commands to install the package into debian/gmetadom.
	$(MAKE) install DESTDIR=$(TARGETDIR)/

movefiles: install
	dh_movefiles

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

# Build architecture-dependent files here.
binary-arch: build install movefiles
	dh_testdir
	dh_testroot
#	dh_installdebconf	
	dh_installdocs -A
#	zero sized files documentation files
	-find $(CURDIR)/debian -type f -size 0 -exec rm {} \;

	dh_installexamples -A
	dh_undocumented
	dh_installchangelogs -A ChangeLog
	dh_link -A
	dh_strip -A
	dh_compress -A
	dh_ocamlld -p libgdome2-ocaml /usr/lib/ocaml/gdome2
	dh_fixperms -A
	dh_makeshlibs -p libgdome2-cpp-smart0
	dh_installdeb -A
	dh_shlibdeps \
		-p libgdome2-cpp-smart0 \
		-p libgdome2-ocaml
	dh_gencontrol -A
	dh_md5sums -A
	dh_builddeb -A

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

