412b024
# Makefile for source rpm: systemtap
32e19e8
# $Id: Makefile,v 1.2 2006/07/19 22:31:35 roland Exp $
412b024
NAME := systemtap
412b024
SPECFILE = $(firstword $(wildcard *.spec))
412b024
32e19e8
define find-makefile-common
32e19e8
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
32e19e8
endef
32e19e8
32e19e8
MAKEFILE_COMMON := $(shell $(find-makefile-common))
32e19e8
32e19e8
ifeq ($(MAKEFILE_COMMON),)
32e19e8
# attempt a checkout
32e19e8
define checkout-makefile-common
32e19e8
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
32e19e8
endef
32e19e8
32e19e8
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
32e19e8
endif
32e19e8
32e19e8
include $(MAKEFILE_COMMON)
2cbbd71
2cbbd71
tarball = systemtap-$(VERSION).tar.gz
2cbbd71
2cbbd71
ifeq ($(clobber),t)
2cbbd71
commit-check = :
2cbbd71
else
2cbbd71
commit-check = cvs -Q diff --brief > /dev/null 2>&1
2cbbd71
endif
2cbbd71
2cbbd71
elfutils-version := $(shell awk '$$2 == "elfutils_version" { print $$3 }' \
2cbbd71
				systemtap.spec)
2cbbd71
eu-dir = ../../elfutils/devel
2cbbd71
$(eu-dir)/elfutils.spec: FORCE
2cbbd71
	cd $(@D) && cvs -Q update && $(commit-check)
2cbbd71
$(eu-dir)/%.tar.gz: $(eu-dir)/elfutils.spec
2cbbd71
	$(MAKE) -C $(@D) sources
2cbbd71
$(eu-dir)/%.patch: $(eu-dir)/elfutils.spec ;
2cbbd71
2cbbd71
import-systemtap: $(tarball)
2cbbd71
	$(commit-check) systemtap.spec
2cbbd71
	tar -zf $(tarball) -xO '*.spec' > systemtap.spec
2cbbd71
	$(MAKE) upload-systemtap
2cbbd71
	touch $@
2cbbd71
2cbbd71
upload-systemtap: $(tarball) \
2cbbd71
		  $(addprefix $(eu-dir)/,\
2cbbd71
					 elfutils-$(elfutils-version).tar.gz \
2cbbd71
					 elfutils-portability.patch)
2cbbd71
	ln -f $(filter $(eu-dir)/%.tar.gz,$^) .
2cbbd71
	ln -f $(filter $(eu-dir)/%.patch,$^) .
2cbbd71
	$(MAKE) new-source FILES='$(filter-out %.patch,$^)'
2cbbd71
2cbbd71
copy-sources-%: import-systemtap
2cbbd71
	cd ../$* && $(commit-check)
2cbbd71
	cp -f sources elfutils-portability.patch ../$*
2cbbd71
	ln -f elfutils-*.tar.gz $(tarball) ../$*
2cbbd71
2cbbd71
propagate-%: copy-sources-%
2cbbd71
	cp -f systemtap.spec ../$*
2cbbd71
	touch $@
2cbbd71
2cbbd71
# No automagic macros in beehive, only brew.
2cbbd71
propagate-RHEL-4: copy-sources-RHEL-4 ../RHEL-4/systemtap.spec
2cbbd71
	touch $@
2cbbd71
propagate-FC-4: copy-sources-FC-4 ../FC-4/systemtap.spec
2cbbd71
	touch $@
2cbbd71
2cbbd71
../RHEL-4/systemtap.spec: systemtap.spec import-systemtap
2cbbd71
	@rm -f $@.new
2cbbd71
	(echo '%define dist .el4'; \
2cbbd71
	 echo '%define rhel 4'; \
2cbbd71
	 cat systemtap.spec) > $@.new
2cbbd71
	mv -f $@.new $@
2cbbd71
../FC-4/systemtap.spec: systemtap.spec import-systemtap
2cbbd71
	@rm -f $@.new
2cbbd71
	(echo '%define dist .fc4'; \
2cbbd71
	 echo '%define fedora 4'; \
2cbbd71
	 cat systemtap.spec) > $@.new
2cbbd71
	mv -f $@.new $@
2cbbd71
2cbbd71
.PRECIOUS: propagate-% tag-%
2cbbd71
2cbbd71
commit-%: propagate-%
2cbbd71
	cd ../$* && cvs commit -m'Automatic update to $(VERSION)'
2cbbd71
	touch $@
2cbbd71
2cbbd71
tag-%: commit-%
2cbbd71
	cd ../$* && $(MAKE) tag
2cbbd71
	touch $@
2cbbd71
2cbbd71
build-%: tag-%
2cbbd71
	cd ../$* && $(MAKE) build