#!/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


# 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)


CFLAGS = -Wall -g

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif

configure: 


config.status: configure
	dh_testdir

build: build-stamp

build-stamp:  config.status
	dh_testdir

	# Add here commands to compile the package.

	#docbook-to-man debian/jammo.sgml > jammo.1

	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp

	# Add here commands to clean up after the build process.
	-$(MAKE) distclean
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
	cp -f /usr/share/misc/config.sub config.sub
endif
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
	cp -f /usr/share/misc/config.guess config.guess
endif


	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs


	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo
	install -d ${CURDIR}/debian/jammo3-6-data/usr/bin

	#General data files
	install ${CURDIR}/*.wav ${CURDIR}/debian/jammo3-6-data/opt/jammo
	install ${CURDIR}/*.png ${CURDIR}/debian/jammo3-6-data/opt/jammo

	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/buttons
	install ${CURDIR}/buttons/*.png ${CURDIR}/debian/jammo3-6-data/opt/jammo/buttons


	# composing-game
	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/animal/90
	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/animal/110
	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/animal/140
	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/animal/advanced
	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/city/90
	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/city/110
	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/city/140
	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/city/advanced
	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/fantasy/90
	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/fantasy/110
	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/fantasy/140
	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/fantasy/advanced

	install ${CURDIR}/themes/animal/background.png        ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/animal/
	install ${CURDIR}/themes/animal/90/*     ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/animal/90
	install ${CURDIR}/themes/animal/110/*    ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/animal/110
	install ${CURDIR}/themes/animal/140/*    ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/animal/140
	install ${CURDIR}/themes/animal/advanced/*    ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/animal/advanced

	install ${CURDIR}/themes/city/background.png       ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/city/
	install ${CURDIR}/themes/city/90/*       ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/city/90
	install ${CURDIR}/themes/city/110/*      ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/city/110
	install ${CURDIR}/themes/city/140/*      ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/city/140
	install ${CURDIR}/themes/city/advanced/*      ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/city/advanced

	install ${CURDIR}/themes/fantasy/background.png       ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/fantasy/
	install ${CURDIR}/themes/fantasy/90/*    ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/fantasy/90
	install ${CURDIR}/themes/fantasy/110/*   ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/fantasy/110
	install ${CURDIR}/themes/fantasy/140/*   ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/fantasy/140
	install ${CURDIR}/themes/fantasy/advanced/*   ${CURDIR}/debian/jammo3-6-data/opt/jammo/themes/fantasy/advanced


	# singing-game
	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/songs/advanced/avignon
	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/songs/advanced/improvisation
	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/songs/advanced/miska
	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/songs/advanced/pig
	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/songs/easy/boat
	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/songs/easy/donald
	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/songs/easy/jacob
	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/songs/easy/mary
	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/songs/easy/raining
	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/songs/easy/spider
	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/songs/easy/spring
	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/songs/easy/star

	install ${CURDIR}/songs/advanced/avignon/*     ${CURDIR}/debian/jammo3-6-data/opt/jammo/songs/advanced/avignon
	install ${CURDIR}/songs/advanced/improvisation/*     ${CURDIR}/debian/jammo3-6-data/opt/jammo/songs/advanced/improvisation
	install ${CURDIR}/songs/advanced/miska/*       ${CURDIR}/debian/jammo3-6-data/opt/jammo/songs/advanced/miska
	install ${CURDIR}/songs/advanced/pig/*         ${CURDIR}/debian/jammo3-6-data/opt/jammo/songs/advanced/pig
	install ${CURDIR}/songs/easy/boat/*            ${CURDIR}/debian/jammo3-6-data/opt/jammo/songs/easy/boat
	install ${CURDIR}/songs/easy/donald/*          ${CURDIR}/debian/jammo3-6-data/opt/jammo/songs/easy/donald
	install ${CURDIR}/songs/easy/jacob/*           ${CURDIR}/debian/jammo3-6-data/opt/jammo/songs/easy/jacob
	install ${CURDIR}/songs/easy/mary/*            ${CURDIR}/debian/jammo3-6-data/opt/jammo/songs/easy/mary
	install ${CURDIR}/songs/easy/raining/*         ${CURDIR}/debian/jammo3-6-data/opt/jammo/songs/easy/raining
	install ${CURDIR}/songs/easy/spider/*          ${CURDIR}/debian/jammo3-6-data/opt/jammo/songs/easy/spider
	install ${CURDIR}/songs/easy/spring/*          ${CURDIR}/debian/jammo3-6-data/opt/jammo/songs/easy/spring
	install ${CURDIR}/songs/easy/star/*            ${CURDIR}/debian/jammo3-6-data/opt/jammo/songs/easy/star

	#pen gesture password
	install -d ${CURDIR}/debian/jammo3-6-data/opt/jammo/password
	install ${CURDIR}/password/* ${CURDIR}/debian/jammo3-6-data/opt/jammo/password


	#Jsons
	install ${CURDIR}/jsons/*.json ${CURDIR}/debian/jammo3-6-data/opt/jammo

	#Symlink to /usr/bin (it is pointing to "/opt/jammo/jammo")
	ln -s /opt/jammo/jammo ${CURDIR}/debian/jammo3-6-data/usr/bin/jammo3_6

	#Desktop file
ifeq ($(DEB_BUILD_GNU_TYPE),arm-linux-gnueabi)
	install -d ${CURDIR}/debian/jammo3-6-data/usr/share/applications/hildon
	install ${CURDIR}/org.umsic.jammo3_6.desktop ${CURDIR}/debian/jammo3-6-data/usr/share/applications/hildon

	#Service file
	install -d ${CURDIR}/debian/jammo3-6-data/usr/share/dbus-1/services
	install ${CURDIR}/org.umsic.jammo3_6.service ${CURDIR}/debian/jammo3-6-data/usr/share/dbus-1/services
else
	install -d ${CURDIR}/debian/jammo3-6-data/usr/share/applications/
	install ${CURDIR}/org.umsic.jammo3_6.desktop ${CURDIR}/debian/jammo3-6-data/usr/share/applications/jammo3_6.desktop
endif




# 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 ChangeLog
	dh_installdocs
	dh_installexamples
#	dh_install
#	dh_installmenu
#	dh_installdebconf
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_python
#	dh_installinit
#	dh_installcron
#	dh_installinfo
	dh_installman
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
#	dh_perl
#	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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