################################################################################
# Filename: ./src/base/etc/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:
################################################################################
#
# etc directory Makefile
#

OUTDIR ?= ../../../out
INSTALL_FILES := my.cnf, qrm*, -m 0700 init.d, templates/linuxrc
INSTALL_FILES_DEST := $(OUTDIR)/qrm/etc
INSTALL_FILES_IGNORE := .cvsignore

INC_NAME := ../Makefile.inc
include $(INC_NAME)

all:	check
	@echo "preparing the source files in etc directory"
	chmod +x templates/qrm-create-initrd-template
	./templates/qrm-create-initrd-template

$(OUTDIR)/qrm/etc/templates/initrd-qrm.tgz: $(QRM_ROOT_DIR)/initrd-qrm.tgz
	$(INSTALL) $< $@

install: $(OUTDIR)/qrm/etc/templates/initrd-qrm.tgz

clean:	check
	@echo "cleaning up etc directory"
	/bin/rm -f templates/initrd-qrm.tgz
	/bin/rm -rf $(OUTDIR)/qrm/etc

realclean: clean
	@echo "running realclean for the etc directory"
	/bin/rm -rf $(QRM_CACHE_DIR)/src/busybox-* \
		$(QRM_CACHE_DIR)/src/ddcxinfo-knoppix* \
		$(QRM_CACHE_DIR)/src/hwdata-* \
		$(QRM_CACHE_DIR)/src/hwsetup-* \
		$(QRM_CACHE_DIR)/src/kudzu-* \
		$(QRM_CACHE_DIR)/src/xf86config-* \
		$(QRM_CACHE_DIR)/busybox \
		$(QRM_CACHE_DIR)/ddcxinfo \
		$(QRM_CACHE_DIR)/hwdata \
		$(QRM_CACHE_DIR)/hwsetup \
		$(QRM_CACHE_DIR)/kudzu \
		$(QRM_CACHE_DIR)/initrd \
		$(QRM_ROOT_DIR)/build/busybox \
		$(QRM_ROOT_DIR)/build/ddcxinfo \
		$(QRM_ROOT_DIR)/build/hwdata \
		$(QRM_ROOT_DIR)/build/hwsetup \
		$(QRM_ROOT_DIR)/build/kudzu



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

	
