# @package      hubzero-mailgateway
# @file         Makefile
# @author       David Benham <dbenham@purdue.edu>
# @copyright    Copyright (c) 2012-2013 HUBzero Foundation, LLC.
# @license      http://www.gnu.org/licenses/lgpl-3.0.html LGPLv3
#
# Copyright (c) 2012-2013 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 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 HUBzero Foundation, LLC.
#

ETCDIR=$(DESTDIR)/etc
USRDIR=$(DESTDIR)/usr

default all build:
	@true

install:
	install --mode 0644 -D exim4/router/950_exim4-config_groupmessage  $(ETCDIR)/exim4/conf.d/router/950_exim4-config_groupmessage 
	install --mode 0644 -D exim4/router/950_exim4-config_ticketcomment  $(ETCDIR)/exim4/conf.d/router/950_exim4-config_ticketcomment
	install --mode 0644 -D exim4/router/955_exim4-config_supportmessage  $(ETCDIR)/exim4/conf.d/router/955_exim4-config_supportmessage
	install --mode 0644 -D exim4/transport/40_exim4-config_hubgroupmessage_pipe  $(ETCDIR)/exim4/conf.d/transport/40_exim4-config_hubgroupmessage_pipe
	install --mode 0644 -D exim4/transport/40_exim4-config_ticketcomment_pipe  $(ETCDIR)/exim4/conf.d/transport/40_exim4-config_ticketcomment_pipe
	install --mode 0644 -D exim4/transport/45_exim4-config_support_email_pipe  $(ETCDIR)/exim4/conf.d/transport/45_exim4-config_support_email_pipe
	install --mode 0755 -D python/mailproc.py $(USRDIR)/lib/hubzero/bin/mailproc/mailproc.py
	install --mode 0755 -D python/processgroupforumpost.py $(USRDIR)/lib/hubzero/bin/mailproc/processgroupforumpost.py
	install --mode 0755 -D python/processsupportemail.py $(USRDIR)/lib/hubzero/bin/mailproc/processsupportemail.py
	install --mode 0755 -D python/processticketcomment.py $(USRDIR)/lib/hubzero/bin/mailproc/processticketcomment.py
	install --mode 0755 -D python/filecopy.py $(USRDIR)/lib/hubzero/bin/mailproc/filecopy.py
	install --mode 0755 -D python/process_emailbounces.py $(USRDIR)/lib/hubzero/bin/mailproc/process_emailbounces.py
	install --mode 0755 -D exim4/router/975_exim4-config_emailbounces
	install --mode 0755 -D exim4/transport/exim4/transport/65_exim4-config_emailbounces_pipe

collectfiles:
	cp /etc/exim4/conf.d/router/950_exim4-config_groupmessage exim4/router/950_exim4-config_groupmessage
	cp /etc/exim4/conf.d/router/950_exim4-config_ticketcomment exim4/router/950_exim4-config_ticketcomment
	cp /etc/exim4/conf.d/router/955_exim4-config_supportmessage exim4/router/955_exim4-config_supportmessage
	cp /etc/exim4/conf.d/transport/40_exim4-config_hubgroupmessage_pipe exim4/transport/40_exim4-config_hubgroupmessage_pipe
	cp /etc/exim4/conf.d/transport/40_exim4-config_ticketcomment_pipe exim4/transport/40_exim4-config_ticketcomment_pipe
	cp /etc/exim4/conf.d/transport/45_exim4-config_support_email_pipe exim4/transport/45_exim4-config_support_email_pipe
	cp /usr/lib/hubzero/bin/mailproc/mailproc.py python/mailproc.py
	cp /usr/lib/hubzero/bin/mailproc/processgroupforumpost.py python/processgroupforumpost.py
	cp /usr/lib/hubzero/bin/mailproc/processsupportemail.py python/processsupportemail.py
	cp /usr/lib/hubzero/bin/mailproc/processticketcomment.py python/processticketcomment.py
	cp /usr/lib/hubzero/bin/mailproc/filecopy.py python/filecopy.py
	cp /etc/logrotate.d/hubmailgateway ./hubmailgateway

configure:
	install --mode 0744 --owner root --group root -D hubmailgateway /etc/logrotate.d/hubmailgateway   

clean:
	rm -f build-stamp configure-stamp
