#!/usr/bin/make -f
# CDox Debian packages rules file

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

# JAVA_HOME detection moved to the prepare target
# The name of the source package and its version (copied from the ant rules file, works quite well)
export UPSTREAM_VERSION = $(shell head -1 debian/changelog | cut -f2 -d\( | cut -f1 -d\) | cut -f1 -d\-)
export SHELL = /bin/bash

prepare:
	. misc/chkj2.sh

build: build-stamp prepare
	ant jar doc
build-stamp:
	dh_testdir
	touch build-stamp

clean: prepare
	dh_testdir
	dh_testroot
	ant clean
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	mkdirhier debian/cdox/usr/share/cdox/plugins/
	install -m755 misc/linux.sh debian/cdox/usr/bin/cdox
	install -m644 classes/cdox.jar debian/cdox/usr/share/java/cdox.jar
	install -m644 lib/yahil.jar debian/cdox/usr/share/java/yahil.jar
	install -m644 misc/cdox.xpm debian/cdox/usr/share/cdox/cdox.xpm
	install -m644 plugins/Mp3*.class debian/cdox/usr/share/cdox/plugins/

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
#	dh_installdebconf	
	dh_installdocs
	dh_installexamples
	dh_installmenu
#	dh_installemacsen
#	dh_installpam
#	dh_installinit
#	dh_installcron
	dh_installman
#	dh_installinfo
#	dh_undocumented
	dh_installchangelogs
	dh_link
	dh_compress
	dh_fixperms
	dh_installdeb
#	dh_perl
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# Build architecture-dependent files here.
binary-arch: build install
# We have nothing to do here

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