Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 1 | NAME = opencloud |
| 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) |
| 5 | |
| 6 | PWD = $(shell pwd) |
| 7 | |
| 8 | dist rpm: $(NAME)-$(VERSION)-$(RELEASE).rpm |
| 9 | |
| 10 | $(NAME)-$(VERSION).tar.gz: |
| 11 | mkdir -p $(NAME)-$(VERSION) |
Scott Baker | 524acdb | 2014-03-19 23:45:49 -0700 | [diff] [blame] | 12 | rsync -av --exclude=.svn --exclude=.git --exclude=*.tar.gz --exclude=__history --exclude=$(NAME)-$(VERSION)/ ./ $(NAME)-$(VERSION) |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 13 | tar -czf $@ $(NAME)-$(VERSION) |
| 14 | rm -fr $(NAME)-$(VERSION) |
| 15 | |
| 16 | $(NAME)-$(VERSION)-$(RELEASE).rpm: $(NAME)-$(VERSION).tar.gz |
| 17 | mkdir -p build |
| 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' \ |
| 23 | $(SPECFILE) |
| 24 | |
| 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)" \ |
| 29 | $(SPECFILE) |
| 30 | |
| 31 | clean: |
| 32 | rm -f $(NAME)-$(VERSION).tar.gz $(NAME)-$(VERSION)-$(RELEASE).src.rpm $(NAME)-$(VERSION)-$(RELEASE).noarch.rpm |
| 33 | rm -rf build |
| 34 | |
| 35 | .PHONY: dist |
| 36 | |