#!/usr/bin/make -f
# -*- makefile -*-
# debian/rules file to build GOsa packages.
#
# 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

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

configure: configure-stamp
configure-stamp:
	dh_testdir
	touch configure-stamp

build: patch build-indep
        #*************************************************
        #* Building GOsa into a Debian/GNU Linux Package *
        #*                please stand by                *
        #*************************************************


build-indep: build-indep-stamp
build-indep-stamp: configure-stamp 
	touch $@

clean: clean-patched unpatch
clean-patched:
	dh_testdir
	dh_testroot
	rm -f build-indep-stamp configure-stamp

	dh_clean

unpatch:
	dpatch deapply-all
	rm -rf patch-stamp debian/patched

install: install-indep
install-indep:
	dh_testdir
	dh_testroot
	dh_clean -k -i 
	dh_installdirs -i
	dh_install -i --exclude COPYING

binary-common:
	dh_testdir
	dh_testroot
	install -D -m 644 debian/gosa.lintian-overrides debian/gosa/usr/share/lintian/overrides/gosa
	dh_installchangelogs Changelog
	dh_installdocs
	dh_installexamples
	dh_installmenu
	dh_installdebconf	
	dh_installman
	rm -rf debian/gosa/usr/share/gosa/include/smarty
	dh_strip
	dh_desktop
	dh_compress
	# This is an ugly workaround to preserve gosa.conf from beeing compressed. Excluding it
	# above does not work, because the manual page will match the expression, too.
	gzip -d debian/gosa/usr/share/doc/gosa/gosa.conf.gz
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

patch: patch-stamp
patch-stamp:
	dpatch apply-all
	dpatch cat-all >patch-stamp

binary-indep: build-indep install-indep
	$(MAKE) -f debian/rules DH_OPTIONS=-i binary-common

binary: binary-indep

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