fix genversion

This commit is contained in:
Tim Felgentreff 2020-07-04 21:39:51 +02:00
parent 7d97972c74
commit 98342dd0e0

View file

@ -80,6 +80,7 @@ int main(int argc, char * argv[]) {
fclose(file);
}
} else {
git_rev = NULL;
fprintf(stderr, "Cannot get git revision\n");
}
@ -105,14 +106,18 @@ int main(int argc, char * argv[]) {
if ( ! file )
return 1;
fprintf(file, "/* %d %d %d %d %s */\n", new_ver[0], new_ver[1], new_ver[2], new_ver[3], git_rev);
if (git_rev == NULL) {
fprintf(file, "/* %d %d %d %d no-rev */\n", new_ver[0], new_ver[1], new_ver[2], new_ver[3]);
} else {
fprintf(file, "/* %d %d %d %d %s */\n", new_ver[0], new_ver[1], new_ver[2], new_ver[3], git_rev);
}
fprintf(file, "/* This file is autogenerated, do not modify it! */\n");
fprintf(file, "#define StratagusMajorVersion %d\n", new_ver[0]);
fprintf(file, "#define StratagusMinorVersion %d\n", new_ver[1]);
fprintf(file, "#define StratagusPatchLevel %d\n", new_ver[2]);
fprintf(file, "#define StratagusPatchLevel2 %d\n", new_ver[3]);
if ( new_ver[4] != -1 )
if ( git_rev != NULL )
fprintf(file, "#define StratagusGitRev %s\n", git_rev);
fclose(file);