# $Cambridge: hermes/conf/exim/etc/rpm/Makefile,v 1.5 2008/02/01 16:45:46 fanf2 Exp $ name := $(shell sed '/^Name:/!d;s/.* \([^ ]*\)/\1/' *.spec) version := $(shell sed '/^Version:/!d;s/.* \([^ ]*\)/\1/' *.spec) release := $(shell sed '/^Release:/!d;s/.* \([^ ]*\)/\1/' *.spec) cpu = noarch NVR = ${name}-${version}-${release} spec = ${name}.spec rpm = ${NVR}.${cpu}.rpm srpm = ${NVR}.src.rpm WORK = $(shell pwd)/work MACROS = ${WORK}/.rpmmacros SPEC = ${WORK}/SPECS/${name}.spec EXIM = /opt/exim/bin/exim EXIMTOP = /opt/exim RPM = ${WORK}/RPMS/${cpu}/${rpm} SRPM = ${WORK}/SRPMS/${srpm} BUILD = ${WORK}/BUILD/${name}-${version} all: ${rpm} ${srpm} ${rpm}: ${RPM} cp ${RPM} ${rpm} ${srpm}: ${SRPM} cp ${SRPM} ${srpm} ${RPM} ${SRPM}: ${SPEC} ${EXIM} HOME=${WORK} rpmbuild -ba ${SPEC} ${SPEC}: ${spec} ${MACROS} cp ${spec} ${SPEC} ${MACROS}: mkdir -p ${WORK} mkdir -p ${WORK}/{BUILD,RPMS,SOURCES,SRPMS,SPECS,tmp} mkdir -p ${WORK}/RPMS/{i386,i586,i686,noarch} rm -f ${MACROS} echo '%_topdir ${WORK}' >>${MACROS} echo '%_tmppath ${WORK}/tmp' >>${MACROS} ${EXIM}: mkdir -p ${EXIM} realclean: clean rm -rf ${rpm} ${srpm} clean: rm -rf ${WORK} if [ -d ${EXIM} -a -d ${EXIMTOP} ]; \ then rm -r ${EXIMTOP}; \ fi # eof