Roland McGrath 8890358
patches := $(patsubst %,elfutils-%.patch,robustify portability)
Roland McGrath 8890358
Roland McGrath 8890358
.PHONY: patches
Roland McGrath 8890358
patches: $(patches)
Roland McGrath 8890358
Roland McGrath 8890358
branch-portability = portable
Roland McGrath 8890358
Roland McGrath 8890358
FORCE:;
Roland McGrath 8890358
Roland McGrath 8890358
elfutils.git ?= ${HOME}/redhat/stock-elfutils/.git
Roland McGrath 8890358
git-heads := $(wildcard $(elfutils.git)/refs/heads/*)
Roland McGrath 8890358
ifneq (,$(git-heads))
Roland McGrath 8890358
git-dir = git --git-dir=$(elfutils.git)
Roland McGrath 8890358
git-archive = $(git-dir) archive
Roland McGrath 8890358
get-master = master=`$(git-dir) merge-base origin/master $$branch` && \
Roland McGrath 8890358
	     master=`$(git-dir) describe --tags --always $$master`
Roland McGrath 8890358
else
Roland McGrath 8890358
git-heads = FORCE
Roland McGrath 8890358
git-archive = git archive --remote=git://git.fedorahosted.org/git/elfutils.git
Roland McGrath 8890358
get-master = master=master
Roland McGrath 8890358
endif
Roland McGrath 8890358
Roland McGrath 8890358
git-%/configure: Makefile $(git-heads)
Roland McGrath 8890358
	@rm -rf $(@D)
Roland McGrath 8890358
	$(git-archive) --prefix=$(@D)/ $(firstword $(branch-$*) $*) | tar xf -
Roland McGrath 8890358
	cd $(@D) && autoreconf -i && rm -rf autom4te.cache
Roland McGrath 8890358
Roland McGrath 8890358
elfutils-%.patch: git-%/configure
Roland McGrath 8890358
	branch=$(firstword $(branch-$*) $*); \
Roland McGrath 8890358
	$(get-master) && \
Roland McGrath 8890358
	(set -x; $(MAKE) git-$$master/configure) && \
Roland McGrath 8890358
	(set -x; diff --exclude='.gitignore' -Nrpu git-$$master $(
Roland McGrath 8890358
	filterdiff --remove-timestamps --strip=1 --addprefix=elfutils/ > $@.new
Roland McGrath 8890358
	mv $@.new $@
Roland McGrath 8890358
Roland McGrath 8890358
elfutils-portable.spec: elfutils.spec
Roland McGrath 8890358
	(echo '%define _with_compat 1'; sed 's/ check$$/& || :/' $<) > $@.new
Roland McGrath 8890358
	mv -f $@.new $@
Roland McGrath 8890358
Roland McGrath 8890358
rpmbuild-dirs = $(foreach what,source spec srcrpm,--define '_$(what)dir .')
Roland McGrath 8890358
Roland McGrath 8890358
.PHONY: portable-srpm
Roland McGrath 8890358
portable-srpm: elfutils-portable.spec $(patches) sources
Roland McGrath 8890358
	rpmbuild-md5 $(rpmbuild-dirs) -bs $<