Set the superiotool version number from svn at build time.
authorUlf Jordan <jordan@chalmers.se>
Sat, 13 Oct 2007 18:06:12 +0000 (18:06 +0000)
committerUwe Hermann <uwe@hermann-uwe.de>
Sat, 13 Oct 2007 18:06:12 +0000 (18:06 +0000)
Signed-off-by: Ulf Jordan <jordan@chalmers.se>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2852 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

util/superiotool/Makefile
util/superiotool/superiotool.c
util/superiotool/superiotool.h

index e8ba2586825f2a15ff2a87afd7928b9fe5d91835..87faecb05b8d2c0d7d70e89382bd7cc82e8f5133 100644 (file)
@@ -24,14 +24,21 @@ CC      = gcc
 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)
 
index 6c93f58c6babc20598c0ad85285a7848f6095a06..7b5bb40f758dfaa6ad8f298364f53b60af468279 100644 (file)
@@ -170,12 +170,7 @@ void probing_for(const char *vendor, const char *info, uint16_t port)
 
 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[])
index 9ba514306fcb53d5ff728d3a5644708b13b6605c..58243466f296f15afbf883d12907a3cecc6dd324 100644 (file)
@@ -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\