xref: /freebsd/release/Makefile.inc1 (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1#
2#
3
4# Figure out where the git binary is.
5.for _P in /usr/bin /usr/local/bin
6. if !defined(GIT_CMD) || empty(GIT_CMD)
7.  if exists(${_P}/git)
8GIT_CMD=   ${_P}/git
9.  endif
10. endif
11.endfor
12
13.if !empty(GIT_CMD) && exists(${GIT_CMD})
14# Set the git branch and hash to export where needed.
15. if !defined(GITBRANCH) || empty(GITBRANCH)
16GITBRANCH!=	${GIT_CMD} -C ${.CURDIR} rev-parse --abbrev-ref HEAD 2>/dev/null | sed -e 's/\^\///'
17. export GITBRANCH
18. endif
19. if !defined(GITREV) || empty(GITREV)
20GITREV!=	${GIT_CMD} -C ${.CURDIR} rev-parse --verify --short HEAD 2>/dev/null || true
21. export GITREV
22. endif
23. if !defined(GITCOUNT) || empty(GITCOUNT)
24GITCOUNT!=	${GIT_CMD} -C ${.CURDIR} rev-list --first-parent --count HEAD 2>/dev/null || true
25. export GITCOUNT
26. endif
27.else
28GITBRANCH=	nullbranch
29GITREV=		nullhash
30GITCOUNT=	nullcount
31. export GITBRANCH
32. export GITREV
33. export GITCOUNT
34.endif
35
36# Set the build date, primarily for snapshot builds.
37.if !defined(BUILDDATE) || empty(BUILDDATE)
38BUILDDATE!=		date +%Y%m%d
39.export BUILDDATE
40.endif
41
42# Override UNAME_r to allow building ports for a different branch.
43UNAME_r=	${REVISION}-${BRANCH}
44.export UNAME_r
45