From 69e055ca629f50fc46d0d2389ece7efe5bc93106 Mon Sep 17 00:00:00 2001 From: Claus Klein Date: Wed, 18 Jul 2012 23:10:52 +0200 Subject: [PATCH] update git version while bootstrap if git is available --- GNUmakefile | 8 +++++++- src/ninja.cc | 5 ++--- src/version.h | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 src/version.h diff --git a/GNUmakefile b/GNUmakefile index 8f60ca0c71..e079ee3ab9 100755 --- a/GNUmakefile +++ b/GNUmakefile @@ -32,6 +32,12 @@ ninja.bootstrap: bootstrap.py fi; \ unzip -o $(gtestarchive); \ fi + if [ -d .git ]; then \ + branch=`git status -bsu no`; \ + revisioncount=`git log --oneline | wc -l`; \ + projectversion=`git describe --tags --long --always`; \ + echo "const char* kVersion = \"$${branch}-$${projectversion%%-*}\";" > src/version.h; \ + fi $(RM) build.ninja ./$< cp -p -b ninja $@ @@ -39,7 +45,7 @@ ninja.bootstrap: bootstrap.py # bootstrap with install ninja! ninja: ninja.bootstrap build.ninja - ./$< -v + ./$< manual:: README.html README.html: README HACKING GNUmakefile $(bindir)/rst2html-2.7.py diff --git a/src/ninja.cc b/src/ninja.cc index 915555cf6d..3118dabfae 100644 --- a/src/ninja.cc +++ b/src/ninja.cc @@ -49,9 +49,8 @@ namespace { -/// The version number of the current Ninja release. This will always -/// be "git" on trunk. -const char* kVersion = "git"; +/// The version number of the current Ninja release. +#include "version.h" /// Global information passed into subtools. struct Globals { diff --git a/src/version.h b/src/version.h new file mode 100644 index 0000000000..09dca53ebd --- /dev/null +++ b/src/version.h @@ -0,0 +1 @@ +const char* kVersion = "## develop-b33ff36";