From 47b4608a033a6b6c05f8798ab675baa120d15a7f Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Sat, 25 Apr 2015 18:38:19 +0100 Subject: Report the git tag if exists in the output of --version from klee and kleaver. --- lib/Support/Makefile | 10 ++++++++++ lib/Support/PrintVersion.cpp | 3 +++ 2 files changed, 13 insertions(+) diff --git a/lib/Support/Makefile b/lib/Support/Makefile index ff28b06e..2b1b104c 100644 --- a/lib/Support/Makefile +++ b/lib/Support/Makefile @@ -26,6 +26,12 @@ include $(LEVEL)/Makefile.common GIT_PRESENT:=$(shell [ -d "$(PROJ_SRC_ROOT)/.git" ] && echo 1 || echo 0) +ifeq ($(GIT_PRESENT),1) +GIT_TAGS:=$(shell cd $(PROJ_SRC_ROOT); git describe --tags 2> /dev/null 1>&2 && echo 1 || echo 0) +else +GIT_TAGS:=0 +endif + .PHONY: $(CompileTimeInfoFile) $(CompileTimeInfoFile): $(Verb) echo "Regenerating $(CompileTimeInfoFile)" @@ -34,3 +40,7 @@ ifeq ($(GIT_PRESENT),1) $(Verb) echo '#define KLEE_BUILD_REVISION "'$(shell cd $(PROJ_SRC_ROOT); git rev-parse HEAD)'"' >> \ $(CompileTimeInfoFile) endif +ifeq ($(GIT_TAGS),1) + $(Verb) echo '#define KLEE_BUILD_TAG "'$(shell cd $(PROJ_SRC_ROOT); git describe --tags)'"' >> \ + $(CompileTimeInfoFile) +endif diff --git a/lib/Support/PrintVersion.cpp b/lib/Support/PrintVersion.cpp index d62269ba..b4ff9811 100644 --- a/lib/Support/PrintVersion.cpp +++ b/lib/Support/PrintVersion.cpp @@ -24,6 +24,9 @@ void klee::printVersion() llvm::outs() << KLEE_BUILD_REVISION "\n"; #else llvm::outs() << "unknown\n"; +#endif +#ifdef KLEE_BUILD_TAG + llvm::outs() << " Build tag: " << KLEE_BUILD_TAG "\n"; #endif // Show LLVM version information llvm::outs() << "\n"; -- cgit 1.4.1