build: figure out git revision and include as part of version string

Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
This commit is contained in:
Vegard Nossum
2009-06-11 10:24:12 +02:00
parent 98810091da
commit 74eea59208
3 changed files with 25 additions and 2 deletions

View File

@@ -1,4 +1,6 @@
cflags = -Wall -Iinclude -Iinclude/asm/gameboy -g localversion = $(shell bash scripts/localversion.sh)
cflags = -Wall -Iinclude -Iinclude/asm/gameboy -DLOCALVERSION=\"$(localversion)\" -g
all: all:

View File

@@ -11,7 +11,7 @@
#define ASMOTOR #define ASMOTOR
#define ASMOTOR_VERSION "1.10" #define ASMOTOR_VERSION "1.10-linux" LOCALVERSION
#define ASM_VERSION "1.08c" #define ASM_VERSION "1.08c"
#define LINK_VERSION "1.06c" #define LINK_VERSION "1.06c"

21
scripts/localversion.sh Normal file
View File

@@ -0,0 +1,21 @@
#! /bin/bash
#
# Use git to figure out which version we are using.
#
# Adapted from a script written by Rene Scharfe <rene.scharfe@lsrfire.ath.cx>,
# found in the Linux Kernel.
#
set -u
if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
printf '%s%s' -g $head
git update-index --refresh --unmerged > /dev/null
if git diff-index --name-only HEAD | read dummy; then
printf '%s' -dirty
fi
exit
fi