# 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)/../.. include $(TOPDIR)/../../rhn/params.inc.mak NAME = $(shell basename $(PWD)) TMP_DIR = prebuilt-tmp PREBUILT_DIR = prebuilt-rpms PREBUILT_ATLAS_TARBALL = atlas-prebuilt.tar.bz2 RPM_BIN=$(NAME)-$(VERSION)-$(RELEASE).$(ARCH).rpm RPM_DEVEL=$(NAME)-devel-$(VERSION)-$(RELEASE).$(ARCH).rpm all: atlas_using_prebuilt # Build atlas RPM package using binaries pre-built for different # CPU architectures atlas_using_prebuilt: clean mkdir -p $(TMP_DIR) cp $(PREBUILT_DIR)/*.rpm $(TMP_DIR) @(cd $(TMP_DIR); \ for rpm in `ls *.rpm`; do \ rpm2cpio $$rpm | cpio -ivd; \ rm -f $$rpm; \ done; \ tar cjf ../$(PREBUILT_ATLAS_TARBALL) *; \ ) @make \ RPMBUILD_TARBALL="rpmbuild --define \"_topdir $(TOPDIR)\" \ --define \"_use_prebuilt_binary 1\" -tb" rpm @make atlas_src # Build atlas RPM package for current build host's CPU architecture atlas_bin: clean @make RPMBUILD_TARBALL="rpmbuild \ --define \"_topdir $(TOPDIR)\" \ -tb" rpm @make atlas_src @find $(TOPDIR)/RPMS -name $(RPM_BIN) -exec mv {} $(PREBUILT_DIR) \; @find $(TOPDIR)/RPMS -name $(RPM_DEVEL) -exec mv {} $(PREBUILT_DIR) \; @_arch=$(shell /bin/arch); \ _vendor_str=$(shell cat /proc/cpuinfo | grep -i vendor_id | head -1 | awk '{print $$3}'); \ _cpu_platform="$${_vendor_str}_$${_arch}"; \ _new_rpm_bin="$(NAME)-$${_cpu_platform}-$(VERSION)-$(RELEASE).$(ARCH).rpm"; \ _new_rpm_devel="$(NAME)-devel-$${_cpu_platform}-$(VERSION)-$(RELEASE).$(ARCH).rpm"; \ mv $(PREBUILT_DIR)/$(RPM_BIN) $(PREBUILT_DIR)/$${_new_rpm_bin}; \ mv $(PREBUILT_DIR)/$(RPM_DEVEL) $(PREBUILT_DIR)/$${_new_rpm_devel}; \ echo "Successfully built ATLAS RPM for CPU platform: $${_cpu_platform}"; \ echo "Bin RPM: $(PREBUILT_DIR)/$${_new_rpm_bin}"; \ echo "Devel RPM: $(PREBUILT_DIR)/$${_new_rpm_devel}" atlas_src: pre_clean srpm preprpm: cp make.inc.* *.bz2 *.tgz *.spec *.patch $(RPMSRCROOT) pre_clean: -rm -fr $(TMP_DIR) $(PREBUILT_ATLAS_TARBALL) clean: pre_clean -find $(TOPDIR)/RPMS -name "$(NAME)*.rpm" -exec rm -f {} \; -find $(TOPDIR)/SRPMS -name "$(NAME)*.rpm" -exec rm -f {} \;