blob: 4f99d50c9cc857ea5c64066898ac54327faf376a [file] [log] [blame]
Siobhan Tully44fd4cc2014-02-23 00:07:12 -05001NAME = opencloud
2SPECFILE = $(NAME).spec
3VERSION = $(shell rpm -q --specfile $(SPECFILE) --qf '%{VERSION}\n' | head -n 1)
4RELEASE = $(shell rpm -q --specfile $(SPECFILE) --qf '%{RELEASE}\n' | head -n 1)
5
6PWD = $(shell pwd)
7
8dist rpm: $(NAME)-$(VERSION)-$(RELEASE).rpm
9
10$(NAME)-$(VERSION).tar.gz:
11 mkdir -p $(NAME)-$(VERSION)
Scott Baker524acdb2014-03-19 23:45:49 -070012 rsync -av --exclude=.svn --exclude=.git --exclude=*.tar.gz --exclude=__history --exclude=$(NAME)-$(VERSION)/ ./ $(NAME)-$(VERSION)
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050013 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
25srpm: $(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
31clean:
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