changeset 213:231403652831

build: use `git describe` to obtain a version number If possible, use `git describe` to get a very specific version number. If not, simply use the version number in the top-level makefile. Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Wed, 07 Jan 2009 15:08:55 -0500
parents 633dcda67ae2
children 3a1f1b04a91f
files Makefile scripts/extract-version.sh
diffstat 2 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Wed Jan 07 15:04:01 2009 -0500
+++ b/Makefile	Wed Jan 07 15:08:55 2009 -0500
@@ -12,8 +12,10 @@
 # By default, be terse
 V=0
 
+DISPLAYVERSION=$(shell ./scripts/extract-version.sh)
+
 MAKEFLAGS += -rR --no-print-directory
-CFLAGS=-DVERSION=\"$(VERSION)\" -g -fno-strict-aliasing -fno-builtin -nostdinc -nostdlib -Wall -m64 -I include/ -O2
+CFLAGS=-DVERSION=\"$(DISPLAYVERSION)\" -g -fno-strict-aliasing -fno-builtin -nostdinc -nostdlib -Wall -m64 -I include/ -O2
 NUCLEUSCFLAGS=-include include/nucleus.h
 LDFLAGS=-m elf64_s390
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/extract-version.sh	Wed Jan 07 15:08:55 2009 -0500
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+v=`git describe 2> /dev/null`
+
+case "$v" in
+	"")
+		awk '/^VERSION=/ { print substr($0,9); exit; }' < Makefile
+		;;
+	*)
+		echo "$v"
+		;;
+esac