[ofa-general] [PATCH] opensm: update OpenSM version according to the tree state

Sasha Khapyorsky sashak at voltaire.com
Sun Jan 6 15:01:39 PST 2008


There is automatic OpenSM version (in generated osm_version.h file)
updater. It takes results from gen_ver.sh script, generated version has
form of:

* 3.1.8 , when tree state is equivalent to the opensm-3.1.8 release tag
* 3.1.8-4449c46 , same + git commit abbreviation, it is when the tree
                  is different from the release tag
* 3.1.8-4449c46-dirty, same as above, but the tree also has uncommitted
                       changes

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/opensm/Makefile.am |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/opensm/opensm/Makefile.am b/opensm/opensm/Makefile.am
index 9511a80..a5d9515 100644
--- a/opensm/opensm/Makefile.am
+++ b/opensm/opensm/Makefile.am
@@ -102,6 +102,18 @@ opensminclude_HEADERS = $(srcdir)/../include/opensm/osm_base.h \
 			$(srcdir)/../include/opensm/osm_helper.h \
 			$(srcdir)/../include/opensm/osm_event_plugin.h
 
+BUILT_SOURCES = osm_version
+osm_version:
+	if [ -x $(top_srcdir)/../gen_ver.sh ] ; then \
+		ver_file=$(srcdir)/../include/opensm/osm_version.h ; \
+		osm_ver=`cat $$ver_file | sed -ne '/#define OSM_VERSION /s/^.*\"OpenSM \(.*\)\"$$/\1/p'` ; \
+		ver=`$(top_srcdir)/../gen_ver.sh $$PACKAGE` ; \
+		if [ $$ver != $$osm_ver ] ; then \
+			cat $$ver_file | sed -e '/#define OSM_VERSION /s/\"OpenSM \(.*\)\"/\"OpenSM '$$ver'\"/' > tmp_new_version ; \
+			cat tmp_new_version > $$ver_file && rm -f tmp_new_version ; \
+		fi ; \
+	fi
+
 # headers are distributed as part of the include dir
 EXTRA_DIST = $(srcdir)/libopensm.map $(srcdir)/libopensm.ver \
 	     $(srcdir)/ChangeLog \
-- 
1.5.4.rc2.38.gd6da3




More information about the general mailing list