# # Makefile for creating a source RPM out of the # internal CVS tree # # Cristian Gafton # Red Hat, Inc. # PROJECT = glibc VERSION=$(shell sed -n -e 's/^\#define VERSION \"\([^"]*\)\"/\1/p' < ../version.h) SPEC = $(PROJECT).spec RELEASE=$(shell awk '/%define glibcrelease/ { print $$3 }' $(SPEC).in) EXTRA = diff-CYGNUS-to-REDHAT.patch $(SPEC) CVSTAG = $(PROJECT)-$(subst .,-,$(VERSION))-release-$(subst .,-,$(RELEASE)) CVS_ROOT = $(shell cat CVS/Root) # How to build stuff for testing ARCH = $(shell uname -m)-redhat-linux CONFIGURE = ../../configure --prefix=/usr --enable-add-ons=yes --without-cvs $(ARCH) BUILD_FLAGS = -r all: $(SPEC) : $(SPEC).in sed -e "s|@@VERSION@@|$(VERSION)|g" < $< | \ grep -v "^%%" > $@ spec: $(SPEC) patch: CYGNUS_HEAD=`cd ..; CVSROOT=$(CVS_ROOT) cvs -Q log ChangeLog | \ sed -n 's/^.*\(cygnus-[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\).*$$/\1/p' \ | sort -u | tail -1`; \ ( cd ..; CVSROOT=$(CVS_ROOT) cvs diff -upN -r $$CYGNUS_HEAD -r $(CVSTAG) ) 2>&1 | \ awk -v PROJVER=$(PROJECT)-$(VERSION) -f makepatch.awk > diff-CYGNUS-to-REDHAT.patch ; \ if [ $$? -gt 1 ] ; then \ exit 1 ; \ fi commit: cd .. ; CVSROOT=$(CVS_ROOT) cvs -q commit -m "Prepare to comit for releasing $(CVSTAG)" archive: clean spec commit @rm -f $(PROJECT)-$(VERSION).tar.bz2 cd .. ; CVSROOT=$(CVS_ROOT) cvs -q tag -F $(CVSTAG) . $(MAKE) patch @rm -rf /tmp/$(PROJECT)-$(VERSION) cd /tmp; CVSROOT=$(CVS_ROOT) cvs -Q export -r$(CVSTAG) -d $(PROJECT)-$(VERSION) $(PROJECT) install -m 644 $(EXTRA) /tmp/$(PROJECT)-$(VERSION) dir=$$PWD; cd /tmp; tar cf - $(PROJECT)-$(VERSION) | bzip2 -9 > $$dir/$(PROJECT)-$(VERSION).tar.bz2 @rm -rf /tmp/$(PROJECT)-$(VERSION) @echo "The archive is in $(PROJECT)-$(VERSION).tar.bz2" rpm: $(SPEC) $(PROJECT)-$(VERSION).tar.bz2 @rpm --nodeps -bs --define '_sourcedir '`pwd` --define '_specdir '`pwd` --define '_srcrpmdir '`pwd` $(SPEC) @echo "The source RPM is in $(PROJECT)-$(VERSION)-$(RELEASE).src.rpm" update: rm -rf glibc-import cvs -z9 -d :pserver:anoncvs@anoncvs.cygnus.com:/cvs/glibc export -d glibc-import -r HEAD libc 2>&1 | tee export.log [ -d glibc-import ] || exit 1 find glibc-import -name .cvsignore | xargs rm -f cd glibc-import; cvs -z9 -d $(CVS_ROOT) import -m "Sync with Cygnus" -I! glibc cygnus cygnus-2001-`date +'%m-%d'` 2>&1 | tee ../import.log cd ..; cvs update -Pd -jcygnus:yesterday -jcygnus 2>&1 | tee redhat/update.log clean: @rm -fv *~ @rm -fv $(EXTRA) @rm -fv glibc-*.tar.bz2 @rm -fv glibc-*.src.rpm distclean: clean @rm -rf {export,import,update}.log glibc-import build-dir: -mkdir build root-dir: -mkdir root build/config.status build/Makefile: build-dir cd build ; $(CONFIGURE) configure: build/config.status build/Makefile build: configure make $(BUILD_FLAGS) -C build install: root-dir build-dir make install -C build install_root=$$PWD/root $(MAKE) install-locales install-locales: make install-locales -C ../localedata install_root=$$PWD/root objdir=$$PWD/build install-real: build-dir make install -C build $(MAKE) install-locales-real install-locales-real: make install-locales -C ../localedata objdir=$$PWD/build