# Copyright (C) 2007 Platform Computing Inc # # This program is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. # # This program 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, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # # $Id$ # NAME = nagios TOPDIR = $(PWD) ARCH = $(shell arch) RPMS = `find $(TOPDIR)/RPMS/ -type f |grep -v '.svn'` TMPDIR = /tmp SPECFILE = $(PWD)/kit-nagios.spec TARREV = 3 KITTARFILENAME = kit-$(NAME)-$(VERSION).$(TARREV).tar.gz SRPMS=\ SRPMS/component-nagios-installer \ SRPMS/component-nagios-compute \ SRPMS/kusu-nagios-config \ SRPMS/kusu-nrpe-config \ SRPMS/kit-nagios ifdef KUSU_BUILD_DIST KUSU_DISTRO_NAME=$(KUSU_BUILD_DIST) endif ifeq ($(KUSU_DISTRO_NAME), centos) NAGIOS_OS_NAME=rhelfamily endif ifeq ($(KUSU_DISTRO_NAME), rhel) NAGIOS_OS_NAME=rhelfamily endif ifndef NAGIOS_OS_NAME NAGIOS_OS_NAME=$(KUSU_DISTRO_NAME) endif ifdef KUSU_BUILD_DISTVER KUSU_DISTRO_VERSION=$(KUSU_BUILD_DISTVER) else KUSU_DISTRO_VERSION='*' endif ifdef KUSU_BUILD_ARCH KUSU_DISTRO_ARCH=$(KUSU_BUILD_ARCH) else KUSU_DISTRO_ARCH='*' endif KIT_VERSION = 2.12 KIT_RELEASE = 6 all: packages components kit include ../../rhn/params.inc.mak packages: ( cd packages; $(MAKE) ) components: ( cd components; $(MAKE) ) kitinfo: @sed -e 's%$${NAGIOS_OS_NAME}%$(NAGIOS_OS_NAME)%g' \ -e 's%$${KUSU_DISTRO_VERSION}%$(KUSU_DISTRO_VERSION)%g' \ -e 's%$${KUSU_DISTRO_ARCH}%$(KUSU_DISTRO_ARCH)%g' \ -e 's%$${KIT_VERSION}%$(KIT_VERSION)%g' \ -e 's%$${KIT_RELEASE}%$(KIT_RELEASE)%g' \ kitinfo.in > kitinfo nagios-kit: rpmdirs kitinfo rm -rf /tmp/$(NAME)-build && mkdir -p /tmp/$(NAME)-build/$(NAME) rsync -a ./docs ./plugins /tmp/$(NAME)-build/$(NAME) --exclude .svn/ --exclude *.pyc cp kit-nagios.spec /tmp/$(NAME)-build cp kitinfo /tmp/$(NAME)-build/$(NAME) ( cd /tmp/$(NAME)-build; tar czf /tmp/$(KITTARFILENAME) . ) $(RPMBUILD) -ta /tmp/$(KITTARFILENAME) rm -rf /tmp/$(NAME)-build /tmp/$(KITTARFILENAME) kit: nagios-kit mkdir -p $(TMPDIR)/disk1/$(NAME) cd $(TMPDIR)/disk1/$(NAME) ; \ for i in $(RPMS); do ln -sf $$i; done mkisofs -quiet -V "Nagios(R) Kit" -r -T -f -o kit-$(NAME)-$(VERSION)-$(RELEASE).$(ARCH).iso $(TMPDIR)/disk1 rm -rf $(TMPDIR)/disk1 clean: -( cd components && make clean ) -( cd packages && make clean ) for srpm in $(SRPMS); do rm -f $$srpm*; done rm -rf $(TOPDIR)/RPMS/noarch rm -rf $(TOPDIR)/SOURCES $(TOPDIR)/SPECS $(TOPDIR)/BUILD rm -rf $(TOPDIR)/disk1 rm -rf kit-*.iso rm -rf /tmp/$(NAME)-build /tmp/$(NAME)-$(VERSION).tar.gz rm -rf SRPMS/* .PHONY: components packages