#!/usr/bin/make -f
#
# This file is public domain software, originally written by Joey Hess.
#
# This file is part of adduser-ng package
#
# $Id: s.rules 1.18 03/11/04 20:27:52+01:00 robert@zaron.debian.pl $



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

#
# PACKAGES
#

# this packages will be made
adduser_package=adduser-ng
pluginloader_package=libadduser-pluginloader-perl
cdk_package=adduser-ui-cdk
quota_package=adduser-plugin-quota
eximconf_package=adduser-plugin-eximconf
eximconf4_package=adduser-plugin-eximconf4
notifyjabber_package=adduser-plugin-notifyjabber
cvsaccess_package=adduser-plugin-cvsaccess

# docs packages
doc_user=adduser-ng-doc
doc_devel=adduser-ng-doc-devel


build: build-stamp
build-stamp:
	dh_testdir
	
	$(MAKE) generate_docs

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp

	$(MAKE) CONFIG_PREFIX=debian/$(adduser_package) clean

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	$(MAKE) PREFIX=debian/$(adduser_package)/usr CONFIG_PREFIX=debian/$(adduser_package) PACKAGE=adduser-ng install_adduser install_adduser
	# fix the config file location
	perl -i -pe 's#debian/$(adduser_package)/etc/adduser-ng/adduser-ng.conf#/etc/adduser-ng/adduser-ng.conf#' debian/$(adduser_package)/usr/sbin/adduser-ng
	$(MAKE) PREFIX=debian/$(pluginloader_package)/usr PACKAGE=libadduser-pluginloader-perl install_pluginloader
	$(MAKE) PREFIX=debian/$(cdk_package)/usr PACKAGE=adduser-ui-cdk install_uicdk
	$(MAKE) PREFIX=debian/$(quota_package)/usr PACKAGE=adduser-plugin-quota install_pluginquota
	$(MAKE) PREFIX=debian/$(notifyjabber_package)/usr PACKAGE=adduser-plugin-notifyjabber install_pluginnotifyjabber
	$(MAKE) PREFIX=debian/$(cvsaccess_package)/usr PACKAGE=adduser-plugin-cvsaccess install_plugincvsaccess
	$(MAKE) PREFIX=debian/$(eximconf_package)/usr PACKAGE=adduser-plugin-eximconf install_plugineximconf
	$(MAKE) PREFIX=debian/$(eximconf4_package)/usr PACKAGE=adduser-plugin-eximconf4 install_plugineximconf4

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_installexamples
#	dh_installmenu
#	dh_installdebconf
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installcatalogs
#	dh_installpam
#	dh_installmime
#	dh_installinit
#	dh_installcron
#	dh_installman
#	dh_installinfo
	dh_installman Docs/adduser-ng.8 Docs/adduser-ng.pl.8
	dh_link
	dh_compress -X.xml
	dh_fixperms
	dh_perl lib/AddUser/ lib/AddUser/UI/
#	dh_python
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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

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