[dvblast-devel] [PATCH 03/20] Define VERSION_EXTRA using git describe in the Makefile.

Georgi Chorbadzhiyski gf at unixsol.org
Mon Sep 5 09:52:38 CEST 2011


---
 Makefile     |    6 ++++++
 dvblast.c    |    2 +-
 dvblastctl.c |    2 +-
 version.h    |    1 -
 4 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index fc9dae9..faad3dc 100644
--- a/Makefile
+++ b/Makefile
@@ -3,9 +3,15 @@
 
 VERSION = 2.0.0
 TOPDIR = `basename ${PWD}`
+GIT_VER = $(shell git describe --tags --dirty --always 2>/dev/null)
 
 CFLAGS += -Wall -Wformat-security -O3 -fomit-frame-pointer
 CFLAGS += -g
+ifneq "$(GIT_VER)" ""
+CFLAGS += -DVERSION_EXTRA=\"git-$(GIT_VER)\"
+else
+CFLAGS += -DVERSION_EXTRA=\"release\"
+endif
 LDLIBS += -lrt
 LDLIBS_DVBLAST += -lpthread
 
diff --git a/dvblast.c b/dvblast.c
index 7cd6c7e..e86662e 100644
--- a/dvblast.c
+++ b/dvblast.c
@@ -396,7 +396,7 @@ static void SigHandler( int i_signal )
  *****************************************************************************/
 static void DisplayVersion()
 {
-    msg_Raw( NULL, "DVBlast %d.%d.%d%s", VERSION_MAJOR, VERSION_MINOR,
+    msg_Raw( NULL, "DVBlast %d.%d.%d (%s)", VERSION_MAJOR, VERSION_MINOR,
                                          VERSION_REVISION, VERSION_EXTRA );
 }
 
diff --git a/dvblastctl.c b/dvblastctl.c
index 5211074..4dd5ecb 100644
--- a/dvblastctl.c
+++ b/dvblastctl.c
@@ -47,7 +47,7 @@ int i_syslog = 0;
 
 void usage()
 {
-    msg_Raw( NULL, "DVBlastctl %d.%d.%d%s", VERSION_MAJOR, VERSION_MINOR,
+    msg_Raw( NULL, "DVBlastctl %d.%d.%d (%s)", VERSION_MAJOR, VERSION_MINOR,
              VERSION_REVISION, VERSION_EXTRA );
     msg_Raw( NULL, "Usage: dvblastctl -r <remote socket> reload|shutdown|fe_status|mmi_status|mmi_open|mmi_close|mmi_get|mmi_send_text|mmi_send_choice [<CAM slot>] [<text/choice>]" );
     exit(1);
diff --git a/version.h b/version.h
index 15acf9c..1e78eca 100644
--- a/version.h
+++ b/version.h
@@ -24,4 +24,3 @@
 #define VERSION_MAJOR 2
 #define VERSION_MINOR 0
 #define VERSION_REVISION 0
-#define VERSION_EXTRA "-svn"
-- 
1.7.5.1



More information about the dvblast-devel mailing list