r2866 - trunk/src/host/dfu-util/src

jserv at sita.openmoko.org jserv at sita.openmoko.org
Fri Aug 31 08:51:41 CEST 2007


Author: jserv
Date: 2007-08-31 08:51:38 +0200 (Fri, 31 Aug 2007)
New Revision: 2866

Modified:
   trunk/src/host/dfu-util/src/Makefile.am
   trunk/src/host/dfu-util/src/main.c
Log:
Added automagic inclusion of the svn source tree version.

This should fix bugzilla #721
http://bugzilla.openmoko.org/cgi-bin/bugzilla/show_bug.cgi?id=721


Modified: trunk/src/host/dfu-util/src/Makefile.am
===================================================================
--- trunk/src/host/dfu-util/src/Makefile.am	2007-08-30 22:07:28 UTC (rev 2865)
+++ trunk/src/host/dfu-util/src/Makefile.am	2007-08-31 06:51:38 UTC (rev 2866)
@@ -1,4 +1,11 @@
 AM_CFLAGS = -Wall
+
+dfu-version.h:
+	echo -e '#ifndef DFU_UTIL_VERSION' \
+	'\n#define DFU_UTIL_VERSION "'`svnversion`'"' \
+	'\n#endif' > dfu-version.h
+BUILT_SOURCES = dfu-version.h
+
 bin_PROGRAMS = dfu-util dfu-util_static
 dfu_util_SOURCES = main.c sam7dfu.c dfu.c dfu.h
 

Modified: trunk/src/host/dfu-util/src/main.c
===================================================================
--- trunk/src/host/dfu-util/src/main.c	2007-08-30 22:07:28 UTC (rev 2865)
+++ trunk/src/host/dfu-util/src/main.c	2007-08-31 06:51:38 UTC (rev 2866)
@@ -32,7 +32,10 @@
 #include "dfu.h"
 #include "usb_dfu.h"
 #include "sam7dfu.h"
-//#include "config.h"
+#include "dfu-version.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 
 int debug;
@@ -309,6 +312,11 @@
 		);
 }
 
+static void print_version(void)
+{
+	printf("dfu-util version %s\n", VERSION "+svn" DFU_UTIL_VERSION);
+}
+
 static struct option opts[] = {
 	{ "help", 0, 0, 'h' },
 	{ "version", 0, 0, 'V' },
@@ -372,8 +380,7 @@
 			exit(0);
 			break;
 		case 'V':
-			/* FIXME */
-			printf("not implemented yet\n");
+			print_version();
 			exit(0);
 			break;
 		case 'v':





More information about the commitlog mailing list