Skip to content

Commit

Permalink
Improve version.sh script
Browse files Browse the repository at this point in the history
Before making any changes to the gen_version.h file check if the number
of the last git commit actually changed. If not don't touch the file.

Enable the version.sh script also for debug mode. With the above change
the program is not compiled and linked every time again, so there's no
reason to not run this. This also fixes a build error for those people
just checking out the repository and doing a debug build.
  • Loading branch information
MKleusberg committed Apr 19, 2013
1 parent e871ecc commit 69a6685
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ src/sqlitebrowser
src/Makefile*
src/debug
src/release
src/gen_version.h

libs/*/Makefile*
libs/*/debug/
Expand Down
10 changes: 8 additions & 2 deletions src/version.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/bin/sh
cd $1
echo -n "#define APP_VERSION " > gen_version.h
git log -n1 --format="\"%h_git\"" >> gen_version.h

version=`git log -n1 --format="\"%h_git\""`
version_macro="#define APP_VERSION $version"
current_file=`cat gen_version.h`

if [ "$version_macro" != "$current_file" ]; then
echo "$version_macro" > gen_version.h
fi

0 comments on commit 69a6685

Please sign in to comment.