From c7806d7974e05a7c8837c3614d56c0bec7e66049 Mon Sep 17 00:00:00 2001
From: Adam Wujek <adam.wujek@cern.ch>
Date: Thu, 26 Nov 2015 17:33:05 +0100
Subject: [PATCH] Add version printout to the test programs

Signed-off-by: Adam Wujek <adam.wujek@cern.ch>
---
 acdx/test/Makefile                           |  1 +
 acdx/test/acdxtest.c                         |  2 ++
 ctc/test/Makefile                            |  2 ++
 ctc/test/set_clk.c                           | 18 ++++++++++---
 ctc/test/set_delay_counter1.c                | 18 ++++++++++---
 ctc/test/set_delay_counter2.c                | 18 ++++++++++---
 ctc/test/set_enable.c                        | 19 +++++++++++---
 ctc/test/set_mode.c                          | 18 ++++++++++---
 ctr-2.0                                      |  2 +-
 cvorb/test/cvorbtest.c                       |  7 +++++
 cvorg/test/Makefile                          |  1 +
 cvorg/test/cvorgtest.c                       |  8 ++++++
 cvorg/test/extest/extest.c                   |  3 +++
 fmc/fine-delay-sw                            |  2 +-
 fmc/fmc-adc-100m14b4cha-sw                   |  2 +-
 fmc/fmc-bus                                  |  2 +-
 fmc/fmc-tdc-sw                               |  2 +-
 fmc/obsbox                                   |  2 +-
 fmc/spec-sw                                  |  2 +-
 fmc/svec-sw                                  |  2 +-
 fmc/zio                                      |  2 +-
 icv196/test/Makefile                         |  1 +
 icv196/test/icv196test.c                     |  4 +++
 jtag/Makefile                                |  1 +
 jtag/jtag.c                                  |  5 ++++
 mil1553                                      |  2 +-
 msatt/test/Makefile                          |  1 +
 msatt/test/msattntst.c                       | 27 +++++++++++++++-----
 mtt                                          |  2 +-
 pciioconfig/test/Makefile                    |  1 +
 pciioconfig/test/test_pciioconfig.c          |  7 ++++-
 pickeringmux/test/test_driver.c              | 21 +++++++++++----
 rawio/Makefile                               |  2 ++
 rawio/vmeio.c                                | 18 +++++++++++++
 sis33/lib/examples/Makefile                  |  1 +
 sis33/lib/examples/acquire.c                 | 20 ++++++++++++---
 sis33/lib/examples/available_event_lengths.c | 20 ++++++++++++---
 sis33/lib/examples/available_freqs.c         | 20 ++++++++++++---
 sis33/lib/examples/clock.c                   | 20 ++++++++++++---
 sis33/lib/examples/event_timestamping.c      | 20 ++++++++++++---
 sis33/lib/examples/fourier1.c                | 17 +++++++++---
 sis33/lib/examples/n_bits.c                  | 20 ++++++++++++---
 sis33/lib/examples/n_events_max.c            | 17 +++++++++---
 sis33/lib/examples/offset.c                  | 20 ++++++++++++---
 sis33/lib/examples/segments.c                | 20 ++++++++++++---
 sis33/lib/examples/start.c                   | 17 +++++++++---
 sis33/lib/examples/stop.c                    | 18 ++++++++++---
 sis33/lib/examples/stress.c                  | 20 ++++++++++++---
 sis33/lib/examples/trigger.c                 | 20 ++++++++++++---
 sis33/lib/examples/two_segments.c            | 20 ++++++++++++---
 sis33/lib/examples/version.c                 |  6 ++++-
 sis33/lib/sis33.c                            |  2 +-
 sis33/test/Makefile                          |  1 +
 sis33/test/sis33test.c                       |  3 +++
 vd80-2/lib/test/Makefile                     |  1 +
 vd80-2/lib/test/vd80test.c                   | 10 +++++---
 vmebridge/test/berrtest.c                    |  5 ++++
 vmebridge/test/create_window.c               |  3 +++
 vmebridge/test/destroy_window.c              |  3 +++
 vmebridge/test/hsm-dma.c                     |  4 +++
 vmebridge/test/mm6390-dma.c                  |  5 ++++
 vmebridge/test/setflag.c                     |  3 +++
 vmebridge/test/test_mapping.c                |  2 ++
 vmebridge/test/testctr.c                     |  4 +++
 vmebridge/test/testctr2.c                    |  4 +++
 vmebridge/test/testctr_ces.c                 |  4 +++
 vmebridge/test/testvd80.c                    |  6 +++++
 vmebridge/test/testvd802.c                   |  5 ++++
 vmebridge/test/vd80spd-dma.c                 |  6 +++++
 vmebridge/test/vd80spd.c                     |  6 +++++
 vmebridge/tools/Makefile                     |  1 +
 vmebridge/tools/vme.c                        | 19 +++++++++++++-
 vmod/test/Makefile                           |  1 +
 vmod/test/load_test.c                        |  5 ++++
 vmod/test/tstlib12a2.c                       |  5 +++-
 vmod/test/tstlib12a4.c                       |  5 +++-
 vmod/test/tstlib12e16.c                      |  5 +++-
 vmod/test/tstlib16a2.c                       |  6 ++++-
 vmod/test/tstlibdor.c                        |  5 +++-
 vmod/test/tstlibttl.c                        |  5 ++++
 vmod/test/tstlibttl_quick_read.c             |  6 ++++-
 vmod/test/tstlibttl_quick_write.c            |  5 ++++
 vmod/test/tstlibttl_read_device.c            |  5 ++++
 83 files changed, 564 insertions(+), 107 deletions(-)
 mode change 100755 => 100644 vmod/test/tstlibttl_read_device.c

diff --git a/acdx/test/Makefile b/acdx/test/Makefile
index 79c1e5a0..d0e08865 100755
--- a/acdx/test/Makefile
+++ b/acdx/test/Makefile
@@ -14,6 +14,7 @@ ACCS=oplhc
 CFLAGS= -g -Wall
 CFLAGS+= -I../driver
 CFLAGS+= -DCOMPILE_TIME=$(COMPILE_TIME)
+CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
 
 LDLIBS = -lm
 
diff --git a/acdx/test/acdxtest.c b/acdx/test/acdxtest.c
index b3e2d8c4..4e15c091 100755
--- a/acdx/test/acdxtest.c
+++ b/acdx/test/acdxtest.c
@@ -45,6 +45,7 @@ static int  acdx;
 #include "AcdxOpen.c"
 #include "AcdxCmds.c"
 
+static char git_version[] = "git_version: " GIT_VERSION;
 /**************************************************************************/
 /* Prompt and do commands in a loop                                       */
 /**************************************************************************/
@@ -60,6 +61,7 @@ char tmpb[CMD_BUF_SIZE];
 
    pname = argv[0];
    printf("%s: Compiled %s %s\n",pname,__DATE__,__TIME__);
