| 1 |
# |
| 2 |
# source from Ralph Williamsen, |
| 3 |
# see http://stackoverflow.com/questions/4120001/what-is-the-git-equivalent-for-revision-number |
| 4 |
# |
| 5 |
# Set the source control revision similar to subversion to use in 'c' |
| 6 |
# files as a define. |
| 7 |
# You must build in the master branch otherwise the build branch will |
| 8 |
# be prepended to the revision and/or "dirty" appended. This is to |
| 9 |
# clearly ID developer builds. |
| 10 |
REPO_REVISION_:=$(shell git rev-list HEAD --count) |
| 11 |
BUILD_BRANCH:=$(shell git rev-parse --abbrev-ref HEAD) |
| 12 |
BUILD_REV_ID:=$(shell git rev-parse HEAD) |
| 13 |
BUILD_REV_ID_SHORT:=$(shell git describe --long --tags --dirty --always) |
| 14 |
ifeq ($(BUILD_BRANCH), master) |
| 15 |
REPO_REVISION:=$(REPO_REVISION_)_g$(BUILD_REV_ID_SHORT) |
| 16 |
else |
| 17 |
REPO_REVISION:=$(BUILD_BRANCH)_$(REPO_REVISION_)_r$(BUILD_REV_ID_SHORT) |
| 18 |
endif |
| 19 |
export REPO_REVISION |
| 20 |
export BUILD_BRANCH |
| 21 |
export BUILD_REV_ID |
| 22 |
|