[LinuxBIOS] r2852 - trunk/util/superiotool

svn at openbios.org svn at openbios.org
Sat Oct 13 20:06:12 CEST 2007


Author: uwe
Date: 2007-10-13 20:06:12 +0200 (Sat, 13 Oct 2007)
New Revision: 2852

Modified:
   trunk/util/superiotool/Makefile
   trunk/util/superiotool/superiotool.c
   trunk/util/superiotool/superiotool.h
Log:
Set the superiotool version number from svn at build time.

Signed-off-by: Ulf Jordan <jordan at chalmers.se>
Acked-by: Uwe Hermann <uwe at hermann-uwe.de>



Modified: trunk/util/superiotool/Makefile
===================================================================
--- trunk/util/superiotool/Makefile	2007-10-13 17:06:21 UTC (rev 2851)
+++ trunk/util/superiotool/Makefile	2007-10-13 18:06:12 UTC (rev 2852)
@@ -24,14 +24,21 @@
 INSTALL = /usr/bin/install
 PREFIX  = /usr/local
 
+# Set the superiotool version string from the highest revision number
+# of the checked out superiotool files.
+SVNDEF := -D'SUPERIOTOOL_VERSION="$(shell svnversion -cn . \
+          | sed -e "s/.*://" -e "s/\([0-9]*\).*/\1/")"'
+
 # TODO: -pedantic
 CFLAGS = -O2 -Wall -Werror -Wstrict-prototypes -Wundef -Wstrict-aliasing \
-         -Werror-implicit-function-declaration -ansi
+         -Werror-implicit-function-declaration -ansi $(SVNDEF)
 
 OBJS = superiotool.o ali.o fintek.o ite.o nsc.o smsc.o winbond.o
 
 all: $(PROGRAM)
 
+superiotool.o: *.c superiotool.h
+
 $(PROGRAM): $(OBJS) superiotool.h
 	$(CC) $(CFLAGS) -o $(PROGRAM) $(OBJS)
 

Modified: trunk/util/superiotool/superiotool.c
===================================================================
--- trunk/util/superiotool/superiotool.c	2007-10-13 17:06:21 UTC (rev 2851)
+++ trunk/util/superiotool/superiotool.c	2007-10-13 18:06:12 UTC (rev 2852)
@@ -170,12 +170,7 @@
 
 static void print_version(void)
 {
-	char tmp[80];
-
-	strncpy((char *)&tmp,
-		(const char *)&SUPERIOTOOL_VERSION[6],
-		strlen(SUPERIOTOOL_VERSION) - 8);
-	printf("superiotool r%s\n", (char *)&tmp);
+	printf("superiotool r%s\n", SUPERIOTOOL_VERSION);
 }
 
 int main(int argc, char *argv[])

Modified: trunk/util/superiotool/superiotool.h
===================================================================
--- trunk/util/superiotool/superiotool.h	2007-10-13 17:06:21 UTC (rev 2851)
+++ trunk/util/superiotool/superiotool.h	2007-10-13 18:06:12 UTC (rev 2852)
@@ -29,8 +29,6 @@
 #include <getopt.h>
 #include <sys/io.h>
 
-#define SUPERIOTOOL_VERSION "$Rev$"
-
 #define USAGE "Usage: superiotool [-d] [-D] [-V] [-v] [-h]\n\n\
   -d | --dump            Dump Super I/O registers\n\
   -D | --dump-readable   Dump Super I/O registers in human-readable format\n\





More information about the coreboot mailing list