#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

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

configure: configure-stamp
configure-stamp:
	dh_testdir

	if [ ! -x configure ]; then \
		echo "Dude.. you should do this stuff before release.."; \
	    autoreconf --install --force --verbose; \
	    touch OMG-AUTORECONF; \
	fi

	./configure --prefix=/opt/maemo/usr

	touch $@

build: configure build-stamp
build-stamp:
	dh_testdir

	$(MAKE)
	#docbook-to-man debian/live-f1.sgml > live-f1.1

	touch $@

clean: 
	dh_testdir
	dh_testroot
	rm -f build-stamp 

	# Add here commands to clean up after the build process.
	[ ! -f Makefile ] || $(MAKE) distclean
	rm -f config.sub config.guess

	dh_clean 

install: build
	dh_testdir
	dh_testroot
	dh_clean -k

	$(MAKE) install DESTDIR=`pwd`/debian/live-f1/
	
	install -D -m 0755 -o root -g root "debian/live-f1.launch" "debian/live-f1/usr/bin/live-f1"

	dh_install
	dh_installdocs README ChangeLog AUTHORS
	dh_installchangelogs


binary-arch: install
	dh_testdir
	dh_testroot
	dh_strip -a
	dh_compress -a
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary-indep: install
	#nothing to do

binary: binary-arch binary-indep

clean: 
	dh_testdir
	dh_testroot
	dh_clean

	rm -rf *-stamp
	-$(MAKE) clean
	if [ -f OMG-AUTORECONF ]; then \
	  make distclean || true; \
	  rm -rf autom4te.cache config.{guess,rpath,status,sub} \
		install-sh configure depcomp missing mkinstalldirs \
		ABOUT-NLS aclocal.m4 config.h.in \
		INSTALL Makefile.in OMG-AUTORECONF \
		intl src/Makefile.in \
		m4/{xsize,wint_t,wchar_t,ulonglong,uintmax_t,stdint_h,size_max,signed}.m4 \
		m4/{progtest,printf-posix,po,nls,longlong,longdouble,lib-prefix,lib-link}.m4 \
		m4/{lib-ld,lcmessage,isc-posix,inttypes_h,inttypes,inttypes-pri,intmax}.m4 \
		m4/{intdiv0,iconv,glibc21,glibc2,gettext,codeset}.m4 \
		po/{stamp-po,remove-potcdate.sin,quot.sed,live-f1.pot,insert-header.sin} \
		po/{en@quot.header,en@boldquot.header,boldquot.sed,Rules-quot,Makevars.template,Makefile.in.in}; \
	fi
