Skip to content

Commit

Permalink
Improve handling of mscore/revision.h
Browse files Browse the repository at this point in the history
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
softins committed Jan 29, 2013
1 parent 903e622 commit d82fced
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
10 changes: 5 additions & 5 deletions Makefile
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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 \
Expand Down Expand Up @@ -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

#
Expand Down
2 changes: 1 addition & 1 deletion Makefile.osx
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ lrelease:
revision:
@git rev-parse --short HEAD > mscore/revision.h

version: revision
version:
@echo ${VERSION}

install:
Expand Down
10 changes: 10 additions & 0 deletions build/git/hooks/README
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 2 additions & 0 deletions build/git/hooks/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
git rev-parse --short HEAD >mscore/revision.h
1 change: 1 addition & 0 deletions mscore/revision.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Unknown

0 comments on commit d82fced

Please sign in to comment.