2 SPECFILE = $(NAME).spec
3 VERSION = $(shell rpm -q --specfile $(SPECFILE) --qf '%{VERSION}\n' | head -n 1)
4 RELEASE = $(shell rpm -q --specfile $(SPECFILE) --qf '%{RELEASE}\n' | head -n 1)
8 dist rpm: $(NAME)-$(VERSION)-$(RELEASE).rpm
10 $(NAME)-$(VERSION).tar.gz:
11 mkdir -p $(NAME)-$(VERSION)
12 rsync -av --exclude=.svn --exclude=.git --exclude=*.tar.gz --exclude=__history --exclude=$(NAME)-$(VERSION)/ ./ $(NAME)-$(VERSION)
13 tar -czf $@ $(NAME)-$(VERSION)
14 rm -fr $(NAME)-$(VERSION)
16 $(NAME)-$(VERSION)-$(RELEASE).rpm: $(NAME)-$(VERSION).tar.gz
18 rpmbuild -bb --define '_sourcedir $(PWD)' \
19 --define '_builddir $(PWD)/build' \
20 --define '_srcrpmdir $(PWD)' \
21 --define '_rpmdir $(PWD)' \
22 --define '_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \
25 srpm: $(NAME)-$(VERSION)-$(RELEASE).src.rpm
26 $(NAME)-$(VERSION)-$(RELEASE).src.rpm: $(NAME)-$(VERSION).tar.gz
27 rpmbuild -bs --define "_sourcedir $$(pwd)" \
28 --define "_srcrpmdir $$(pwd)" \
32 rm -f $(NAME)-$(VERSION).tar.gz $(NAME)-$(VERSION)-$(RELEASE).src.rpm $(NAME)-$(VERSION)-$(RELEASE).noarch.rpm