Permalink
Browse files

Improve handling of mscore/revision.h

Added a default mscore/revision.h containing "Unknown" as the
revision number (mscore/revision.h remains in .gitignore).
Removed the dependency on "revision" in the Makefiles. Now
"make revision" must be done manually if required.
Added sample post-checkout git hook to allow git automatically
to update mscore/revision.h when doing a git checkout. If installed,
this removes the need to do "make revision" manually.
  • Loading branch information...
1 parent 903e622 commit d82fced19277e3cd627550287e3b91f5fbf80ef2 @softins softins committed Jan 29, 2013
Showing with 19 additions and 6 deletions.
  1. +5 −5 Makefile
  2. +1 −1 Makefile.osx
  3. +10 −0 build/git/hooks/README
  4. +2 −0 build/git/hooks/post-checkout
  5. +1 −0 mscore/revision.h
View
10 Makefile 100755 → 100644
@@ -25,7 +25,7 @@ PREFIX = "/usr/local"
VERSION = "2.0b-${REVISION}"
#VERSION = 2.0
-release: revision
+release:
mkdir build.release; \
cd build.release; \
cmake -DCMAKE_BUILD_TYPE=RELEASE \
@@ -35,7 +35,7 @@ release: revision
make -j ${CPUS}; \
-debug: revision
+debug:
if test ! -d build.debug; then mkdir build.debug; fi; \
cd build.debug; \
cmake -DCMAKE_BUILD_TYPE=DEBUG \
@@ -94,13 +94,13 @@ clean:
revision:
@git rev-parse --short HEAD > mscore/revision.h
-version: revision
+version:
@echo ${VERSION}
-install: release revision
+install: release
cd build.release; make install
-installdebug: debug revision
+installdebug: debug
cd build.debug; make install
#
View
2 Makefile.osx 100755 → 100644
@@ -58,7 +58,7 @@ lrelease:
revision:
@git rev-parse --short HEAD > mscore/revision.h
-version: revision
+version:
@echo ${VERSION}
install:
@@ -0,0 +1,10 @@
+Copy the post-checkout file from build/git/hooks/ into .git/hooks/ in order
+for git to update mscore/revision.h with the branch number automatically when
+checking out:
+
+$ cp -p build/git/hooks/post-checkout .git/hooks/
+
+This only needs doing once, and then removes the need to do "make revision"
+manually for setting the correct revision number after doing a checkout.
+
+This works for Linux, Windows (MinGW) and OSX.
@@ -0,0 +1,2 @@
+#!/bin/sh
+git rev-parse --short HEAD >mscore/revision.h
View
@@ -0,0 +1 @@
+Unknown

0 comments on commit d82fced

Please sign in to comment.