Include git short sha in version string instead of -dev

This commit is contained in:
Kevin Lange 2014-04-26 22:17:30 -07:00
parent 5fb5e07b8e
commit 1c65d3d663
3 changed files with 21 additions and 1 deletions

View File

@ -11,6 +11,9 @@ CFLAGS += -Wall -Wextra -Wno-unused-function -Wno-unused-parameter
CFLAGS += -Wstrict-prototypes -pedantic -fno-omit-frame-pointer
CFLAGS += -D_KERNEL_
# Kernel autoversioning with git sha
CFLAGS += -DKERNEL_GIT_TAG=`util/make-version`
# We have some pieces of assembly sitting around as well...
YASM = yasm

View File

@ -21,7 +21,14 @@ int __kernel_version_lower = 1;
* mean anything, but can be used to distinguish
* between different features included while
* building multiple kernels. */
char * __kernel_version_suffix = "dev";
#ifdef KERNEL_GIT_TAG
# define STR(x) #x
# define STRSTR(x) STR(x)
# define KERNEL_VERSION_SUFFIX STRSTR(KERNEL_GIT_TAG)
#else
# define KERNEL_VERSION_SUFFIX "r"
#endif
char * __kernel_version_suffix = KERNEL_VERSION_SUFFIX;
/* The release codename.
*

10
util/make-version Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
VERSION=`git rev-parse --short HEAD`
X=$(git status -s | grep -q '^.M')
if [ $? -eq 0 ]; then
VERSION="$VERSION-dirty"
fi
echo -n $VERSION