Improve version.sh script

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.
This commit is contained in:
Martin Kleusberg
2013-04-19 16:22:38 +02:00
parent e871ecc777
commit 69a6685eaa
2 changed files with 9 additions and 2 deletions

1
.gitignore vendored
View File

@@ -6,6 +6,7 @@ src/sqlitebrowser
src/Makefile*
src/debug
src/release
src/gen_version.h
libs/*/Makefile*
libs/*/debug/

View File

@@ -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