SUBDIRS = builder client common server utils DESTDIR = '/' PKGNAME = plague VERSION=$(shell awk '/Version:/ { print $$2 }' ${PKGNAME}.spec) RELEASE=$(shell awk '/Release:/ { print $$2 }' ${PKGNAME}.spec) CVSTAG=$(PKGNAME)-$(subst .,_,$(VERSION)-$(RELEASE)) CVSDATE=`date +%Y%m%d` all: subdirs clean: for d in $(SUBDIRS); do make -C $$d clean ; done distclean: clean rm -rf dist build rm -f *.tar.bz2 subdirs: for d in $(SUBDIRS); do make -C $$d; [ $$? = 0 ] || exit 1 ; done install: mkdir -p $(DESTDIR) for d in $(SUBDIRS); do make DESTDIR=`cd $(DESTDIR); pwd` PKGNAME=$(PKGNAME) -C $$d install; [ $$? = 0 ] || exit 1; done archive: @rm -rf ${PKGNAME}-$(VERSION).tar.bz2 @rm -rf /tmp/${PKGNAME}-$(VERSION) /tmp/${PKGNAME} @dir=$$PWD; cd /tmp; cp -a $$dir ${PKGNAME} @rm -f /tmp/${PKGNAME}/${PKGNAME}-daily.spec @rm -rf /tmp/${PKGNAME}/build @rm -rf /tmp/${PKGNAME}/dist @rm -rf /tmp/${PKGNAME}/builder/certs @rm -rf /tmp/${PKGNAME}/client/certs @rm -rf /tmp/${PKGNAME}/server/certs @rm -rf /tmp/${PKGNAME}/utils/pushscript @rm -rf `find /tmp/${PKGNAME} -name "CVS" | xargs` @rm -f `find /tmp/${PKGNAME} -name ".#*" | xargs` @rm -f `find /tmp/${PKGNAME} -name ".cvsignore" | xargs` @rm -rf `find /tmp/${PKGNAME} -name "*.pyc" | xargs` @rm -rf `find /tmp/${PKGNAME} -name "*.py.*" | xargs` @mv /tmp/${PKGNAME} /tmp/${PKGNAME}-$(VERSION) @dir=$$PWD; cd /tmp; tar cvjf $$dir/${PKGNAME}-$(VERSION).tar.bz2 ${PKGNAME}-$(VERSION) @rm -rf /tmp/${PKGNAME}-$(VERSION) @echo "The archive is in ${PKGNAME}-$(VERSION).tar.bz2" rpm: archive rm -rf build dist mkdir build dist rpmbuild --define "CVSDATE $(CVSDATE)" --define "_sourcedir $(PWD)" --define "_builddir $(PWD)/build" --define "_srcrpmdir $(PWD)/dist" --define "_rpmdir $(PWD)/dist" -ba $(PKGNAME).spec test-srpm: archive rm -rf build dist mkdir build dist rpmbuild --define "_sourcedir $(PWD)" --define "_builddir $(PWD)/build" --define "_srcrpmdir $(PWD)/dist" --define "_rpmdir $(PWD)/dist" -bs $(PKGNAME).spec