#!/usr/bin/make -f 
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.
#
# Modified to make a template file for a multi-binary package with separated
# build-arch and build-indep targets  by Bill Allombert 2001

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

# This has to be exported to make some magic below work.
export DH_OPTIONS

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

#GCC4_ICES_HERE := arm m68k hppa
DEB_HOST_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)

###############
# BUILD PHASE #
###############
build: build-indep

build-indep:

###############
# CLEAN PHASE #
###############
clean:
	dh_testdir
	dh_testroot
	rm -f *-stamp
	dh_clean

#################
# INSTALL PHASE #
#################
install: install-indep

install-indep: install-indep-stamp
install-indep-stamp: build-indep
	dh_testdir
	dh_testroot
	dh_prep -i
	dh_installdirs -i
	
	# Common files

	mkdir -p debian/celestia-common-nonfree/usr/share/celestia/textures
	mkdir -p debian/celestia-common-nonfree/usr/share/celestia
	cp -r textures models debian/celestia-common-nonfree/usr/share/celestia/

	touch install-indep-stamp
	
################
# BINARY PHASE #
################
# Must not depend on anything. This is to be called by
# binary-arch/binary-multi
# in another 'make' thread.
binary-common:
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
#	dh_desktop
#	dh_icons
#	dh_installexamples
#	dh_installmenu
#	dh_installdebconf
#	dh_installinfo
#	dh_installman
#	dh_gconf
#	dh_link
#	dh_strip
	dh_compress -X.docbook
	dh_fixperms
	dh_shlibdeps
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# Build architecture independant packages using the common target.
binary-indep: install-indep
	$(MAKE) -f debian/rules DH_OPTIONS=-i binary-common

binary: binary-indep
.PHONY: build clean binary-indep binary-arch config config-glut config-gnome config-kde build-glut build-gnome build-kde build-indep build-arch build binary install install-indep install-arch 
