-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
37 lines (27 loc) · 1.15 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
BUILDDIR ?= /tmp/ssmbuild
VERSION ?=
RELEASE ?= 1
ARCH := $(shell rpm --eval "%{_arch}")
SRPM_FILE := $(BUILDDIR)/results/SRPMS/ssm-meta-$(VERSION)-$(RELEASE).src.rpm
RPM_FILE := $(BUILDDIR)/results/RPMS/ssm-meta-$(VERSION)-$(RELEASE).$(ARCH).rpm
.PHONY: all
all: srpm rpm
.PHONY: srpm
srpm: $(SRPM_FILE)
$(SRPM_FILE):
mkdir -vp $(BUILDDIR)/rpmbuild/{SOURCES,SPECS,BUILD,SRPMS,RPMS}
mkdir -vp $(shell dirname $(SRPM_FILE))
cp ssm-meta.spec $(BUILDDIR)/rpmbuild/SPECS/ssm-meta.spec
sed -i "s/%{_version}/$(VERSION)/g" "$(BUILDDIR)/rpmbuild/SPECS/ssm-meta.spec"
sed -i "s/%{_release}/$(RELEASE)/g" "$(BUILDDIR)/rpmbuild/SPECS/ssm-meta.spec"
rpmbuild -bs --define "debug_package %{nil}" --define "_topdir $(BUILDDIR)/rpmbuild" $(BUILDDIR)/rpmbuild/SPECS/ssm-meta.spec
mv $(BUILDDIR)/rpmbuild/SRPMS/$(shell basename $(SRPM_FILE)) $(SRPM_FILE)
.PHONY: rpm
rpm: $(RPM_FILE)
$(RPM_FILE): $(SRPM_FILE)
mkdir -vp $(BUILDDIR)/mock $(shell dirname $(RPM_FILE))
mock -r ssm-9-$(ARCH) --resultdir $(BUILDDIR)/mock --rebuild $(SRPM_FILE)
mv $(BUILDDIR)/mock/$(shell basename $(RPM_FILE)) $(RPM_FILE)
.PHONY: clean
clean:
rm -rf $(BUILDDIR)/{rpmbuild,mock,results}