-
Notifications
You must be signed in to change notification settings - Fork 39
/
Makefile
94 lines (76 loc) · 2.05 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
VERSION=$(shell scripts/version_manager.py . version)
NAME=lago
TAR_FILE=${NAME}-${VERSION}.tar
TARBALL_FILE=${TAR_FILE}.gz
SPECFILE=${NAME}.spec
# this is needed to use the libs from venv
OUTPUT_DIR=${PWD}
RPM_DIR=${OUTPUT_DIR}/rpmbuild
DIST_DIR=${OUTPUT_DIR}/dist
TAR_DIST_LOCATION=${DIST_DIR}/${TAR_FILE}
TARBALL_DIST_LOCATION=${DIST_DIR}/${TARBALL_FILE}
.PHONY: build rpm srpm ${TARBALL_DIST_LOCATION} check-local dist check ${SPECFILE} docs fullchangelog changelog python-sdist add-extra-files-sdist container
changelog:
echo Creating RPM compatible ChangeLog \
&& ( \
scripts/version_manager.py . changelog \
) > ChangeLog \
|| ( \
echo Failed to generate RPM ChangeLog >&2 \
&& exit 1 \
)
fullchangelog:
@if test -d ".git"; then \
echo Creating FullChangeLog \
&& ( \
echo '# Generated by Makefile. Do not edit.'; echo; \
git log --stat \
) > FullChangeLog \
|| ( \
echo Failed to generate FullChangeLog >&2 \
); \
else \
echo A git clone is required to generate a FullChangeLog >&2; \
fi
${SPECFILE}: ${SPECFILE}.in changelog
sed -e "s/@@VERSION@@/${VERSION}/g" \
${SPECFILE}.in > $@; \
cat ChangeLog >> $@
build:
LAGO_VERSION=${VERSION} python3 setup.py build
check: check-local
check-local:
tox -v -r -e py3
dist: ${TARBALL_DIST_LOCATION}
python-sdist:
LAGO_VERSION=${VERSION} python3 setup.py sdist --dist-dir ${DIST_DIR}
add-extra-files-sdist: changelog fullchangelog
gunzip ${TARBALL_DIST_LOCATION}
tar rvf ${TAR_DIST_LOCATION} \
FullChangeLog \
ChangeLog
gzip ${TAR_DIST_LOCATION}
${TARBALL_DIST_LOCATION}: python-sdist add-extra-files-sdist
srpm: dist ${SPECFILE}
rpmbuild \
--define "_topdir ${RPM_DIR}" \
--define "_sourcedir ${DIST_DIR}" \
-of \
${SPECFILE}
rpm: dist ${SPECFILE}
rpmbuild \
--define "_topdir ${RPM_DIR}" \
--define "_sourcedir ${DIST_DIR}" \
-ba \
${SPECFILE}
clean:
python3 setup.py clean
rm -rf ${DIST_DIR}
rm -rf ${RPM_DIR}
rm -rf build "$(REPO_LOCAL_REL_PATH)"
rm -f ${SPECFILE}
rm -f AUTHORS
docs:
tox -v -r -e docs
container:
make -C container RPM_PATH=${RPM_PATH}