Fix for #349: build issue when no git found

This commit is contained in:
Dmitry Babokin
2013-02-11 11:01:46 -08:00
parent 52147ce631
commit 8d8d9c63fe

View File

@@ -42,8 +42,23 @@ LLVM_CXXFLAGS=$(shell $(LLVM_CONFIG) --cppflags)
LLVM_VERSION=LLVM_$(shell $(LLVM_CONFIG) --version | sed -e s/\\./_/ -e s/svn//)
LLVM_VERSION_DEF=-D$(LLVM_VERSION)
# Define build time stamp and revision.
# For revision we use GIT or SVN info.
BUILD_DATE=$(shell date +%Y%m%d)
BUILD_VERSION=$(shell git log --abbrev-commit --abbrev=16 | head -1)
GIT_REVISION:=$(shell git log --abbrev-commit --abbrev=16 2>/dev/null | head -1)
ifeq (${GIT_REVISION},)
SVN_REVISION:=$(shell svn log -l 1 2>/dev/null | grep -o \^r[[:digit:]]\* )
ifeq (${SVN_REVISION},)
# Failed to get revision info
BUILD_VERSION:="no_version_info"
else
# SVN revision info
BUILD_VERSION:=$(SVN_REVISION)
endif
else
# GIT revision info
BUILD_VERSION:=$(GIT_REVISION)
endif
CXX=g++
CPP=cpp