freebsd-dev/release/Makefile.inc1
Glen Barber 52a8a2de0f Avoid the build from falling over if devel/git is not installed
on the system.  Set a null branch/hash in this case, to avoid
undefined GITREV/GITBRANCH variables from falling over in other
areas.

Reported by:	many
Sponsored by:	Rubicon Communications, LLC (netgate.com)
2020-08-29 15:30:21 +00:00

37 lines
846 B
Makefile

#
# $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 !empty(GIT_CMD) && exists(${GIT_CMD})
# 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
.else
GITBRANCH= nullbranch
GITREV= nullhash
.export GITBRANCH
.export GITREV
.endif
# Set the build date, primarily for snapshot builds.
.if !defined(BUILDDATE) || empty(BUILDDATE)
BUILDDATE!= date +%Y%m%d
.export BUILDDATE
.endif