#!/usr/bin/make -f
#
# @package      hubzero-cms-2.2
# @file         rules
# @author       Nicholas J. Kisseberth <nkissebe@purdue.edu>
# @copyright    Copyright (c) 2010-2018 HUBzero Foundation, LLC.
# @license      http://www.gnu.org/licenses/gpl-2.0.html GPLv2
#
# Copyright (c) 2010-2018 HUBzero Foundation, LLC.
#
# 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 General Public License as published by the Free Software
# Foundation, either version 2 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# HUBzero is a registered trademark of HUBzero Foundation, LLC.
#

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

$(info ########## Goals: $(MAKECMDGOALS) ##########)

CFLAGS:=$(shell dpkg-buildflags --get CFLAGS)
CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS)
LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)

export CFLAGS
export CPPFLAGS
export CXXFLAGS
export LDFLAGS

DEB_MAJOR:=$(shell lsb_release -r -s | cut -d . -f 1)

configure:
	@echo "########## configure ##########"
	dh_testdir
	>$@

build: configure
	@echo "########## build ##########"
	dh_testdir
	$(MAKE)
	>$@

clean:
	@echo "########## clean ##########"
	dh_testdir
	dh_testroot
	rm -fr build configure
	$(MAKE) clean
	dh_clean

install: build
	@echo "########## install ##########"
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	$(MAKE) DESTDIR=$(CURDIR)/debian/hubzero-cms-2.2 install

binary-indep: install
	@echo "########## binary-indep ##########"
	dh_testdir -i
	dh_testroot -i
	dh_installchangelogs -i
	dh_installdocs -i
	dh_installexamples -i
	dh_install -i
	dh_installlogrotate -i
	dh_installinit -i
	dh_installman -i
	#dh_python2 -i
	dh_link -i
	dh_strip -i
	dh_lintian -i
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_shlibdeps -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

binary-arch: install
	@echo "########## binary-arch ##########"
	dh_testdir -a
	dh_testroot -a
	dh_installchangelogs -a
	dh_installdocs -a
	dh_installexamples -a
	dh_install -a
	dh_installlogrotate -a
	dh_installinit -a
	dh_installman -a
	dh_link -a
	dh_strip -a
	dh_lintian -a
	dh_compress -a
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary: binary-indep 
#binary: binary-arch
	@echo "########## binary ##########"

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