[PATCH 1/2] embed version number in tgtd and tgtadm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If you compile the git tree, you get:

fujita@lily:~/git/tgt/usr$ ./tgtadm -h
Usage: tgtadm [OPTION]
Linux SCSI Target Framework Administration Utility, version 0.9.2-git-9f4cbd1


If you compile a release version (or on a box without git installed),
you get:

fujita@lily:/tmp/tgt-0.9.2/usr$ ./tgtadm -h
Usage: tgtadm [OPTION]
Linux SCSI Target Framework Administration Utility, version 0.9.2


Signed-off-by: FUJITA Tomonori <fujita.tomonori@xxxxxxxxxxxxx>
---
 usr/Makefile |    4 ++++
 usr/tgtadm.c |    4 ++--
 usr/tgtd.c   |    4 ++--
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/usr/Makefile b/usr/Makefile
index fba86c0..d77d5e8 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -1,3 +1,6 @@
+VERSION = 0.9.2
+EXTRAVERSION = $(if $(shell git-show-ref 2>/dev/null),-git-$(shell git-show-ref --heads --abbrev|awk '/refs\/heads\/master/{print $$1}'))
+
 mandir = /usr/share/man
 
 ifneq ($(IBMVIO),)
@@ -51,6 +54,7 @@ INCLUDES += -I. -I../include -I$(KERNELSRC)/include
 CFLAGS += -D_GNU_SOURCE
 CFLAGS += $(INCLUDES)
 CFLAGS += -g -O2 -Wall -Wstrict-prototypes -fPIC
+CFLAGS += -DTGT_VERSION=\"$(VERSION)$(EXTRAVERSION)\"
 
 LIBS += -lpthread
 
diff --git a/usr/tgtadm.c b/usr/tgtadm.c
index de7aed1..8d20c9c 100644
--- a/usr/tgtadm.c
+++ b/usr/tgtadm.c
@@ -122,7 +122,7 @@ static void usage(int status)
 	else {
 		printf("Usage: %s [OPTION]\n", program_name);
 		printf("\
-Linux SCSI Target Framework Administration Utility.\n\
+Linux SCSI Target Framework Administration Utility, version %s\n\
 \n\
   --lld [driver] --mode target --op new --tid=[id] --targetname [name]\n\
                         add a new target with [id] and [name]. [id] must not be zero.\n\
@@ -164,7 +164,7 @@ Linux SCSI Target Framework Administration Utility.\n\
                         target.\n\
   --help                display this help and exit\n\
 \n\
-Report bugs to <stgt-devel@xxxxxxxxxxxxxxxx>.\n");
+Report bugs to <stgt-devel@xxxxxxxxxxxxxxxx>.\n", TGT_VERSION);
 	}
 	exit(status == 0 ? 0 : EINVAL);
 }
diff --git a/usr/tgtd.c b/usr/tgtd.c
index 520e77c..8569d41 100644
--- a/usr/tgtd.c
+++ b/usr/tgtd.c
@@ -64,11 +64,11 @@ static void usage(int status)
 	else {
 		printf("Usage: %s [OPTION]\n", program_name);
 		printf("\
-Target framework daemon.\n\
+Target framework daemon, version %s\n\
   -f, --foreground        make the program run in the foreground\n\
   -d, --debug debuglevel  print debugging information\n\
   -h, --help              display this help and exit\n\
-");
+", TGT_VERSION);
 	}
 	exit(status);
 }
-- 
1.5.5.GIT

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux