# 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$ # TOPDIR = $(PWD)/../.. SPECFILE=ofed-src.spec VERSION=$(shell rpm -q --specfile $(SPECFILE) --queryformat "%{version}\n") SRCNAME=$(shell grep "define OFEDSRC" $(SPECFILE) | awk '{print $$3}') OFEDDIR=$(shell basename $(SRCNAME) .tgz) SRCDIR=$(PWD)/ SRCFILE=$(SRCDIR)/$(SRCNAME) TARARGS=zxf PREBUILT_ROOT_DIR=/pcc/lsf_madison/Emerald/kit-source/platform-ofed/$(VERSION) define check_prequisites echo "Checking build requirements..." rpm -q bison || exit 1 rpm -q flex || exit 1 rpm -q gcc || exit 1 rpm -q gcc-c++ || exit 1 rpm -q glibc-devel || exit 1 rpm -q kernel-devel || exit 1 rpm -q libstdc++ || exit 1 rpm -q libstdc++-devel || exit 1 rpm -q libtool || exit 1 rpm -q pciutils-devel || exit 1 rpm -q sysfsutils || exit 1 rpm -q tcl || exit 1 rpm -q tcl-devel || exit 1 rpm -q tk || exit 1 rpm -q zlib-devel || exit 1 endef default: rpm rpm: $(TOPDIR)/BUILD $(TOPDIR)/RPMS/noarch $(TOPDIR)/RPMS/x86_64 @$(call check_prequisites) @if [ -d $(PREBUILT_ROOT_DIR) ]; then \ echo "Copying pre-built OFED Packages..."; \ cp $(PREBUILT_ROOT_DIR)/noarch/*.rpm $(TOPDIR)/RPMS/noarch; \ cp $(PREBUILT_ROOT_DIR)/x86_64/*.rpm $(TOPDIR)/RPMS/x86_64; \ else \ echo "Building OFED Packages (This will take a while...)"; \ tar ${TARARGS} ${SRCFILE} ; \ cp ofed.conf ${OFEDDIR} ; \ exit 0 ; \ rpmbuild --define "_topdir $(TOPDIR)" -bb $(SPECFILE) ; \ cd ${OFEDDIR} ;./install.pl -c ofed.conf ; \ mv -v RPMS/*/*.rpm ../../../RPMS/x86_64; \ fi $(TOPDIR)/BUILD: mkdir $(TOPDIR)/BUILD $(TOPDIR)/RPMS/noarch: mkdir -p $(TOPDIR)/RPMS/noarch $(TOPDIR)/RPMS/x86_64: mkdir -p $(TOPDIR)/RPMS/x86_64 rpmsrc: tar ${TARARGS} ${SRCFILE} cp ofed.conf ${OFEDDIR} ; clean:: @echo "Cleaning OFED Packages...." -@rm -rfv RPMS/* @if [ -d ${OFEDDIR} ]; then \ rm -rf ${OFEDDIR} ; \ fi