aboutsummaryrefslogtreecommitdiffstats
path: root/release/Makefile.inc1
blob: 8fd38b966bd58184ed4f4b9eb6a7c7172fba4032 (plain) (blame)
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
#
# $FreeBSD$
#

# Figure out where the git binary is.
.for _P in /usr/bin /usr/local/bin
. if !defined(GIT_CMD) || empty(GIT_CMD)
.  if exists(${_P}/git)
GIT_CMD=   ${_P}/git
.  endif
. endif
.endfor
.if !defined(GIT_CMD) && empty(GIT_CMD)
. error "Git binary not found.  Set GIT_CMD appropriately."
.endif

# Set the git branch and hash to export where needed.
.if !defined(GITBRANCH) || empty(GITBRANCH)
GITBRANCH!=	${GIT_CMD} -C ${.CURDIR} rev-parse --abbrev-ref HEAD 2>/dev/null | sed -e 's/\^\///'
.export GITBRANCH
.endif
.if !defined(GITREV) || empty(GITREV)
GITREV!=	${GIT_CMD} -C ${.CURDIR} rev-parse --verify --short HEAD 2>/dev/null || true
.export GITREV
.endif

# Set the build date, primarily for snapshot builds.
.if !defined(BUILDDATE) || empty(BUILDDATE)
BUILDDATE!=		date +%Y%m%d
.export BUILDDATE
.endif