412b024
# Makefile for source rpm: systemtap
2cbbd71
# $Id: Makefile,v 1.7 2006/05/05 22:12:26 fche Exp $
412b024
NAME := systemtap
412b024
SPECFILE = $(firstword $(wildcard *.spec))
412b024
412b024
include ../common/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