################################################################################
# Filename: ./src/plugins/win/Makefile
# 
# The contents of this file are subject to the Qlusters Public License
# Version 1.1 (the License); you may not use this file except in compliance
# with the License.
# You may obtain a copy of the License at
# http://www.openqrm.org/content/view/33/69/.
# 
# Software distributed under the License is distributed on an AS IS basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
# the specific language governing rights and limitations under the License.
# 
# The Original Code is openQRM.
# 
# The Initial Developer of the Original Code is Qlusters Corporation. Portions
# created by Qlusters Corporation are Copyright (C) 2003-2005. All Rights
# Reserved.
# 
# Contributor(s):
# 
# Description:
# 
# Comments:
################################################################################
#
# Qrm win Makefile
#

ifndef SOURCEDDIR
	export SOURCEDDIR=../..
endif

ifndef OUTDIR
	export OUTDIR=../../../out/
endif

QRM_CACHE_DIR=$(shell $(SOURCEDDIR)/make_helper get_cache_dir)
QRM_ROOT_DIR=$(shell $(SOURCEDDIR)/make_helper get_root_dir)


all:	check
	@echo "Getting the qrminfod-win32"
	QRM_INFOD_PACKAGE=`$(SOURCEDDIR)/make_helper qrm_cache URL qrminfod-win32.exe http://ny.qlusters.com/qrm_pkgs/qrminfod-win32.exe`
	if [ "$QRM_INFOD_PACKAGE" == "UNSUCCESSFULL" ]; then	\
		echo "ERROR: Could not download Qrm-component qrminfod-win32";	\
		exit 1;		\
	fi

install:
	@echo "installing win for Qrm"
	mkdir -p $(OUTDIR)/qrm/plugins/win/install
	/bin/cp -f $(QRM_CACHE_DIR)/src/qrminfod-win32.exe $(OUTDIR)/qrm/plugins/win/install/
	/bin/cp -f $(SOURCEDDIR)/plugins/win/README $(OUTDIR)/qrm/plugins/win/
	mkdir -p $(OUTDIR)/qrm/plugins/win/etc
	/bin/cp -u etc/*.ini $(OUTDIR)/qrm/plugins/win/etc
	mkdir -p $(OUTDIR)/qrm/plugins/win/include
	/bin/cp -u include/*-functions $(OUTDIR)/qrm/plugins/win/include
	mkdir -p $(OUTDIR)/qrm/plugins/win/doc
	/bin/cp -ur doc/*.txt $(OUTDIR)/qrm/plugins/win/doc/

clean:	check
	@echo "cleaning up win"
	/bin/rm -rf $(OUTDIR)/qrm/plugins/win

realclean: clean
	@echo "running realclean for the win-plugin"
	/bin/rm -f $(QRM_CACHE_DIR)/src/QRMinfod-win32.exe

check:
	@if [ -z $(QRM_CACHE_DIR) ]; then echo "ERROR: QRM_CACHE_DIR not set!"; exit 1; fi
	@if [ -z $(QRM_ROOT_DIR) ]; then echo "ERROR: QRM_ROOT_DIR not set!"; exit 1; fi





