]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - release/Makefile.inc1
Avoid the build from falling over if devel/git is not installed
[FreeBSD/FreeBSD.git] / release / Makefile.inc1
1 #
2 # $FreeBSD$
3 #
4
5 # Figure out where the git binary is.
6 .for _P in /usr/bin /usr/local/bin
7 . if !defined(GIT_CMD) || empty(GIT_CMD)
8 .  if exists(${_P}/git)
9 GIT_CMD=   ${_P}/git
10 .  endif
11 . endif
12 .endfor
13
14 .if !empty(GIT_CMD) && exists(${GIT_CMD})
15 # Set the git branch and hash to export where needed.
16 .if !defined(GITBRANCH) || empty(GITBRANCH)
17 GITBRANCH!=     ${GIT_CMD} -C ${.CURDIR} rev-parse --abbrev-ref HEAD 2>/dev/null | sed -e 's/\^\///'
18 .export GITBRANCH
19 .endif
20 .if !defined(GITREV) || empty(GITREV)
21 GITREV!=        ${GIT_CMD} -C ${.CURDIR} rev-parse --verify --short HEAD 2>/dev/null || true
22 .export GITREV
23 .endif
24 .else
25 GITBRANCH=      nullbranch
26 GITREV=         nullhash
27 .export GITBRANCH
28 .export GITREV
29 .endif
30
31 # Set the build date, primarily for snapshot builds.
32 .if !defined(BUILDDATE) || empty(BUILDDATE)
33 BUILDDATE!=             date +%Y%m%d
34 .export BUILDDATE
35 .endif
36