#!/usr/bin/make -f

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

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

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

build: configure-stamp build-stamp
build-stamp:
	dh_testdir

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp
	rm -f config.log config.cache

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

	dh_clean

install: build
#build im-ja
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

#build and install im-ja and im-ja-applet
	./configure \
	--prefix=/usr \
	--mandir=\$${prefix}/share/man \
	--infodir=\$${prefix}/share/info \
	--sysconfdir=/etc \
	--libexecdir=\$${libdir}
	# Add here commands to compile the package.
	$(MAKE)
	GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 \
	$(MAKE) install \
	    prefix=$(CURDIR)/debian/im-ja/usr \
	    sysconfdir=$(CURDIR)/debian/im-ja/etc
#move over stuff into im-ja-applet
	mv $(CURDIR)/debian/im-ja/usr/lib/bonobo $(CURDIR)/debian/im-ja-applet/usr/lib/
	mv $(CURDIR)/debian/im-ja/usr/lib/im-ja/im-ja-applet $(CURDIR)/debian/im-ja-applet/usr/lib/im-ja/
	mv $(CURDIR)/debian/im-ja/usr/share/gnome-2.0 $(CURDIR)/debian/im-ja-applet/usr/share/


# 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_installdebconf	
	dh_installdocs 
#	dh_installmenu
#	dh_installman
	dh_installchangelogs ChangeLog
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
#	dh_makeshlibs
	dh_gconf
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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