-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
41 lines (33 loc) · 1.54 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#+++############################################################################
# #
# RPMs building #
# #
#---############################################################################
TOP := $(dir $(lastword $(MAKEFILE_LIST)))
NAME := $(shell basename ${TOP}/*.spec .spec)
VERSION := $(shell egrep '^Version:' ${TOP}/${NAME}.spec | sed 's/^Version:\s*//')
RELEASE := ${NAME}-${VERSION}
rpmtopdir := $(shell rpm --eval %_topdir)
rpmbuild := $(shell [ -x /usr/bin/rpmbuild ] && echo rpmbuild || echo rpm)
git := git
#
# define DIST for non-default build dists (e.g. make DIST=.slc6 rpm)
# ... or export DIST=.slc6 ; make rpm
#
DIST ?= $(shell rpm --eval %dist)
all: srpm
dist: clean
@(cd src && git archive --format=tar --prefix=$(NAME)-$(VERSION)/ $(VERSION)) \
| gzip > $(NAME)-$(VERSION).tgz
@(cd config-src && git archive --format=tar --prefix=config/ $(VERSION)) \
| gzip > $(NAME)-config-$(VERSION).tgz
@(cd SELinux && git archive --format=tar --prefix=SELinux/ $(VERSION)) \
| gzip > $(NAME)-selinux-$(VERSION).tgz
srpm: dist
$(rpmbuild) --define "dist $(DIST)" --define "_sourcedir ${PWD}" --define "_srcrpmdir ${PWD}" -bs ${NAME}.spec
rpm: dist
$(rpmbuild) --define "dist $(DIST)" --define "_sourcedir ${PWD}" --define "_rpmdir ${PWD}" -ba ${NAME}.spec
clean:
@rm -f *.tgz
@rm -f *.rpm
@git clean -Xdf