+   printf("%s: %s\n",pname, git_version);
 
    acdx = AcdxOpen();
    if (acdx == 0) {
diff --git a/ctc/test/Makefile b/ctc/test/Makefile
index 15a2f501..9628294b 100644
--- a/ctc/test/Makefile
+++ b/ctc/test/Makefile
@@ -4,6 +4,8 @@ include ../../common.mk
 CFLAGS=-g -Wall
 
 CFLAGS += -I../
+CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
+
 LDLIBS=../libctc.$(CPU).a
 all: set_clk.$(CPU) set_delay_counter1.$(CPU) set_delay_counter2.$(CPU) set_mode.$(CPU) set_enable.$(CPU)
 
diff --git a/ctc/test/set_clk.c b/ctc/test/set_clk.c
index b8c10ee6..fcb84ea5 100644
--- a/ctc/test/set_clk.c
+++ b/ctc/test/set_clk.c
@@ -6,6 +6,8 @@
 
 #include <libctc.h>
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 /* doing two levels of stringification allows us to stringify a macro */
 #define my_stringify_l(x...)	#x
 #define my_stringify(x...)	my_stringify_l(x)
@@ -27,14 +29,15 @@ extern char *optarg;
 
 static const char usage_string[] =
 	"Setup clk source on a channel \n"
-	" " PROGNAME " [-h] [-c<CHAN>] [-m<LUN>] [-s<CLK>]";
+	" " PROGNAME " [-h] [-v] [-c<CHAN>] [-m<LUN>] [-s<CLK>]";
 
 static const char commands_string[] =
 	"options:\n"
 	" -c = channel number (default: " my_stringify(CHANNEL_NR) ")\n"
 	" -h = show this help text\n"
 	" -m = Module number (default: " my_stringify(MODULE_NR) ")\n"
-	" -s = Set source clock (default: " my_stringify(CLK_SRC) ")";
+	" -s = Set source clock (default: " my_stringify(CLK_SRC) ")\n"
+	" -v = version";
 
 static void usage_complete(void)
 {
@@ -42,12 +45,18 @@ static void usage_complete(void)
 	printf("%s\n", commands_string);
 }
 
+static void print_version(void)
+{
+	printf("%s\n", git_version);
+	printf("%s\n", libctc_version_s);
+}
+
 static void parse_args(int argc, char *argv[])
 {
 	int c;
 
 	for (;;) {
-		c = getopt(argc, argv, "c:hm:s:");
+		c = getopt(argc, argv, "c:hvm:s:");
 		if (c < 0)
 			break;
 		switch (c) {
@@ -61,6 +70,9 @@ static void parse_args(int argc, char *argv[])
 		case 'h':
 			usage_complete();
 			exit(EXIT_SUCCESS);
+		case 'v':
+			print_version();
+			exit(EXIT_SUCCESS);
 		case 'm':
 			module_nr = atoi(optarg);
 			break;
diff --git a/ctc/test/set_delay_counter1.c b/ctc/test/set_delay_counter1.c
index a4cce484..e627d815 100644
--- a/ctc/test/set_delay_counter1.c
+++ b/ctc/test/set_delay_counter1.c
@@ -6,6 +6,8 @@
 
 #include <libctc.h>
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 /* doing two levels of stringification allows us to stringify a macro */
 #define my_stringify_l(x...)	#x
 #define my_stringify(x...)	my_stringify_l(x)
@@ -27,14 +29,15 @@ extern char *optarg;
 
 static const char usage_string[] =
 	"Setup delay counter 1 on a channel \n"
-	" " PROGNAME " [-h] [-c<CHAN>] [-m<LUN>] [-s<CLK>]";
+	" " PROGNAME " [-h] [-v] [-c<CHAN>] [-m<LUN>] [-s<CLK>]";
 
 static const char commands_string[] =
 	"options:\n"
 	" -c = channel number (default: " my_stringify(CHANNEL_NR) ")\n"
 	" -h = show this help text\n"
 	" -m = Module number (default: " my_stringify(MODULE_NR) ")\n"
-	" -s = Set delay counter 1(default: " my_stringify(DELAY) ")";
+	" -s = Set delay counter 1(default: " my_stringify(DELAY) ")\n"
+	" -v = version";
 
 static void usage_complete(void)
 {
@@ -42,12 +45,18 @@ static void usage_complete(void)
 	printf("%s\n", commands_string);
 }
 
+static void print_version(void)
+{
+	printf("%s\n", git_version);
+	printf("%s\n", libctc_version_s);
+}
+
 static void parse_args(int argc, char *argv[])
 {
 	int c;
 
 	for (;;) {
-		c = getopt(argc, argv, "c:hm:s:");
+		c = getopt(argc, argv, "c:hvm:s:");
 		if (c < 0)
 			break;
 		switch (c) {
@@ -61,6 +70,9 @@ static void parse_args(int argc, char *argv[])
 		case 'h':
 			usage_complete();
 			exit(EXIT_SUCCESS);
+		case 'v':
+			print_version();
+			exit(EXIT_SUCCESS);
 		case 'm':
 			module_nr = atoi(optarg);
 			break;
diff --git a/ctc/test/set_delay_counter2.c b/ctc/test/set_delay_counter2.c
index 62de3f2e..763f0f53 100644
--- a/ctc/test/set_delay_counter2.c
+++ b/ctc/test/set_delay_counter2.c
@@ -6,6 +6,8 @@
 
 #include <libctc.h>
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 /* doing two levels of stringification allows us to stringify a macro */
 #define my_stringify_l(x...)	#x
 #define my_stringify(x...)	my_stringify_l(x)
@@ -27,14 +29,15 @@ extern char *optarg;
 
 static const char usage_string[] =
 	"Setup delay counter 2 on a channel \n"
-	" " PROGNAME " [-h] [-c<CHAN>] [-m<LUN>] [-s<CLK>]";
+	" " PROGNAME " [-h] [-v] [-c<CHAN>] [-m<LUN>] [-s<CLK>]";
 
 static const char commands_string[] =
 	"options:\n"
 	" -c = channel number (default: " my_stringify(CHANNEL_NR) ")\n"
 	" -h = show this help text\n"
 	" -m = Module number (default: " my_stringify(MODULE_NR) ")\n"
-	" -s = Set delay counter 2(default: " my_stringify(DELAY) ")";
+	" -s = Set delay counter 2(default: " my_stringify(DELAY) ")\n"
+	" -v = version";
 
 static void usage_complete(void)
 {
@@ -42,12 +45,18 @@ static void usage_complete(void)
 	printf("%s\n", commands_string);
 }
 
+static void print_version(void)
+{
+	printf("%s\n", git_version);
+	printf("%s\n", libctc_version_s);
+}
+
 static void parse_args(int argc, char *argv[])
 {
 	int c;
 
 	for (;;) {
-		c = getopt(argc, argv, "c:hm:s:");
+		c = getopt(argc, argv, "c:hvm:s:");
 		if (c < 0)
 			break;
 		switch (c) {
@@ -61,6 +70,9 @@ static void parse_args(int argc, char *argv[])
 		case 'h':
 			usage_complete();
 			exit(EXIT_SUCCESS);
+		case 'v':
+			print_version();
+			exit(EXIT_SUCCESS);
 		case 'm':
 			module_nr = atoi(optarg);
 			break;
diff --git a/ctc/test/set_enable.c b/ctc/test/set_enable.c
index b7d6978b..b72a9e72 100644
--- a/ctc/test/set_enable.c
+++ b/ctc/test/set_enable.c
@@ -6,6 +6,8 @@
 
 #include <libctc.h>
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 /* doing two levels of stringification allows us to stringify a macro */
 #define my_stringify_l(x...)	#x
 #define my_stringify(x...)	my_stringify_l(x)
@@ -25,13 +27,14 @@ extern char *optarg;
 
 static const char usage_string[] =
 	"Setup status on a channel \n"
-	" " PROGNAME " [-h] [-c<CHAN>] [-m<LUN>] [-s<CLK>]";
+	" " PROGNAME " [-h] [-v] [-c<CHAN>] [-m<LUN>] [-s<CLK>]";
 
 static const char commands_string[] =
 	"options:\n"
 	" -c = channel number (default: " my_stringify(CHANNEL_NR) ")\n"
 	" -h = show this help text\n"
-	" -m = Module number (default: " my_stringify(MODULE_NR) ")";
+	" -m = Module number (default: " my_stringify(MODULE_NR) ")\n"
+	" -v = version";
 
 static void usage_complete(void)
 {
@@ -39,12 +42,18 @@ static void usage_complete(void)
 	printf("%s\n", commands_string);
 }
 
+static void print_version(void)
+{
+	printf("%s\n", git_version);
+	printf("%s\n", libctc_version_s);
+}
+
 static void parse_args(int argc, char *argv[])
 {
 	int c;
 
 	for (;;) {
-		c = getopt(argc, argv, "c:hm:");
+		c = getopt(argc, argv, "c:hvm:");
 		if (c < 0)
 			break;
 		switch (c) {
@@ -58,6 +67,10 @@ static void parse_args(int argc, char *argv[])
 		case 'h':
 			usage_complete();
 			exit(EXIT_SUCCESS);
+		case 'v':
+			print_version();
+			exit(EXIT_SUCCESS);
+			
 		case 'm':
 			module_nr = atoi(optarg);
 			break;
diff --git a/ctc/test/set_mode.c b/ctc/test/set_mode.c
index 92c4b29a..7e155cbe 100644
--- a/ctc/test/set_mode.c
+++ b/ctc/test/set_mode.c
@@ -6,6 +6,8 @@
 
 #include <libctc.h>
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 /* doing two levels of stringification allows us to stringify a macro */
 #define my_stringify_l(x...)	#x
 #define my_stringify(x...)	my_stringify_l(x)
@@ -30,7 +32,7 @@ extern char *optarg;
 
 static const char usage_string[] =
 	"Setup mode  on a channel \n"
-	" " PROGNAME " [-h] [-c<CHAN>] [-m<LUN>] [-s<MODE>] [-d<DIR>";
+	" " PROGNAME " [-h] [-v] [-c<CHAN>] [-m<LUN>] [-s<MODE>] [-d<DIR>";
 
 static const char commands_string[] =
 	"options:\n"
@@ -38,7 +40,8 @@ static const char commands_string[] =
 	" -h = show this help text\n"
 	" -m = Module number (default: " my_stringify(MODULE_NR) ")\n"
 	" -s = Set mode (default: " my_stringify(MODE) ")\n"
-	" -d = Set direction (default: " my_stringify(DIRECTION) ")";
+	" -d = Set direction (default: " my_stringify(DIRECTION) ")\n"
+	" -v = version";
 
 static void usage_complete(void)
 {
@@ -46,12 +49,18 @@ static void usage_complete(void)
 	printf("%s\n", commands_string);
 }
 
+static void print_version(void)
+{
+	printf("%s\n", git_version);
+	printf("%s\n", libctc_version_s);
+}
+
 static void parse_args(int argc, char *argv[])
 {
 	int c;
 
 	for (;;) {
-		c = getopt(argc, argv, "c:hm:s:d:");
+		c = getopt(argc, argv, "c:hvm:s:d:");
 		if (c < 0)
 			break;
 		switch (c) {
@@ -65,6 +74,9 @@ static void parse_args(int argc, char *argv[])
 		case 'h':
 			usage_complete();
 			exit(EXIT_SUCCESS);
+		case 'v':
+			print_version();
+			exit(EXIT_SUCCESS);
 		case 'm':
 			module_nr = atoi(optarg);
 			break;
diff --git a/ctr-2.0 b/ctr-2.0
index 7148a2cd..943ec3be 160000
--- a/ctr-2.0
+++ b/ctr-2.0
@@ -1 +1 @@
-Subproject commit 7148a2cd34b1f22bb68291246e56bcd8e12eee2a
+Subproject commit 943ec3beb7059338a8fac47f55e54aa3c0e0e52a
diff --git a/cvorb/test/cvorbtest.c b/cvorb/test/cvorbtest.c
index 81b86ee2..653c58b2 100644
--- a/cvorb/test/cvorbtest.c
+++ b/cvorb/test/cvorbtest.c
@@ -29,6 +29,8 @@
 #include "time_stamp_counter.h"
 #endif
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 /* mandatory external global variables */
 int use_builtin_cmds = 0;
 char xmlfile[128] = "cvorb.xml";
@@ -1126,6 +1128,11 @@ int h_load_and_play(struct cmd_desc *cmdd, struct atom *atoms)
 
 int main(int argc, char *argv[], char *envp[])
 {
+	char *pname;
+	pname = argv[0];
+	printf("%s: Compiled %s %s\n", pname,__DATE__,__TIME__);
+	printf("%s: %s\n", pname, git_version);
+	printf("%s\n", libvd80_version_s);
 #if __CVORB_DEBUG__
 	ts_calibrateCountPeriod(50, 10);
 #endif
diff --git a/cvorg/test/Makefile b/cvorg/test/Makefile
index 0f36ff12..d548cbc0 100644
--- a/cvorg/test/Makefile
+++ b/cvorg/test/Makefile
@@ -8,6 +8,7 @@ CFLAGS+= -Iextest/ \
 	-I../lib \
 	-I../include/ \
 	-I../../include/
+CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
 
 LOADLIBES := -L../lib/ -L../ad9516
 LDLIBS=-lcvorg.$(CPU) -lreadline -lad9516.$(CPU) -lrt -lm
diff --git a/cvorg/test/cvorgtest.c b/cvorg/test/cvorgtest.c
index 393f870b..419fecb3 100644
--- a/cvorg/test/cvorgtest.c
+++ b/cvorg/test/cvorgtest.c
@@ -23,6 +23,8 @@
 #include "libinternal.h"
 #include "libad9516.h"
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 /* this compilation flag enables printing the test waveform before it's sent */
 /* #define DEBUG_CVORG_WVSHAPES */
 
@@ -1455,6 +1457,12 @@ int h_hw_version(struct cmd_desc *cmdd, struct atom *atoms)
 	return 1;
 }
 
+void print_version(void)
+{
+	printf("%s\n", git_version);
+	printf("%s\n", libcvorg_version_s);
+}
+
 
 int main(int argc, char *argv[], char *envp[])
 {
diff --git a/cvorg/test/extest/extest.c b/cvorg/test/extest/extest.c
index eed2216f..b3f10f40 100644
--- a/cvorg/test/extest/extest.c
+++ b/cvorg/test/extest/extest.c
@@ -726,6 +726,8 @@ static void usage_error()
 	printf("Try '%s -h' for more information.\n", __progname);
 }
 
+extern void print_version(void);
+
 static void usage()
 {
 	usage_short();
@@ -734,6 +736,7 @@ static void usage()
 		" (default: '" DRIVER_NAME "')\n");
 	printf( " -h               display this help message\n\n");
 	printf( "[ %s: Compiled on %s %s ]\n\n", __progname, __DATE__, __TIME__);
+	print_version();
 }
 
 /**
diff --git a/fmc/fine-delay-sw b/fmc/fine-delay-sw
index b028731f..f76a08be 160000
--- a/fmc/fine-delay-sw
+++ b/fmc/fine-delay-sw
@@ -1 +1 @@
-Subproject commit b028731f07d87d62ed850d869326d3eee52c9bb3
+Subproject commit f76a08be59896dd8b1ab8c79f872d2eb474d97e9
diff --git a/fmc/fmc-adc-100m14b4cha-sw b/fmc/fmc-adc-100m14b4cha-sw
index 52a78da9..f2569509 160000
--- a/fmc/fmc-adc-100m14b4cha-sw
+++ b/fmc/fmc-adc-100m14b4cha-sw
@@ -1 +1 @@
-Subproject commit 52a78da9926b45a9394a9347348181c20aa60501
+Subproject commit f2569509b686b10c9a8bb14682c3118ebd7e243e
diff --git a/fmc/fmc-bus b/fmc/fmc-bus
index 73b49de1..acb6fd69 160000
--- a/fmc/fmc-bus
+++ b/fmc/fmc-bus
@@ -1 +1 @@
-Subproject commit 73b49de18933517783098f860aaab1ab12a0e33b
+Subproject commit acb6fd69c5b88ac3ad4face89a9feed415ba9c19
diff --git a/fmc/fmc-tdc-sw b/fmc/fmc-tdc-sw
index 11054181..364e8a67 160000
--- a/fmc/fmc-tdc-sw
+++ b/fmc/fmc-tdc-sw
@@ -1 +1 @@
-Subproject commit 11054181e1c2f1a982b8463f1f414e8968c2b64b
+Subproject commit 364e8a67e8a8b90f5566b2a6f2fd8ab454d2e4b0
diff --git a/fmc/obsbox b/fmc/obsbox
index 465a0243..2d49db5c 160000
--- a/fmc/obsbox
+++ b/fmc/obsbox
@@ -1 +1 @@
-Subproject commit 465a0243171a723ce30be80c3dc5016028fbdf47
+Subproject commit 2d49db5ca1397bc020de071116a0d5080f6f580c
diff --git a/fmc/spec-sw b/fmc/spec-sw
index bc0e12b9..08b08c1b 160000
--- a/fmc/spec-sw
+++ b/fmc/spec-sw
@@ -1 +1 @@
-Subproject commit bc0e12b9badfacc34fa55cf9f11ebfcb0aaa74d3
+Subproject commit 08b08c1b725921cf0ba7551b45313d3ad2bec8c0
diff --git a/fmc/svec-sw b/fmc/svec-sw
index 1cab8ad3..33c6880c 160000
--- a/fmc/svec-sw
+++ b/fmc/svec-sw
@@ -1 +1 @@
-Subproject commit 1cab8ad3f21c380b36c7c0c848124ee01fc44e93
+Subproject commit 33c6880c5056527d2d54fcf67be42fa5a2877426
diff --git a/fmc/zio b/fmc/zio
index 07da0470..0aea6955 160000
--- a/fmc/zio
+++ b/fmc/zio
@@ -1 +1 @@
-Subproject commit 07da04701a0abf22c36730db38fe294c9f579be7
+Subproject commit 0aea6955d010ac9f4e5983cad36bdfa438b63888
diff --git a/icv196/test/Makefile b/icv196/test/Makefile
index d7312abf..701989a8 100644
--- a/icv196/test/Makefile
+++ b/icv196/test/Makefile
@@ -7,6 +7,7 @@ DRIVER:=../driver
 ICV196LB:=../lib
 
 CFLAGS = -g -Wall -I$(ICV196LB) -I$(DRIVER) -DCOMPILE_TIME=$(COMPILE_TIME)
+CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
 
 LDLIBS = $(ICV196LB)/libicv196.$(CPU).a
 
diff --git a/icv196/test/icv196test.c b/icv196/test/icv196test.c
index edfc438b..ffcc8d9c 100644
--- a/icv196/test/icv196test.c
+++ b/icv196/test/icv196test.c
@@ -23,6 +23,8 @@
 #define HISTORIES 24
 #define CMD_BUF_SIZE 128
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 static char history[HISTORIES][CMD_BUF_SIZE];
 static char *cmdbuf = &(history[0][0]);
 static int  cmdindx = 0;
@@ -49,6 +51,8 @@ int main(int argc,char *argv[])
 
 	pname = argv[0];
 	printf("%s: Compiled %s %s\n",pname,__DATE__,__TIME__);
+	printf("%s: %s\n", pname, git_version);
+	printf("%s\n", libicv196_version_s);
 
 	if (argc > 1)
 		dev = strtoul(argv[1],&cp,0);
diff --git a/jtag/Makefile b/jtag/Makefile
index 17d1afed..9872ba1a 100644
--- a/jtag/Makefile
+++ b/jtag/Makefile
@@ -2,6 +2,7 @@
 include ../common.mk
 
 CFLAGS = -g -I../vmebridge/include
+CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
 LDLIBS = -lvmebus.$(CPU)
 LDFLAGS = -L../vmebridge/lib
 ALL  = jtag.$(CPU)
diff --git a/jtag/jtag.c b/jtag/jtag.c
index af6381a6..eea7a345 100644
--- a/jtag/jtag.c
+++ b/jtag/jtag.c
@@ -8,11 +8,14 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/file.h>
+#include <libvmebus.h>
 
 #include "lenval.h"
 #include "micro.h"
 #include "ports.h"
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 void setPort(short p,short val);
 void readByte(unsigned char *data);
 unsigned char readTDOBit();
@@ -38,6 +41,8 @@ int cc;
       printf("Examples:\n");
       printf("         nouchi.xsvf 0x1000\n");
       printf("         nouchi.xsvf 0x1000 4\n");
+      printf("\n%s\n", git_version);
+      printf("%s\n", libvmebus_version_s);
       exit(0);
    }
 
diff --git a/mil1553 b/mil1553
index faa6557e..8f0db2e2 160000
--- a/mil1553
+++ b/mil1553
@@ -1 +1 @@
-Subproject commit faa6557efa4e076ccf4446dff96784138f54caaa
+Subproject commit 8f0db2e2b80f77490ef98e64c9d1f77066fe32d9
diff --git a/msatt/test/Makefile b/msatt/test/Makefile
index 904ab364..5a97c017 100644
--- a/msatt/test/Makefile
+++ b/msatt/test/Makefile
@@ -3,6 +3,7 @@ include ../../common.mk
 
 CFLAGS=-g -Wall
 CFLAGS+=-I../lib -I../driver
+CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
 LDFLAGS += -L../lib
 LDLIBS += -lmsatt.$(CPU)
 
diff --git a/msatt/test/msattntst.c b/msatt/test/msattntst.c
index ec66c44a..1b3358ad 100644
--- a/msatt/test/msattntst.c
+++ b/msatt/test/msattntst.c
@@ -14,6 +14,8 @@
 #include "msatt.h"
 #include "libmsatt.h"
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 int device;
 int selected_channel;
 int relay_register;
@@ -115,6 +117,12 @@ void change_channel ()
 	}
 }
 
+static void print_version(char *pname)
+{
+	printf("%s %s\n", pname, git_version);
+	printf("%s\n", libmsatt_version_s);
+}
+
 int main (int argc, char *argv[])
 {
 	int fd;
@@ -122,21 +130,26 @@ int main (int argc, char *argv[])
 
 	selected_channel = 1;
 
-	if (argc == 2)
-	{
-		device = atoi(argv[1]);
-	}
-	else
+	if (argc != 2)
 	{
 		printf("Insufficient number of arguments\n");
 		printf("\nPlease use: %s <lun_of_the_device>\n", argv[0]);
+		printf("or: %s -v for version info\n", argv[0]);
 		exit(-1);
-	}	
+	}
+	if(!strcmp("-v", argv[1])) {
+		print_version(argv[0]);
+		exit(0);
+	}
+	else
+	{
+		device = atoi(argv[1]);
+	}
 
 	if ((fd = msatt_open(device)) < 0) {
 		perror ("open failed\n");
 		return -1;
-	}	
+	}
 
 	/* Check for channel count*/
 	num_channels = msatt_get_nchannels(fd);
diff --git a/mtt b/mtt
index 02a5b02c..e879c3a9 160000
--- a/mtt
+++ b/mtt
@@ -1 +1 @@
-Subproject commit 02a5b02c3f8b1417bbc9e8aa4ebf3f787eb8d026
+Subproject commit e879c3a9c25f51d1b9b3c1fb45559b6150c8b63d
diff --git a/pciioconfig/test/Makefile b/pciioconfig/test/Makefile
index 3158d99a..166e94c6 100644
--- a/pciioconfig/test/Makefile
+++ b/pciioconfig/test/Makefile
@@ -4,6 +4,7 @@ include ../../common.mk
 # Flags to compile test program and lib
 CFLAGS=-Wall -g
 CFLAGS+=-I../lib
+CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
 LDFLAGS+=-L../lib
 LDLIBS+=-lpciioconfig.$(CPU)
 
diff --git a/pciioconfig/test/test_pciioconfig.c b/pciioconfig/test/test_pciioconfig.c
index 46ebd91f..9ebcd8ae 100644
--- a/pciioconfig/test/test_pciioconfig.c
+++ b/pciioconfig/test/test_pciioconfig.c
@@ -1,13 +1,18 @@
 #include <stdio.h>
 #include "crateconfig.h"
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 int main(int argc, char *argv[])
 {
   int slot;
   int bus;
   int device;
   int rc;
-  
+
+  printf("%s: %s\n", argv[0], git_version);
+  printf("%s\n", libpciioconfig_version_s);
+  printf("\n");
   printf("Testing slot -> bus-device\n");
   for(slot = 1; slot <= CPCI_CRATE_MAX_SLOT; slot++)
   {
diff --git a/pickeringmux/test/test_driver.c b/pickeringmux/test/test_driver.c
index f8693d01..e6cb6359 100644
--- a/pickeringmux/test/test_driver.c
+++ b/pickeringmux/test/test_driver.c
@@ -1,6 +1,3 @@
-
-static __attribute__((unused)) char test_version[] = "version: " GIT_VERSION;
-
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -11,7 +8,9 @@ static __attribute__((unused)) char test_version[] = "version: " GIT_VERSION;
 #include <fcntl.h>
 #include <time.h>
 #include "pickeringmuxdrv.h"
-#include "pciioconfig/crateconfig.h"
+#include "crateconfig.h"
+
+static char git_version[] = "git_version: " GIT_VERSION;
 
 static void printUsage(char *basename);
 static void printStatus(int *status, int size);
@@ -27,6 +26,11 @@ static int resetMode;
 static int closeMode;
 static int openMode;
 
+static void print_version(void)
+{
+	printf("%s\n", git_version);
+	printf("%s\n", libpciioconfig_version_s);
+}
 
 int main(int argc, char *argv[])
 {
@@ -48,7 +52,13 @@ int main(int argc, char *argv[])
     printUsage(argv[0]);    
     exit(0);
   }
-  
+  /* print version */
+  if(!strcmp(argv[1], "-v"))
+  {
+    print_version();
+    exit(0);
+  }
+
   rc = sscanf(argv[1], "%d\n", &slot);
   if(rc != 1) /* We should decode just one character */
   {
@@ -353,6 +363,7 @@ static void printUsage(char *basename)
   printf("the -c  <input> <output> option closes the <input> on <output>\n");
   printf("the -o  <output> option opens the <output>\n");
   printf("the -a  <ch> <attn> option sets the <attn> attenuation on channel <ch>\n");
+  printf("the -v  version info\n");
 }
 
 /******************************************************************************
diff --git a/rawio/Makefile b/rawio/Makefile
index 867cfd17..5227bf6b 100644
--- a/rawio/Makefile
+++ b/rawio/Makefile
@@ -2,6 +2,8 @@
 include ../common.mk
 
 CFLAGS+=-I../vmebridge/include
+CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
+
 all: vmeio.$(CPU)
 
 clean:
diff --git a/rawio/vmeio.c b/rawio/vmeio.c
index 3c69f395..9be39b99 100644
--- a/rawio/vmeio.c
+++ b/rawio/vmeio.c
@@ -26,6 +26,8 @@
 #include <sys/stat.h>
 #include <vmebus.h>
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 /* error handling */
 #define TSI148_LCSR_DSTA_VBE           (1<<28)  /* Error */
 #define TSI148_LCSR_DSTA_ABT           (1<<27)  /* Abort */
@@ -474,9 +476,17 @@ int main(int argc, char *argv[], char *envp[])
 		exit(1);
 	}
 
+	if (argc<2) {
+		printf("Not enough parameters\n");
+		exit(EXIT_FAILURE);
+	}
 
 	sscanf(argv[1], "%c", &op);
 
+	if (op=='-') {
+		sscanf(argv[1]+1, "%c", &op);
+	}
+
 	switch (op) {
 	case 'r':
 		do_read(argc, argv, envp);
@@ -484,8 +494,16 @@ int main(int argc, char *argv[], char *envp[])
 	case 'w':
 		do_write(argc, argv, envp);
 		break;
+	case 'v':
+		printf("%s\n", git_version);
+		exit(EXIT_SUCCESS);
 	default:
 		printf("Wrong optype (%c)\n", op);
+	case 'h':
+		printf("Use:\n", op);
+		printf("  r - read\n", op);
+		printf("  w - write\n", op);
+		printf("  v - version\n", op);
 		exit(EXIT_FAILURE);
 	}
 
diff --git a/sis33/lib/examples/Makefile b/sis33/lib/examples/Makefile
index 39919079..dfefabaf 100644
--- a/sis33/lib/examples/Makefile
+++ b/sis33/lib/examples/Makefile
@@ -22,6 +22,7 @@ SRCS := \
 INCDIR := ../../include
 LDFLAGS := -lm
 CFLAGS := -Wall -D_GNU_SOURCE -g -I$(INCDIR)
+CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
 HLIBSIS33 := $(INCDIR)/libsis33.h
 LIBSIS33 := ../libsis33.$(CPU).a
 MYSTR := my_stringify.h
diff --git a/sis33/lib/examples/acquire.c b/sis33/lib/examples/acquire.c
index e022d83e..5511b9c1 100644
--- a/sis33/lib/examples/acquire.c
+++ b/sis33/lib/examples/acquire.c
@@ -9,9 +9,11 @@
 #include <stdio.h>
 #include <inttypes.h>
 
-#include <libsis33.h>
+#include "libsis33.h"
 #include "my_stringify.h"
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 #define MODULE_NR	0
 #define SEGMENT_NR	0
 #define CHANNEL_NR	0
@@ -33,7 +35,7 @@ extern char *optarg;
 
 static const char usage_string[] =
 	"Sample from two sis33 segments\n"
-	" " PROGNAME "[-a] [-c<CHANNEL>] [-e<EVENTS>] [-f] [-h] [-l<LENGTH>] [-m<LUN>] [-n] [-s<SEGMENT>] [-t]";
+	" " PROGNAME "[-a] [-c<CHANNEL>] [-e<EVENTS>] [-f] [-h] [-v] [-l<LENGTH>] [-m<LUN>] [-n] [-s<SEGMENT>] [-t]";
 
 static const char commands_string[] =
 	"options:\n"
@@ -47,7 +49,8 @@ static const char commands_string[] =
 	" -m = Module. Default: " my_stringify(MODULE_NR) "\n"
 	" -n = No wait\n"
 	" -s = segment. Default: " my_stringify(SEGMENT_NR) "\n"
-	" -t = Fetch and only print timestamps (if supported)";
+	" -t = Fetch and only print timestamps (if supported)\n"
+	" -v = version";
 
 static void usage_complete(void)
 {
@@ -55,12 +58,18 @@ static void usage_complete(void)
 	printf("%s\n", commands_string);
 }
 
+static void print_version(void)
+{
+	printf("%s\n", git_version);
+	printf("%s\n", libsis33_version_s);
+}
+
 static void parse_args(int argc, char *argv[])
 {
 	int c;
 
 	for (;;) {
-		c = getopt(argc, argv, "ac:e:fhl:m:ns:t");
+		c = getopt(argc, argv, "ac:e:fhvl:m:ns:t");
 		if (c < 0)
 			break;
 		switch (c) {
@@ -81,6 +90,9 @@ static void parse_args(int argc, char *argv[])
 		case 'h':
 			usage_complete();
 			exit(EXIT_SUCCESS);
+		case 'v':
+			print_version();
+			exit(EXIT_SUCCESS);
 		case 'l':
 			ev_length = strtoul(optarg, NULL, 0);
 			break;
diff --git a/sis33/lib/examples/available_event_lengths.c b/sis33/lib/examples/available_event_lengths.c
index bdba7da8..53aa70d0 100644
--- a/sis33/lib/examples/available_event_lengths.c
+++ b/sis33/lib/examples/available_event_lengths.c
@@ -8,9 +8,11 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-#include <libsis33.h>
+#include "libsis33.h"
 #include "my_stringify.h"
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 /* default module number (LUN) */
 #define MODULE_NR	0
 
@@ -22,13 +24,14 @@ extern char *optarg;
 
 static const char usage_string[] =
 	"Show the available event lengths of an sis33 device\n"
-	" " PROGNAME " [-h] [-m<LUN>]";
+	" " PROGNAME " [-h] [-v] [-m<LUN>]";
 
 static const char commands_string[] =
 	"options:\n"
 	" -h = show this help text\n"
 	" -m = Module number (default: " my_stringify(MODULE_NR) ")\n"
-	" -r = show raw values (all values in bytes)";
+	" -r = show raw values (all values in bytes)\n"
+	" -v = version";
 
 static void usage_complete(void)
 {
@@ -36,18 +39,27 @@ static void usage_complete(void)
 	printf("%s\n", commands_string);
 }
 
+static void print_version(void)
+{
+	printf("%s\n", git_version);
+	printf("%s\n", libsis33_version_s);
+}
+
 static void parse_args(int argc, char *argv[])
 {
 	int c;
 
 	for (;;) {
-		c = getopt(argc, argv, "hm:r");
+		c = getopt(argc, argv, "hvm:r");
 		if (c < 0)
 			break;
 		switch (c) {
 		case 'h':
 			usage_complete();
 			exit(EXIT_SUCCESS);
+		case 'v':
+			print_version();
+			exit(EXIT_SUCCESS);
 		case 'm':
 			module_nr = strtol(optarg, NULL, 0);
 			break;
diff --git a/sis33/lib/examples/available_freqs.c b/sis33/lib/examples/available_freqs.c
index c4dfd5ab..06899502 100644
--- a/sis33/lib/examples/available_freqs.c
+++ b/sis33/lib/examples/available_freqs.c
@@ -8,9 +8,11 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-#include <libsis33.h>
+#include "libsis33.h"
 #include "my_stringify.h"
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 /* default module number (LUN) */
 #define MODULE_NR	0
 
@@ -21,12 +23,13 @@ extern char *optarg;
 
 static const char usage_string[] =
 	"Show the available sampling frequencies of an sis33 device\n"
-	" " PROGNAME " [-h] [-m<LUN>]";
+	" " PROGNAME " [-h] [-v] [-m<LUN>]";
 
 static const char commands_string[] =
 	"options:\n"
 	" -h = show this help text\n"
-	" -m = Module number (default: " my_stringify(MODULE_NR) ")";
+	" -m = Module number (default: " my_stringify(MODULE_NR) ")\n"
+	" -v = version";
 
 static void usage_complete(void)
 {
@@ -34,18 +37,27 @@ static void usage_complete(void)
 	printf("%s\n", commands_string);
 }
 
+static void print_version(void)
+{
+	printf("%s\n", git_version);
+	printf("%s\n", libsis33_version_s);
+}
+
 static void parse_args(int argc, char *argv[])
 {
 	int c;
 
 	for (;;) {
-		c = getopt(argc, argv, "hm:");
+		c = getopt(argc, argv, "hvm:");
 		if (c < 0)
 			break;
 		switch (c) {
 		case 'h':
 			usage_complete();
 			exit(EXIT_SUCCESS);
+		case 'v':
+			print_version();
+			exit(EXIT_SUCCESS);
 		case 'm':
 			module_nr = strtol(optarg, NULL, 0);
 			break;
diff --git a/sis33/lib/examples/clock.c b/sis33/lib/examples/clock.c
index ff3f4f3b..e736df99 100644
--- a/sis33/lib/examples/clock.c
+++ b/sis33/lib/examples/clock.c
@@ -9,9 +9,11 @@
 #include <unistd.h>
 #include <stdio.h>
 
-#include <libsis33.h>
+#include "libsis33.h"
 #include "my_stringify.h"
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 /* default module number (LUN) */
 #define MODULE_NR	0
 
@@ -24,14 +26,15 @@ extern char *optarg;
 
 static const char usage_string[] =
 	"Operate on the clock configuration of an sis33 device\n"
-	" " PROGNAME " [-f<MHz>] [-h] [-m<LUN>]";
+	" " PROGNAME " [-f<MHz>] [-h] [-v] [-m<LUN>]";
 
 static const char commands_string[] =
 	"options:\n"
 	" -f = Frequency (MHz)\n"
 	" -h = show this help text\n"
 	" -m = Module number (default: " my_stringify(MODULE_NR) ")\n"
-	" -s = Source: \"internal\" or \"external\"";
+	" -s = Source: \"internal\" or \"external\"\n"
+	" -v = version";
 
 static void usage_complete(void)
 {
@@ -39,13 +42,19 @@ static void usage_complete(void)
 	printf("%s\n", commands_string);
 }
 
+static void print_version(void)
+{
+	printf("%s\n", git_version);
+	printf("%s\n", libsis33_version_s);
+}
+
 static void parse_args(int argc, char *argv[])
 {
 	float freq;
 	int c;
 
 	for (;;) {
-		c = getopt(argc, argv, "f:hm:s:");
+		c = getopt(argc, argv, "f:hvm:s:");
 		if (c < 0)
 			break;
 		switch (c) {
@@ -59,6 +68,9 @@ static void parse_args(int argc, char *argv[])
 		case 'h':
 			usage_complete();
 			exit(EXIT_SUCCESS);
+		case 'v':
+			print_version();
+			exit(EXIT_SUCCESS);
 		case 'm':
 			module_nr = strtol(optarg, NULL, 0);
 			break;
diff --git a/sis33/lib/examples/event_timestamping.c b/sis33/lib/examples/event_timestamping.c
index 006c7cbf..57830746 100644
--- a/sis33/lib/examples/event_timestamping.c
+++ b/sis33/lib/examples/event_timestamping.c
@@ -9,9 +9,11 @@
 #include <unistd.h>
 #include <stdio.h>
 
-#include <libsis33.h>
+#include "libsis33.h"
 #include "my_stringify.h"
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 /* default module number (LUN) */
 #define MODULE_NR	0
 
@@ -24,13 +26,14 @@ extern char *optarg;
 
 static const char usage_string[] =
 	"Operate on the event timestamping configuration of an sis33 device\n"
-	" " PROGNAME " [-d<DIVIDER>] [-h] [-m<LUN>]";
+	" " PROGNAME " [-d<DIVIDER>] [-h] [-v] [-m<LUN>]";
 
 static const char commands_string[] =
 	"options:\n"
 	" -d = Set event timestamping divider\n"
 	" -h = show this help text\n"
-	" -m = Module number (default: " my_stringify(MODULE_NR) ")";
+	" -m = Module number (default: " my_stringify(MODULE_NR) ")\n"
+	" -v = version";
 
 static void usage_complete(void)
 {
@@ -38,12 +41,18 @@ static void usage_complete(void)
 	printf("%s\n", commands_string);
 }
 
+static void print_version(void)
+{
+	printf("%s\n", git_version);
+	printf("%s\n", libsis33_version_s);
+}
+
 static void parse_args(int argc, char *argv[])
 {
 	int c;
 
 	for (;;) {
-		c = getopt(argc, argv, "d:hm:");
+		c = getopt(argc, argv, "d:hvm:");
 		if (c < 0)
 			break;
 		switch (c) {
@@ -54,6 +63,9 @@ static void parse_args(int argc, char *argv[])
 		case 'h':
 			usage_complete();
 			exit(EXIT_SUCCESS);
+		case 'v':
+			print_version();
+			exit(EXIT_SUCCESS);
 		case 'm':
 			module_nr = strtol(optarg, NULL, 0);
 			break;
diff --git a/sis33/lib/examples/fourier1.c b/sis33/lib/examples/fourier1.c
index 67f12e4f..0ed13a54 100644
--- a/sis33/lib/examples/fourier1.c
+++ b/sis33/lib/examples/fourier1.c
@@ -18,6 +18,8 @@
 #include <stdio.h>
 #include <math.h>
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 #define PROGNAME	"fourier1"
 
 static double origfreq;
@@ -27,14 +29,15 @@ static float *buf;
 
 static const char usage_string[] =
 	"Calculate the first pair of Fourier Coefficients of an acquisition data set\n"
-	" " PROGNAME " [-f<file>] [-h] [-o<ORIGFREQ>] [-s<SAMPFREQ>]";
+	" " PROGNAME " [-f<file>] [-h][-v] [-o<ORIGFREQ>] [-s<SAMPFREQ>]";
 
 static const char commands_string[] =
 	"options:\n"
 	" -f = path to acquisition data file (default: stdin)\n"
 	" -h = show this help text\n"
 	" -o = Original waveform's frequency (MHz)\n"
-	" -s = Sampling frequency (MHz)";
+	" -s = Sampling frequency (MHz)\n"
+	" -v = version";
 
 static void usage_complete(void)
 {
@@ -42,12 +45,17 @@ static void usage_complete(void)
 	printf("%s\n", commands_string);
 }
 
+static void print_version(void)
+{
+	printf("%s\n", git_version);
+}
+
 static void parse_args(int argc, char *argv[])
 {
 	int c;
 
 	for (;;) {
-		c = getopt(argc, argv, "f:ho:s:");
+		c = getopt(argc, argv, "f:hvo:s:");
 		if (c < 0)
 			break;
 		switch (c) {
@@ -58,6 +66,9 @@ static void parse_args(int argc, char *argv[])
 		case 'h':
 			usage_complete();
 			exit(EXIT_SUCCESS);
+		case 'v':
+			print_version();
+			exit(EXIT_SUCCESS);
 		case 'o':
 			origfreq = strtod(optarg, NULL);
 			origfreq *= 1000000; /* convert to Hz */
diff --git a/sis33/lib/examples/n_bits.c b/sis33/lib/examples/n_bits.c
index 4db3a9b0..74a6f773 100644
--- a/sis33/lib/examples/n_bits.c
+++ b/sis33/lib/examples/n_bits.c
@@ -8,9 +8,11 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-#include <libsis33.h>
+#include "libsis33.h"
 #include "my_stringify.h"
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 /* default module number (LUN) */
 #define MODULE_NR	0
 
@@ -21,12 +23,13 @@ extern char *optarg;
 
 static const char usage_string[] =
 	"Show the number of bits of a device\n"
-	" " PROGNAME " [-h] [-m<LUN>]";
+	" " PROGNAME " [-h] [-v] [-m<LUN>]";
 
 static const char commands_string[] =
 	"options:\n"
 	" -h = show this help text\n"
-	" -m = Module number (default: " my_stringify(MODULE_NR) ")";
+	" -m = Module number (default: " my_stringify(MODULE_NR) ")\n"
+	" -v = version";
 
 static void usage_complete(void)
 {
@@ -34,18 +37,27 @@ static void usage_complete(void)
 	printf("%s\n", commands_string);
 }
 
+static void print_version(void)
+{
+	printf("%s\n", git_version);
+	printf("%s\n", libsis33_version_s);
+}
+
 static void parse_args(int argc, char *argv[])
 {
 	int c;
 
 	for (;;) {
-		c = getopt(argc, argv, "hm:");
+		c = getopt(argc, argv, "hvm:");
 		if (c < 0)
 			break;
 		switch (c) {
 		case 'h':
 			usage_complete();
 			exit(EXIT_SUCCESS);
+		case 'v':
+			print_version();
+			exit(EXIT_SUCCESS);
 		case 'm':
 			module_nr = strtol(optarg, NULL, 0);
 			break;
diff --git a/sis33/lib/examples/n_events_max.c b/sis33/lib/examples/n_events_max.c
index 612b124a..6c7530fc 100644
--- a/sis33/lib/examples/n_events_max.c
+++ b/sis33/lib/examples/n_events_max.c
@@ -8,9 +8,11 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-#include <libsis33.h>
+#include "libsis33.h"
 #include "my_stringify.h"
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 /* default module number (LUN) */
 #define MODULE_NR	0
 
@@ -21,7 +23,7 @@ extern char *optarg;
 
 static const char usage_string[] =
 	"Show the number of events of a device\n"
-	" " PROGNAME " [-h] [-m<LUN>]";
+	" " PROGNAME " [-h] [-h] [-m<LUN>]";
 
 static const char commands_string[] =
 	"options:\n"
@@ -34,18 +36,27 @@ static void usage_complete(void)
 	printf("%s\n", commands_string);
 }
 
+static void print_version(void)
+{
+	printf("%s\n", git_version);
+	printf("%s\n", libsis33_version_s);
+}
+
 static void parse_args(int argc, char *argv[])
 {
 	int c;
 
 	for (;;) {
-		c = getopt(argc, argv, "hm:");
+		c = getopt(argc, argv, "hvm:");
 		if (c < 0)
 			break;
 		switch (c) {
 		case 'h':
 			usage_complete();
 			exit(EXIT_SUCCESS);
+		case 'v':
+			print_version();
+			exit(EXIT_SUCCESS);
 		case 'm':
 			module_nr = strtol(optarg, NULL, 0);
 			break;
diff --git a/sis33/lib/examples/offset.c b/sis33/lib/examples/offset.c
index a90cace5..ea4e0297 100644
--- a/sis33/lib/examples/offset.c
+++ b/sis33/lib/examples/offset.c
@@ -8,9 +8,11 @@
 #include <unistd.h>
 #include <stdio.h>
 
-#include <libsis33.h>
+#include "libsis33.h"
 #include "my_stringify.h"
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 #define PROGNAME	"offset"
 
 /* default module number (LUN) */
@@ -23,14 +25,15 @@ extern char *optarg;
 
 static const char usage_string[] =
 	"configure and send triggers on an sis33 device.\n"
-	" " PROGNAME " [-c<CHANNEL>] [-h] [-m<LUN>] [o<OFFSET>]";
+	" " PROGNAME " [-c<CHANNEL>] [-h] [-v] [-m<LUN>] [o<OFFSET>]";
 
 static const char commands_string[] =
 	"options:\n"
 	" -c = channel index (0 to n-1)\n"
 	" -h = show this help text\n"
 	" -m = Module number (default: " my_stringify(MODULE_NR) ")\n"
-	" -o = offset";
+	" -o = offset\n"
+	" -v = version";
 
 static void usage_complete(void)
 {
@@ -38,12 +41,18 @@ static void usage_complete(void)
 	printf("%s\n", commands_string);
 }
 
+static void print_version(void)
+{
+	printf("%s\n", git_version);
+	printf("%s\n", libsis33_version_s);
+}
+
 static void parse_args(int argc, char *argv[])
 {
 	int c;
 
 	for (;;) {
-		c = getopt(argc, argv, "c:hm:o:");
+		c = getopt(argc, argv, "c:hvm:o:");
 		if (c < 0)
 			break;
 		switch (c) {
@@ -53,6 +62,9 @@ static void parse_args(int argc, char *argv[])
 		case 'h':
 			usage_complete();
 			exit(EXIT_SUCCESS);
+		case 'v':
+			print_version();
+			exit(EXIT_SUCCESS);
 		case 'm':
 			module_nr = strtol(optarg, NULL, 0);
 			break;
diff --git a/sis33/lib/examples/segments.c b/sis33/lib/examples/segments.c
index d5afb32e..337233e0 100644
--- a/sis33/lib/examples/segments.c
+++ b/sis33/lib/examples/segments.c
@@ -8,9 +8,11 @@
 #include <unistd.h>
 #include <stdio.h>
 
-#include <libsis33.h>
+#include "libsis33.h"
 #include "my_stringify.h"
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 #define PROGNAME	"segments"
 
 /* default module number (LUN) */
@@ -22,13 +24,14 @@ extern char *optarg;
 
 static const char usage_string[] =
 	"configure the number of segments of an sis33 device.\n"
-	" " PROGNAME " [-h] [-m<LUN>] [-n<NR_SEGMENTS>]";
+	" " PROGNAME " [-h] [-v] [-m<LUN>] [-n<NR_SEGMENTS>]";
 
 static const char commands_string[] =
 	"options:\n"
 	" -h = show this help text\n"
 	" -m = Module number (default: " my_stringify(MODULE_NR) ")\n"
-	" -n = Number of segments";
+	" -n = Number of segments\n"
+	" -v = version";
 
 static void usage_complete(void)
 {
@@ -36,18 +39,27 @@ static void usage_complete(void)
 	printf("%s\n", commands_string);
 }
 
+static void print_version(void)
+{
+	printf("%s\n", git_version);
+	printf("%s\n", libsis33_version_s);
+}
+
 static void parse_args(int argc, char *argv[])
 {
 	int c;
 
 	for (;;) {
-		c = getopt(argc, argv, "hm:n:");
+		c = getopt(argc, argv, "hvm:n:");
 		if (c < 0)
 			break;
 		switch (c) {
 		case 'h':
 			usage_complete();
 			exit(EXIT_SUCCESS);
+		case 'v':
+			print_version();
+			exit(EXIT_SUCCESS);
 		case 'm':
 			module_nr = strtol(optarg, NULL, 0);
 			break;
diff --git a/sis33/lib/examples/start.c b/sis33/lib/examples/start.c
index 837b1eaa..e0706c7e 100644
--- a/sis33/lib/examples/start.c
+++ b/sis33/lib/examples/start.c
@@ -12,6 +12,8 @@
 #include <libsis33.h>
 #include "my_stringify.h"
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 #define PROGNAME	"start"
 
 /* default module number (LUN) */
@@ -24,27 +26,33 @@ extern char *optarg;
 
 static const char usage_string[] =
 	"configure the 'start' of an sis33 device.\n"
-	" " PROGNAME " [-a] [-d] [-h] [-m<LUN>]";
+	" " PROGNAME " [-a] [-d] [-h] [-v] [-m<LUN>]";
 
 static const char commands_string[] =
 	"options:\n"
 	" -a = enable/disable auto mode (bool)\n"
 	" -d = delay\n"
 	" -h = show this help text\n"
-	" -m = Module number (default: " my_stringify(MODULE_NR) ")";
+	" -m = Module number (default: " my_stringify(MODULE_NR) ")\n"
+	" -v = version";
 
 static void usage_complete(void)
 {
 	printf("%s\n", usage_string);
 	printf("%s\n", commands_string);
 }
+static void print_version(void)
+{
+	printf("%s\n", git_version);
+	printf("%s\n", libsis33_version_s);
+}
 
 static void parse_args(int argc, char *argv[])
 {
 	int c;
 
 	for (;;) {
-		c = getopt(argc, argv, "a:d:hm:");
+		c = getopt(argc, argv, "a:d:hvm:");
 		if (c < 0)
 			break;
 		switch (c) {
@@ -57,6 +65,9 @@ static void parse_args(int argc, char *argv[])
 		case 'h':
 			usage_complete();
 			exit(EXIT_SUCCESS);
+		case 'v':
+			print_version();
+			exit(EXIT_SUCCESS);
 		case 'm':
 			module_nr = strtol(optarg, NULL, 0);
 			break;
diff --git a/sis33/lib/examples/stop.c b/sis33/lib/examples/stop.c
index 6b030f22..601845ea 100644
--- a/sis33/lib/examples/stop.c
+++ b/sis33/lib/examples/stop.c
@@ -11,9 +11,11 @@
 #include <unistd.h>
 #include <stdio.h>
 
-#include <libsis33.h>
+#include "libsis33.h"
 #include "my_stringify.h"
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 #define PROGNAME	"stop"
 
 /* default module number (LUN) */
@@ -33,7 +35,8 @@ static const char commands_string[] =
 	" -a = enable/disable auto mode (bool)\n"
 	" -d = delay\n"
 	" -h = show this help text\n"
-	" -m = Module number (default: " my_stringify(MODULE_NR) ")";
+	" -m = Module number (default: " my_stringify(MODULE_NR) ")\n"
+	" -v = version";
 
 static void usage_complete(void)
 {
@@ -41,12 +44,18 @@ static void usage_complete(void)
 	printf("%s\n", commands_string);
 }
 
+static void print_version(void)
+{
+	printf("%s\n", git_version);
+	printf("%s\n", libsis33_version_s);
+}
+
 static void parse_args(int argc, char *argv[])
 {
 	int c;
 
 	for (;;) {
-		c = getopt(argc, argv, "a:d:hm:");
+		c = getopt(argc, argv, "a:d:hvm:");
 		if (c < 0)
 			break;
 		switch (c) {
@@ -59,6 +68,9 @@ static void parse_args(int argc, char *argv[])
 		case 'h':
 			usage_complete();
 			exit(EXIT_SUCCESS);
+		case 'v':
+			print_version();
+			exit(EXIT_SUCCESS);
 		case 'm':
 			module_nr = strtol(optarg, NULL, 0);
 			break;
diff --git a/sis33/lib/examples/stress.c b/sis33/lib/examples/stress.c
index 1adfe9e9..9151c54e 100644
--- a/sis33/lib/examples/stress.c
+++ b/sis33/lib/examples/stress.c
@@ -10,9 +10,11 @@
 #include <unistd.h>
 #include <stdio.h>
 
-#include <libsis33.h>
+#include "libsis33.h"
 #include "my_stringify.h"
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 #define MODULE_NR	0
 #define SEGMENT_NR	0
 #define EV_LENGTH	64
@@ -33,7 +35,7 @@ extern char *optarg;
 
 static const char usage_string[] =
 	"Fetch samples until a timeout expires or a signal arrives\n"
-	" " PROGNAME " [e<EVENTS>] [-h] [-l<LENGTH>] [-m<LUN>] [-s<SEGMENT>] [-t<TIMEOUT>]";
+	" " PROGNAME " [e<EVENTS>] [-h] [-v] [-l<LENGTH>] [-m<LUN>] [-s<SEGMENT>] [-t<TIMEOUT>]";
 
 static const char commands_string[] =
 	"options:\n"
@@ -43,7 +45,8 @@ static const char commands_string[] =
 	my_stringify(EV_LENGTH) "\n"
 	" -m = Module. Default: " my_stringify(MODULE_NR) "\n"
 	" -s = segment. Default: " my_stringify(SEGMENT_NR) "\n"
-	" -t = timeout (duration). 0 (default) to acquire forever\n";
+	" -t = timeout (duration). 0 (default) to acquire forever\n"
+	" -v = version";
 
 static void usage_complete(void)
 {
@@ -51,12 +54,18 @@ static void usage_complete(void)
 	printf("%s\n", commands_string);
 }
 
+static void print_version(void)
+{
+	printf("%s\n", git_version);
+	printf("%s\n", libsis33_version_s);
+}
+
 static void parse_args(int argc, char *argv[])
 {
 	int c;
 
 	for (;;) {
-		c = getopt(argc, argv, "e:hl:m:s:t:");
+		c = getopt(argc, argv, "e:hvl:m:s:t:");
 		if (c < 0)
 			break;
 		switch (c) {
@@ -66,6 +75,9 @@ static void parse_args(int argc, char *argv[])
 		case 'h':
 			usage_complete();
 			exit(EXIT_SUCCESS);
+		case 'v':
+			print_version();
+			exit(EXIT_SUCCESS);
 		case 'l':
 			ev_length = strtoul(optarg, NULL, 0);
 			break;
diff --git a/sis33/lib/examples/trigger.c b/sis33/lib/examples/trigger.c
index 1be940ef..c5db2a17 100644
--- a/sis33/lib/examples/trigger.c
+++ b/sis33/lib/examples/trigger.c
@@ -9,9 +9,11 @@
 #include <unistd.h>
 #include <stdio.h>
 
-#include <libsis33.h>
+#include "libsis33.h"
 #include "my_stringify.h"
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 #define PROGNAME	"trigger"
 
 /* default module number (LUN) */
@@ -24,7 +26,7 @@ extern char *optarg;
 
 static const char usage_string[] =
 	"configure and send triggers on an sis33 device.\n"
-	" " PROGNAME " [-e<BOOL>] [-h] [-m<LUN>] [-s<TRIGGER>]";
+	" " PROGNAME " [-e<BOOL>] [-h] [-v] [-m<LUN>] [-s<TRIGGER>]";
 
 static const char commands_string[] =
 	"options:\n"
@@ -32,7 +34,8 @@ static const char commands_string[] =
 	" -d = delay\n"
 	" -h = show this help text\n"
 	" -m = Module number (default: " my_stringify(MODULE_NR) ")\n"
-	" -s = Send trigger (valid: \"start\" and \"stop\")";
+	" -s = Send trigger (valid: \"start\" and \"stop\")\n"
+	" -v = version";
 
 static void usage_complete(void)
 {
@@ -40,12 +43,18 @@ static void usage_complete(void)
 	printf("%s\n", commands_string);
 }
 
+static void print_version(void)
+{
+	printf("%s\n", git_version);
+	printf("%s\n", libsis33_version_s);
+}
+
 static void parse_args(int argc, char *argv[])
 {
 	int c;
 
 	for (;;) {
-		c = getopt(argc, argv, "e:hm:s:");
+		c = getopt(argc, argv, "e:hvm:s:");
 		if (c < 0)
 			break;
 		switch (c) {
@@ -55,6 +64,9 @@ static void parse_args(int argc, char *argv[])
 		case 'h':
 			usage_complete();
 			exit(EXIT_SUCCESS);
+		case 'v':
+			print_version();
+			exit(EXIT_SUCCESS);
 		case 'm':
 			module_nr = strtol(optarg, NULL, 0);
 			break;
diff --git a/sis33/lib/examples/two_segments.c b/sis33/lib/examples/two_segments.c
index 58ff6d8b..acfae918 100644
--- a/sis33/lib/examples/two_segments.c
+++ b/sis33/lib/examples/two_segments.c
@@ -9,9 +9,11 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <libsis33.h>
+#include "libsis33.h"
 #include "my_stringify.h"
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 /* default module number (LUN) */
 #define MODULE_NR	0
 
@@ -23,13 +25,14 @@ extern char *optarg;
 
 static const char usage_string[] =
 	"Sample from two sis33 segments\n"
-	" " PROGNAME " [-h] [-l<LENGTH>] [-m<LUN>]";
+	" " PROGNAME " [-h] [-v] [-l<LENGTH>] [-m<LUN>]";
 
 static const char commands_string[] =
 	"options:\n"
 	" -h = show this help text\n"
 	" -l = event length (number of samples per event)\n"
-	" -m = Module number (default: " my_stringify(MODULE_NR) ")";
+	" -m = Module number (default: " my_stringify(MODULE_NR) ")\n"
+	" -v = version";
 
 static void usage_complete(void)
 {
@@ -37,18 +40,27 @@ static void usage_complete(void)
 	printf("%s\n", commands_string);
 }
 
+static void print_version(void)
+{
+	printf("%s\n", git_version);
+	printf("%s\n", libsis33_version_s);
+}
+
 static void parse_args(int argc, char *argv[])
 {
 	int c;
 
 	for (;;) {
-		c = getopt(argc, argv, "hl:m:");
+		c = getopt(argc, argv, "hvl:m:");
 		if (c < 0)
 			break;
 		switch (c) {
 		case 'h':
 			usage_complete();
 			exit(EXIT_SUCCESS);
+		case 'v':
+			print_version();
+			exit(EXIT_SUCCESS);
 		case 'l':
 			ev_length = strtoul(optarg, NULL, 0);
 			break;
diff --git a/sis33/lib/examples/version.c b/sis33/lib/examples/version.c
index 5b815392..08fa294d 100644
--- a/sis33/lib/examples/version.c
+++ b/sis33/lib/examples/version.c
@@ -6,11 +6,15 @@
 
 #include <stdio.h>
 
-#include <libsis33.h>
+#include "libsis33.h"
 #include "my_stringify.h"
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 int main(int argc, char *argv[])
 {
 	printf("%s\n", libsis33_version ? libsis33_version : "Unknown");
+	printf("%s\n", git_version);
+	printf("%s\n", libsis33_version_s);
 	return 0;
 }
diff --git a/sis33/lib/sis33.c b/sis33/lib/sis33.c
index 92c6e45a..23e9e66b 100644
--- a/sis33/lib/sis33.c
+++ b/sis33/lib/sis33.c
@@ -18,7 +18,7 @@
 #include <fcntl.h>
 #include <stdio.h>
 
-#include <libsis33.h>
+#include "libsis33.h"
 #include "sis33acq.h"
 #include "sis33dev.h"
 #include "libinternal.h"
diff --git a/sis33/test/Makefile b/sis33/test/Makefile
index 5d3ae593..c008c514 100644
--- a/sis33/test/Makefile
+++ b/sis33/test/Makefile
@@ -5,6 +5,7 @@ VPATH = ../../utils/extest ../lib
 INCDIR := ../include
 CFLAGS := -Wall -g -I$(INCDIR) -I../../include -I../../utils/extest -I../lib \
 	-I../../utils/user -DDRIVER_NAME=\"sis33\"
+CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
 LIBUTILSPATH := ../../utils/user
 LIBUTILS := $(LIBUTILSPATH)/libutils.$(CPU).a
 LDLIBS := -lxml2 -lreadline -lrt
diff --git a/sis33/test/sis33test.c b/sis33/test/sis33test.c
index f003c99c..8a271584 100644
--- a/sis33/test/sis33test.c
+++ b/sis33/test/sis33test.c
@@ -16,6 +16,8 @@
 #include "sis33acq.h"
 #include "sis33dev.h"
 
+static char git_version[] = "sis33test version: " GIT_VERSION;
+
 #define SIS33T_MAX_NR_SEGMENTS	8
 
 int use_builtin_cmds = 0;
@@ -1057,6 +1059,7 @@ int main(int argc, char *argv[], char *envp[])
 	int *indexes;
 	int ndevs;
 
+	printf("%s\n", git_version);
 	/* try to control the first device */
 	ndevs = sis33dev_get_nr_devices();
 	if (!ndevs)
diff --git a/vd80-2/lib/test/Makefile b/vd80-2/lib/test/Makefile
index 3334b6ad..941ef58a 100644
--- a/vd80-2/lib/test/Makefile
+++ b/vd80-2/lib/test/Makefile
@@ -11,6 +11,7 @@ DRIVER = $(VD80LB)/../driver
 
 
 CFLAGS = -g -Wall -I $(VD80LB) -I $(DRIVER) -DCOMPILE_TIME=$(COMPILE_TIME)
+CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
 
 LDLIBS = $(VD80LB)/libvd80.$(CPU).a
 
diff --git a/vd80-2/lib/test/vd80test.c b/vd80-2/lib/test/vd80test.c
index 3ac2d2b6..3475f209 100644
--- a/vd80-2/lib/test/vd80test.c
+++ b/vd80-2/lib/test/vd80test.c
@@ -16,8 +16,10 @@
 #include <stdint.h>
 #include <sys/mman.h>
 
-#include <vd80.h>
-#include <libvd80.h>
+#include "vd80.h"
+#include "libvd80.h"
+
+static char git_version[] = "git_version: " GIT_VERSION;
 
 #define NEWS 1
 #define HISTORIES 24
@@ -48,7 +50,9 @@ int main(int argc,char *argv[])
 	char tmpb[CMD_BUF_SIZE];
 
 	pname = argv[0];
-	printf("%s: Compiled %s %s\n",pname,__DATE__,__TIME__);
+	printf("%s: Compiled %s %s\n", pname,__DATE__,__TIME__);
+	printf("%s: %s\n", pname, git_version);
+	printf("%s\n", libvd80_version_s);
 
 	if (argc > 1)
 		dev = strtoul(argv[1],&cp,0);
diff --git a/vmebridge/test/berrtest.c b/vmebridge/test/berrtest.c
index e102f5f5..77ad8a24 100644
--- a/vmebridge/test/berrtest.c
+++ b/vmebridge/test/berrtest.c
@@ -12,6 +12,8 @@
 
 #include <libvmebus.h>
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 /* Number of (faulty) accesses to be done */
 #define ACCESSES	4
 
@@ -28,6 +30,9 @@ int main(int argc, char *argv[])
 	int berr;
 	int i;
 
+	printf("%s: %s\n", argv[0], git_version);
+	printf("%s\n", libvmebus_version_s);
+
 	memset(&mapping, 0, sizeof(struct vme_mapping));
 
 	mapping.sizel		= MAP_SIZE;
diff --git a/vmebridge/test/create_window.c b/vmebridge/test/create_window.c
index e8dfd943..d1485286 100644
--- a/vmebridge/test/create_window.c
+++ b/vmebridge/test/create_window.c
@@ -22,6 +22,8 @@ int am, dsize, vmeaddr, length;
 
 #define VME_MWINDOW_DEV "/dev/vme_mwindow"
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 void usage(char * prgname)
 {
 	printf("Usage: %s winnum am dwidth vmeaddr size\n", prgname);
@@ -30,6 +32,7 @@ void usage(char * prgname)
 	printf(" data width:     16 or 32\n");
 	printf(" VME address:    VME start address\n");
 	printf(" size:           window size\n");
+	printf("\n%s\n", git_version);
 }
 
 void parse_args(int argc, char **argv)
diff --git a/vmebridge/test/destroy_window.c b/vmebridge/test/destroy_window.c
index ec28feb8..dd7e537d 100644
--- a/vmebridge/test/destroy_window.c
+++ b/vmebridge/test/destroy_window.c
@@ -15,6 +15,8 @@
 
 #include <vmebus.h>
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 int window_num;
 
 #define VME_MWINDOW_DEV "/dev/vme_mwindow"
@@ -23,6 +25,7 @@ void usage(char * prgname)
 {
 	printf("Usage: %s winnum\n", prgname);
 	printf(" window:         0..7\n");
+	printf("\n%s\n", git_version);
 }
 
 void parse_args(int argc, char **argv)
diff --git a/vmebridge/test/hsm-dma.c b/vmebridge/test/hsm-dma.c
index ca513800..222fafb4 100644
--- a/vmebridge/test/hsm-dma.c
+++ b/vmebridge/test/hsm-dma.c
@@ -29,6 +29,8 @@
 #define HSM_AM		VME_A32_USER_BLT
 #define HSM_DW		VME_D32
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 struct stats {
 	int	cycles;
 	double	delta;
@@ -225,6 +227,8 @@ int main(int argc, char *argv[])
 			"     default: 0 (loop forever.)\n"
 			"This program can be interrupted anytime with the "
 			"TERM or INT signals\n");
+		printf("\n%s\n", git_version);
+		printf("%s\n", libvmebus_version_s);
 		exit(EXIT_FAILURE);
 	}
 	sscanf(argv[1], "%d", &duration);
diff --git a/vmebridge/test/mm6390-dma.c b/vmebridge/test/mm6390-dma.c
index 563cd5ee..f0c32413 100644
--- a/vmebridge/test/mm6390-dma.c
+++ b/vmebridge/test/mm6390-dma.c
@@ -15,6 +15,8 @@
 
 #include <libvmebus.h>
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 /* Registers address space */
 #define REGS_BASE	0
 #define REGS_OFFSET	0xbe00
@@ -57,6 +59,9 @@ int main(int argc, char **argv)
 	double delta;
 	double throughput;
 
+	printf("%s %s\n", argv[0], git_version);
+	printf("%s\n", libvmebus_version_s);
+
 	/* Open a mapping for the CSR register */
 	memset(&regs_desc, 0, sizeof(struct vme_mapping));
 
diff --git a/vmebridge/test/setflag.c b/vmebridge/test/setflag.c
index 0c08c45e..9578899b 100644
--- a/vmebridge/test/setflag.c
+++ b/vmebridge/test/setflag.c
@@ -15,6 +15,8 @@
 
 #include <vmebus.h>
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 char *prgname;
 int force_create = -1;
 int force_destroy = -1;
@@ -29,6 +31,7 @@ void usage()
 	printf(" -c:    Set or clear force create flag\n");
 	printf(" -d:    Set or clear force destroy flag\n");
 	printf(" -s:    Show the current flags status\n");
+	printf("\n%s\n", git_version);
 	printf("\n");
 }
 
diff --git a/vmebridge/test/test_mapping.c b/vmebridge/test/test_mapping.c
index 4e9a16bd..2269b491 100644
--- a/vmebridge/test/test_mapping.c
+++ b/vmebridge/test/test_mapping.c
@@ -16,6 +16,7 @@
 
 #include <vmebus.h>
 
+static char git_version[] = "git_version: " GIT_VERSION;
 char *prgname;
 struct vme_mapping mapping;
 int am = -1;
@@ -40,6 +41,7 @@ void usage()
 	printf(" -w dwidth:      Data width 16 or 32\n");
 	printf(" -a vmeaddr:     VME start address (in hex)\n");
 	printf(" -s size:        mapping size (in hex)\n");
+	printf("\n%s\n", git_version);
 	printf("\n");
 }
 
diff --git a/vmebridge/test/testctr.c b/vmebridge/test/testctr.c
index 90b2c4b3..d4160aa1 100644
--- a/vmebridge/test/testctr.c
+++ b/vmebridge/test/testctr.c
@@ -57,6 +57,8 @@
 
 #include <vmebus.h>
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 #define VME_MWINDOW_DEV "/dev/vme_mwindow"
 
 #define MODULE_AM	VME_A24_USER_DATA_SCT
@@ -84,6 +86,8 @@ int main(int argc, char **argv)
 	unsigned int test;
 	int bus_err;
 
+	printf("%s: %s\n\n", argv[0], git_version);
+
 	/* Setup the mapping descriptor */
 	memset(&desc, 0, sizeof(struct vme_mapping));
 
diff --git a/vmebridge/test/testctr2.c b/vmebridge/test/testctr2.c
index 0fbfd064..46945c5b 100644
--- a/vmebridge/test/testctr2.c
+++ b/vmebridge/test/testctr2.c
@@ -53,6 +53,7 @@
 
 #include <libvmebus.h>
 
+static char git_version[] = "git_version: " GIT_VERSION;
 
 #define MODULE_AM	VME_A24_USER_DATA_SCT
 #define MODULE_DW	VME_D32
@@ -66,6 +67,9 @@ int main(int argc, char **argv)
 	unsigned int *vme_buf;
 	unsigned int val;
 
+	printf("%s: %s\n", argv[0], git_version);
+	printf("%s\n\n", libvmebus_version_s);
+
 	memset(&param, 0, sizeof(struct pdparam_master));
 
 	if ((vme_buf = (unsigned int *)find_controller(MODULE_VME_ADDR,
diff --git a/vmebridge/test/testctr_ces.c b/vmebridge/test/testctr_ces.c
index 8f483493..23e65559 100644
--- a/vmebridge/test/testctr_ces.c
+++ b/vmebridge/test/testctr_ces.c
@@ -52,6 +52,7 @@
 
 #include <libvmebus.h>
 
+static char git_version[] = "git_version: " GIT_VERSION;
 
 #define MODULE_AM	VME_A24_USER_DATA_SCT
 #define MODULE_DW	VME_D32
@@ -67,6 +68,9 @@ int main(int argc, char **argv)
 	unsigned int val;
 	unsigned int saved;
 
+	printf("%s: %s\n", argv[0], git_version);
+	printf("%s\n\n", libvmebus_version_s);
+
 	memset(&param, 0, sizeof(struct pdparam_master));
 
 	if ((vme_buf = (unsigned int *)find_controller(MODULE_VME_ADDR,
diff --git a/vmebridge/test/testvd80.c b/vmebridge/test/testvd80.c
index b382848d..fbe6790e 100644
--- a/vmebridge/test/testvd80.c
+++ b/vmebridge/test/testvd80.c
@@ -14,6 +14,8 @@
 #include <libvmebus.h>
 #include "libvd80.h"
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 #define CHAN_USED	1
 
 unsigned int shot_samples;
@@ -294,6 +296,10 @@ int main(int argc, char **argv)
 {
 	int rc = 0;
 
+	printf("%s: %s\n", argv[0], git_version);
+	printf("%s\n", libvmebus_version_s);
+	printf("%s\n\n", libvd80vmebridge_version_s);
+
 	if (vd80_map())
 		exit(1);
 
diff --git a/vmebridge/test/testvd802.c b/vmebridge/test/testvd802.c
index ef289348..55794962 100644
--- a/vmebridge/test/testvd802.c
+++ b/vmebridge/test/testvd802.c
@@ -14,6 +14,8 @@
 #include <libvmebus.h>
 #include "vd80.h"
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 #define VD80_SETUP_BASE	0x580000
 #define VD80_SETUP_SIZE	0x80000
 #define VD80_SETUP_AM	VME_CR_CSR
@@ -991,6 +993,9 @@ int main(int argc, char **argv)
 {
 	int rc = 0;
 
+	printf("%s: %s\n", argv[0], git_version);
+	printf("%s\n\n", libvmebus_version_s);
+
 	if (vd80_map())
 		exit(1);
 
diff --git a/vmebridge/test/vd80spd-dma.c b/vmebridge/test/vd80spd-dma.c
index a27baede..44e5f97f 100644
--- a/vmebridge/test/vd80spd-dma.c
+++ b/vmebridge/test/vd80spd-dma.c
@@ -15,6 +15,8 @@
 #include <libvmebus.h>
 #include "libvd80.h"
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 #define CHAN_USED	16
 #define MAX_MBLT_FRAMES	492
 #define MAX_BLT_FRAMES	44
@@ -279,6 +281,10 @@ int main(int argc, char **argv)
 {
 	int rc = 0;
 
+	printf("%s: %s\n", argv[0], git_version);
+	printf("%s\n", libvmebus_version_s);
+	printf("%s\n\n", libvd80vmebridge_version_s);
+
 	if (vd80_map())
 		exit(1);
 
diff --git a/vmebridge/test/vd80spd.c b/vmebridge/test/vd80spd.c
index 5465516a..951d4322 100644
--- a/vmebridge/test/vd80spd.c
+++ b/vmebridge/test/vd80spd.c
@@ -14,6 +14,8 @@
 #include <libvmebus.h>
 #include "libvd80.h"
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 #define CHAN_USED	16
 
 unsigned int shot_samples;
@@ -166,6 +168,10 @@ int main(int argc, char **argv)
 {
 	int rc = 0;
 
+	printf("%s: %s\n", argv[0], git_version);
+	printf("%s\n", libvmebus_version_s);
+	printf("%s\n\n", libvd80vmebridge_version_s);
+
 	if (vd80_map())
 		exit(1);
 
diff --git a/vmebridge/tools/Makefile b/vmebridge/tools/Makefile
index aedff80c..7d2fc350 100644
--- a/vmebridge/tools/Makefile
+++ b/vmebridge/tools/Makefile
@@ -2,6 +2,7 @@
 include ../../common.mk
 
 CFLAGS = -Wall -I../include $(EXTRACFLAGS)
+CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
 LDFLAGS = -L../lib
 LDLIBS = -lvmebus.$(CPU)
 
diff --git a/vmebridge/tools/vme.c b/vmebridge/tools/vme.c
index 9e931921..79d6f64d 100644
--- a/vmebridge/tools/vme.c
+++ b/vmebridge/tools/vme.c
@@ -6,8 +6,13 @@
 #include <arpa/inet.h>
 #include <libvmebus.h>
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
+void print_version(void);
+
 void usage(char *prog)
 {
+
 	fprintf(stderr,
 		"usage: %s [-v vme_address][options]\n\n", prog);
 	fprintf(stderr,
@@ -36,6 +41,8 @@ void usage(char *prog)
 		"  -H         : hide the address\n");
 	fprintf(stderr,
 		"  -h         : print this help\n");
+	fprintf(stderr,
+		"  -V         : version\n");
 	fprintf(stderr, "\n");
 	fprintf(stderr,
 		"Data Width\n");
@@ -51,9 +58,16 @@ void usage(char *prog)
 	fprintf(stderr, "  0x29 A16 user data\n");
 	fprintf(stderr, "  0x39 A24 user data\n");
 	fprintf(stderr, "\n");
+	print_version();
 	exit(1);
 }
 
+void print_version(void)
+{
+	fprintf(stderr, "%s\n", git_version);
+	fprintf(stderr, "%s\n", libvmebus_version_s);
+}
+
 int is_invalid_width(int data_width)
 {
 	return (data_width != 8 &&
@@ -113,7 +127,7 @@ int main(int argc, char *argv[])
 	offsets_on = 1;
 	offset = 0;
 	length = 0x80000;
-	while ((c = getopt(argc, argv, "Hv:s:D:d:a:n:w:l:h")) != -1) {
+	while ((c = getopt(argc, argv, "Hv:s:D:d:a:n:w:l:hV")) != -1) {
 		switch (c) {
 		case 'H':
 			offsets_on = 0;
@@ -153,6 +167,9 @@ int main(int argc, char *argv[])
 		case 'h':
 			usage(argv[0]);
 			break;
+		case 'V':
+			print_version();
+			exit(1);
 		default:
 			break;
 		}
diff --git a/vmod/test/Makefile b/vmod/test/Makefile
index 1691eaa6..50c29ad4 100644
--- a/vmod/test/Makefile
+++ b/vmod/test/Makefile
@@ -2,6 +2,7 @@
 include ../../common.mk
 
 CFLAGS += -I ../include/ -I./ -I../driver/
+CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
 LDFLAGS += -L ../lib
 LDLIBS += -lvmodttl.$(CPU) -lvmoddor.$(CPU) -lpthread -lvmod.$(CPU)
 
diff --git a/vmod/test/load_test.c b/vmod/test/load_test.c
index ed1943fd..3c892d80 100644
--- a/vmod/test/load_test.c
+++ b/vmod/test/load_test.c
@@ -41,6 +41,8 @@
 
 #include	"libvmodttl.h"
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 int device;
 
 void *annoying_thread(void *thd)
@@ -74,6 +76,9 @@ int main (int argc, char *argv[])
 	printf(" | Created by: Samuel I. Gonsalvez      | \n");
 	printf(" | Email: siglesia@cern.ch              | \n");
 	printf(" |______________________________________| \n");
+	printf("\n");
+	printf("%s\n", git_version);
+	printf("%s\n", libvmodttl_version_s);
 
 	if (argc == 2)
 	{
diff --git a/vmod/test/tstlib12a2.c b/vmod/test/tstlib12a2.c
index 513041d7..4563aa6d 100644
--- a/vmod/test/tstlib12a2.c
+++ b/vmod/test/tstlib12a2.c
@@ -11,6 +11,7 @@
 	#include "libvmod12a2.h"
 #endif
 
+static char git_version[] = "git_version: " GIT_VERSION;
 
 /* VMOD 12A2 precision */
 #define VMOD_DAC_INPUT_RANGE (1<<12)
@@ -27,7 +28,9 @@ int volts2digital(float volts)
 
 void usage(char *progname)
 {
-	fprintf(stderr, "usage: %s lun channel volts\n", progname);
+	fprintf(stderr, "usage: %s lun channel volts\n\n", progname);
+	fprintf(stderr, "%s\n", git_version);
+	fprintf(stderr, "%s\n", libvmod_version_s);
 }
 
 int main(int argc, char *argv[])
diff --git a/vmod/test/tstlib12a4.c b/vmod/test/tstlib12a4.c
index d447fcb0..ee5b94ff 100644
--- a/vmod/test/tstlib12a4.c
+++ b/vmod/test/tstlib12a4.c
@@ -11,6 +11,7 @@
 	#include "libvmod12a4.h"
 #endif
 
+static char git_version[] = "git_version: " GIT_VERSION;
 
 /* VMOD 12A4 precision */
 #define VMOD_DAC_INPUT_RANGE (1<<12)
@@ -27,7 +28,9 @@ int volts2digital(float volts)
 
 void usage(char *progname)
 {
-	fprintf(stderr, "usage: %s lun channel volts\n", progname);
+	fprintf(stderr, "usage: %s lun channel volts\n\n", progname);
+	fprintf(stderr, "%s\n", git_version);
+	fprintf(stderr, "%s\n", libvmod_version_s);
 }
 
 int main(int argc, char *argv[])
diff --git a/vmod/test/tstlib12e16.c b/vmod/test/tstlib12e16.c
index a5bf309d..f4860973 100644
--- a/vmod/test/tstlib12e16.c
+++ b/vmod/test/tstlib12e16.c
@@ -7,6 +7,7 @@
 	#include "libvmod12e16.h"
 #endif
 
+static char git_version[] = "git_version: " GIT_VERSION;
 
 int main(int argc, char *argv[])
 {
@@ -15,7 +16,9 @@ int main(int argc, char *argv[])
 	float decimal;
 
 	if (argc != 4) {
-		fprintf(stderr, "usage: %s lun channel ampli\n", argv[0]);
+		fprintf(stderr, "usage: %s lun channel ampli\n\n", argv[0]);
+		fprintf(stderr, "%s\n", git_version);
+		fprintf(stderr, "%s\n", libvmod_version_s);
 		return 1;
 	}
 
diff --git a/vmod/test/tstlib16a2.c b/vmod/test/tstlib16a2.c
index a16297e5..e33d97e8 100644
--- a/vmod/test/tstlib16a2.c
+++ b/vmod/test/tstlib16a2.c
@@ -11,6 +11,8 @@
 	#include "libvmod16a2.h"
 #endif
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 /* VMOD 16A2 precision */
 #define VMOD_DAC_INPUT_RANGE (1<<16)
 
@@ -26,7 +28,9 @@ int volts2digital(float volts)
 
 void usage(void)
 {
-	fprintf(stderr, "usage: pp lun channel volts\n");
+	fprintf(stderr, "usage: pp lun channel volts\n\n");
+	fprintf(stderr, "%s\n", git_version);
+	fprintf(stderr, "%s\n", libvmod_version_s);
 }
 
 int main(int argc, char *argv[])
diff --git a/vmod/test/tstlibdor.c b/vmod/test/tstlibdor.c
index 503db4a3..90d4c193 100644
--- a/vmod/test/tstlibdor.c
+++ b/vmod/test/tstlibdor.c
@@ -13,6 +13,8 @@
 	#include "libvmoddor.h"
 #endif
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 int main (int argc, char *argv[])
 {
 	int lun = -1;
@@ -25,7 +27,8 @@ int main (int argc, char *argv[])
 			"<offset>	value of the offset (first channel) applied.\n"
 			"<size>		size of the data (4, 8, 16 channels).\n"
 			"<value>	integer value to be written (dec, hex and oct accepted).\n");
-
+		printf("\n%s\n", git_version);
+		printf("%s\n", libvmoddor_version_s);
 		exit(-1);
 	} 
 	else
diff --git a/vmod/test/tstlibttl.c b/vmod/test/tstlibttl.c
index 8bfa3f5e..3e919be0 100644
--- a/vmod/test/tstlibttl.c
+++ b/vmod/test/tstlibttl.c
@@ -42,6 +42,8 @@
 	#include "libvmodttl.h"
 #endif
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 int device;
 
 void write_channel(int pd)
@@ -89,6 +91,9 @@ int main (int argc, char *argv[])
 	printf(" | Created by: Samuel I. Gonsalvez      | \n");
 	printf(" | Email: siglesia@cern.ch              | \n");
 	printf(" |______________________________________| \n");
+	printf("\n");
+	printf("%s\n", git_version);
+	printf("%s\n", libvmodttl_version_s);
 
 	if (argc == 2)
 	{
diff --git a/vmod/test/tstlibttl_quick_read.c b/vmod/test/tstlibttl_quick_read.c
index fcbb7a1b..0765da9a 100644
--- a/vmod/test/tstlibttl_quick_read.c
+++ b/vmod/test/tstlibttl_quick_read.c
@@ -42,6 +42,8 @@
 	#include "libvmodttl.h"
 #endif
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 int device;
 
 void write_channel(int pd)
@@ -87,7 +89,9 @@ int main (int argc, char *argv[])
 	printf(" | Created by: Samuel I. Gonsalvez      | \n");
 	printf(" | Email: siglesia@cern.ch              | \n");
 	printf(" |______________________________________| \n");
-
+	printf("\n");
+	printf("%s\n", git_version);
+	printf("%s\n", libvmodttl_version_s);
 	if (argc == 2)
 	{
 		device = atoi(argv[1]);
diff --git a/vmod/test/tstlibttl_quick_write.c b/vmod/test/tstlibttl_quick_write.c
index ea47f7b7..82989da1 100644
--- a/vmod/test/tstlibttl_quick_write.c
+++ b/vmod/test/tstlibttl_quick_write.c
@@ -42,6 +42,8 @@
 	#include "libvmodttl.h"
 #endif
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 int device;
 
 int main (int argc, char *argv[])
@@ -57,6 +59,9 @@ int main (int argc, char *argv[])
 	printf(" | Created by: Samuel I. Gonsalvez      | \n");
 	printf(" | Email: siglesia@cern.ch              | \n");
 	printf(" |______________________________________| \n");
+	printf("\n");
+	printf("%s\n", git_version);
+	printf("%s\n", libvmodttl_version_s);
 
 	if (argc == 2)
 	{
diff --git a/vmod/test/tstlibttl_read_device.c b/vmod/test/tstlibttl_read_device.c
old mode 100755
new mode 100644
index 87dc3184..7f2d4bde
--- a/vmod/test/tstlibttl_read_device.c
+++ b/vmod/test/tstlibttl_read_device.c
@@ -45,6 +45,8 @@
 	#include "libvmodttl.h"
 #endif
 
+static char git_version[] = "git_version: " GIT_VERSION;
+
 int device;
 
 /* Thread for incomming messages */
@@ -123,6 +125,9 @@ int main (int argc, char *argv[])
 	printf(" | Created by: Samuel I. Gonsalvez      | \n");
 	printf(" | Email: siglesia@cern.ch              | \n");
 	printf(" |______________________________________| \n");
+	printf("\n");
+	printf("%s\n", git_version);
+	printf("%s\n", libvmodttl_version_s);
 
 	if (argc == 2)
 	{
-- 
GitLab