-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
50 lines (42 loc) · 1.9 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
42
43
44
45
46
47
48
49
50
# The name of the formula to release and package
FORMULA ?= split-ssh
# The version of the formula (sources)
VERSION ?= 0.1.0
# The RPM package release
RELEASE ?= 1
# The ID of the GPG file used to verify sources and sign packages
GPG_NAME ?= "Key ID"
# We're building packages out of Salt formulas
PACKAGE = qubes-mgmt-salt-user-${FORMULA}
# The Salt formulas sources are conventionally named
PACKAGE_SRC = packages/${FORMULA}/src/${FORMULA}-formula
# Default target, what I'd likely want to do most often
.PHONY: all
all: release
# Intentionally left blank.
# Update source version and package release numbers before building packages with Tito
.PHONY: release
release: tito formula-version formula-makefile package-spec
@echo "Release qubes-mgmt-salt-user-${FORMULA}-${VERSION}-${RELEASE} is ready."
@echo "Commit these changes and create a the tag: qubes-mgmt-salt-user-${FORMULA}-${VERSION}-${RELEASE}"
# Configure Tito to build a given package release
.PHONY: tito
tito:
echo "${VERSION}-${RELEASE} ${PACKAGE_SRC}" > .tito/packages/${PACKAGE}
# Set the source version for documentation purposes
.PHONY: formula-version
formula-version:
echo ${VERSION} > ${PACKAGE_SRC}/VERSION
# Set the source version in its Makefile
.PHONY: formula-makefile
formula-makefile:
@echo "# DO NOT EDIT This file was generated from a template, please edit Makefile.tmpl instead." > packages/${FORMULA}/Makefile
tail -n +2 packages/${FORMULA}/Makefile.tmpl | envsubst '$${VERSION} $${RELEASE}' >> packages/${FORMULA}/Makefile
# Set the souce version and package release in the package spec
.PHONY: package-spec
package-spec:
@echo "# DO NOT EDIT This file was generated from a template, please edit ${PACKAGE}.spec.tmpl instead." > ${PACKAGE_SRC}/${PACKAGE}.spec
tail -n +2 ${PACKAGE_SRC}/${PACKAGE}.spec.tmpl | envsubst '$${VERSION} $${RELEASE}' >> ${PACKAGE_SRC}/${PACKAGE}.spec
.PHONY: packages
packages:
make -C packages/${FORMULA} clean all