forked from freebsd/pkg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
83 lines (60 loc) · 2.14 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
SUBDIR= external \
libpkg \
pkg \
scripts
NEWVERS= ${.CURDIR}/newvers.sh
.if !defined(NOSTATIC)
SUBDIR+= pkg-static
.endif
ATF_INSTALLED!= which atf-version 2>&1 || echo
.if !empty(ATF_INSTALLED)
SUBDIR+= tests
.endif
PKGVERSION!= sh ${NEWVERS} pkg
# Sources for all the files modified by changing version strings.
# Changes to these sources will be commited to git unconditionally as
# part of the 'release' target.
VERSIONED_FILES= ${NEWVERS}
CLEANFILES= Doxyfile
# Set CREATE_SNAPSHOT=yes to create a snapshot, which will update
# Doxyfile, libpkg/pkg.h etc. without needing any modifications to
# newvers.sh. To clear the snapshot, either update ${NEWVERS} or set
# CREATE_SNAPSHOT=no
.if defined(CREATE_SNAPSHOT)
_snapshot= snapshot
${_snapshot}:
.endif
TARBALL_BASENAME= pkg-${PKGVERSION}
TARBALL_EXT= tar.xz
TARBALL_FILE= ${TARBALL_BASENAME}.${TARBALL_EXT}
.PHONY: release set-tag make-tarball regression-test \
${_snapshot}
all: Doxyfile
clean:
rm -f ${CLEANFILES}
release: regression-test set-tag make-tarball
@${ECHO} "==> Create New Release (${PKGVERSION})"
regression-test: clean all
@${ECHO} "==> Regression Test"
@${MAKE} -C tests run
set-tag:
@if [ -n "$$( git status -uno -s )" ] ; then \
git commit -uno -m "New Release ${PKGVERSION}" ${VERSIONED_FILES} ; \
fi
@if git tag -l | grep "^${PKGVERSION}$$" ; then \
${ECHO} "---> Error: tag ${PKGVERSION} already exists" ; \
${ECHO} "---> Either delete the tag (git tag -d ${PKGVERSION})" ; \
${ECHO} "---> (but only if you haven't pushed yet) or edit" ; \
${ECHO} "---> ${NEWVERS} to set the new release version" ; \
false ; \
fi
git tag -m "New Release ${PKGVERSION}" ${PKGVERSION}
@${ECHO} "===> Don't forget to 'git push --tags origin'"
# Note: you will need to update ~/.gitconfig so git understands tar.xz
# as a format: git config --global tar.tar.xz.command "xz -c"
make-tarball:
git archive --format=${TARBALL_EXT} --prefix=${TARBALL_BASENAME}/ \
-o ${TARBALL_FILE} ${PKGVERSION}
Doxyfile: Doxyfile.in ${NEWVERS} ${_snapshot}
sed -e 's,%%PKGVERSION%%,${PKGVERSION},' ${.CURDIR}/${.TARGET:S,$,.in,} > ${.TARGET}
.include <bsd.subdir.mk>