#!/usr/bin/make -f
#
# @package      hubzero-cms
# @file         rules
# @author       Nicholas J. Kisseberth <nkissebe@purdue.edu>
# @copyright    Copyright (c) 2010-2011 Purdue University. All rights reserved.
# @license      http://www.gnu.org/licenses/lgpl-3.0.html LGPLv3
#
# Copyright (c) 2010-2011 Purdue University
# All rights reserved.
#
# This file is part of: The HUBzero(R) Platform for Scientific Collaboration
#
# The HUBzero(R) Platform for Scientific Collaboration (HUBzero) is free
# software: you can redistribute it and/or modify it under the terms of
# the GNU Lesser General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# HUBzero is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# HUBzero is a registered trademark of Purdue University.
#
# -*- 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

PACKAGE=$(shell dpkg-parsechangelog | sed -n 's/^Source: //p')
VERSION=$(shell dpkg-parsechangelog  | sed -rne 's,^Version: ([^-]+).*,\1,p')
DEBVERSION=$(shell dpkg-parsechangelog  | sed -ne 's,Version: ,,p')

include /usr/share/quilt/quilt.make

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

build: build-stamp

build-stamp: configure-stamp
	dh_testdir
	touch $@

distclean:
	rm -f hubconfiguration.php-dist HUBZERO-CREDITS.php
	rm -fr administrator components language libraries modules plugins site templates

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp
	dh_clean 

install: build
	dh_testdir
	dh_testroot
	dh_clean -k 
	dh_installdirs
	install -m 755 --owner root --group root -d $(CURDIR)/debian/hubzero-cms/etc
	install -m 755 --owner root --group root -d $(CURDIR)/debian/hubzero-cms/var
	install -m 755 --owner root --group root -d $(CURDIR)/debian/hubzero-cms/var/log
	install -m 775 --owner root --group www-data -d $(CURDIR)/debian/hubzero-cms/var/log/hubzero
	install -m 644 --owner root --group root debian/logrotate-hub-access.conf $(CURDIR)/debian/hubzero-cms/etc/logrotate-hub-access.conf
	install -m 644 --owner root --group root debian/logrotate-cmsauth.conf $(CURDIR)/debian/hubzero-cms/etc/logrotate-cmsauth.conf

# Build architecture-independent files here.
binary-indep: build install
	dh_install

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs 
	dh_installdocs
	dh_installexamples
#	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 configure
