#!/usr/bin/make -f
# Made with the aid of debmake, by Christoph Lameter,
# based on the sample debian/rules file for GNU hello by Ian Jackson.

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

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

package=xmms2

RUBYARCHDIR=$(shell ruby -rrbconfig -e 'print Config::CONFIG["archdir"]')
SCONSFLAGS=MANDIR=/usr/share/man PREFIX=/usr CCFLAGS="-O2 -Wall -g" RUBYARCHDIR=$(RUBYARCHDIR)

build:
	dh_testdir
	dh_testroot
	scons $(SCONSFLAGS)
	touch build

clean:
	dh_testdir
	rm -f build
	scons -c 
	dh_clean

binary-indep: build
	dh_testdir
# There are no architecture-independent files to be uploaded
# generated by this package.  If there were any they would be
# made here.

binary-arch: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	
	scons $(SCONSFLAGS) INSTALLDIR="`pwd`/debian/tmp/" install

	# create copyright file
	cp debian/copyright.header debian/copyright
	cat AUTHORS >> debian/copyright
	cat debian/copyright.footer >> debian/copyright
	
	dh_install --sourcedir=debian/tmp --list-missing
	dh_installdocs README TODO 
	dh_installchangelogs
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_makeshlibs -plibxmms2client -plibxmms2client-ecore -plibxmms2client-glib
	dh_python
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch

.PHONY: binary binary-arch binary-indep clean
