# 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) #PREBUILT_ROOT_DIR=/home/mbozzore/compile_temp/OFED/test2/OFED-1.4-rc2/RPMS/redhat-release-5Server-5.2.0.4/ 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 @if [ -n "${PREBUILT_ROOT_DIR}" ]; then \ echo "env set properly" ; \ echo "Copying pre-built OFED Packages..."; \ if [ -d $(PREBUILT_ROOT_DIR)/noarch/ ] ; then \ cp $(PREBUILT_ROOT_DIR)/noarch/*.rpm $(TOPDIR)/RPMS/noarch; \ fi ;\ echo "rpmbuild --define "_topdir $(TOPDIR)" -bb $(SPECFILE)" ; \ rpmbuild --define "_topdir $(TOPDIR)" -bb $(SPECFILE) ; \ cp $(PREBUILT_ROOT_DIR)/x86_64/*.rpm $(TOPDIR)/RPMS/x86_64; \ else \ echo "Building OFED Packages (This will take a while...)"; \ echo "untar the distro"; \ tar ${TARARGS} ${SRCFILE} ; \ echo "copy over the new ofed.conf" ; \ cp ofed.conf ${OFEDDIR} ; \ echo "backup source tarball" ; \ mv ${SRCFILE} backup ; \ echo "update release numbers" ; \ ./update_release.sh ; \ echo "put the new SRPMS in place" ; \ mv ${OFEDDIR}/SRPMS ${OFEDDIR}/SRPMS.ofed ; \ mv temp/SRPMS ${OFEDDIR}/SRPMS ; \ mv backup ${SRCFILE} ; \ echo "create the ofed-src rpm" ; \ echo "rpmbuild --define "_topdir $(TOPDIR)" -bb $(SPECFILE)" ; \ 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