blob: be5701d48cc4192b6aae2c2a19fec441fb3ecba4 [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)
12 rsync -av --exclude=.svn --exclude=.git --exclude=*.tar.gz --exclude=$(NAME)-$(VERSION)/ ./ $(NAME)-$(VERSION)
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
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