[openib-general] Re: [PATCH] osm: support osm_svn_revision.h in case ofSVN export

Shay Levin nvshayl at netvision.net.il
Mon Jan 30 07:04:37 PST 2006


test

-----Original Message-----
From:	openib-general-bounces at openib.org on behalf of Michael S. Tsirkin
Sent:	Mon 1/30/2006 4:53 PM
To:	Hal Rosenstock
Cc:	OPENIB
Subject:	[openib-general] Re: [PATCH] osm: support osm_svn_revision.h in	case ofSVN export

Quoting r. Eitan Zahavi <eitan at mellanox.co.il>:
> Subject: [PATCH] osm: support osm_svn_revision.h in case ofSVN export
> 
> Hi Hal
> 
> We are using SVN export when building standalone OpenSM packages.
> During the SVN export we overwrite the osm_svn_revision.h with the 
> SVN version used for the export.
> 
> However the makefile override that. This patch avoids this by checking 
> if the svnversion is "exported".
> 
> Eitan

Hi!
The way osm_svn_revision_new.h is removed to trigger re-make on the
next pass is IMO ugly: thats what .PHONY target is for.

---

Simplify Makefile.am (remove an extra target, use -n flag to svnversion)
and make it possible to build opensm on platforms without subversion installed.

Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>

Index: openib/src/userspace/management/osm/opensm/Makefile.am
===================================================================
--- openib/src/userspace/management/osm/opensm/Makefile.am	(revision 5207)
+++ openib/src/userspace/management/osm/opensm/Makefile.am	(working copy)
@@ -10,25 +10,25 @@
 endif
 
 if OSMV_OPENIB
-$(srcdir)/../include/opensm/osm_svn_revision_new.h:
-	echo -n "#define OSM_SVN_REVISION \"" >$(srcdir)/../include/opensm/osm_svn_revision_new.h ; \
-	svnversion $(srcdir)/.. | tr -d '\n' >> $(srcdir)/../include/opensm/osm_svn_revision_new.h ; \
-	echo "\"" >> $(srcdir)/../include/opensm/osm_svn_revision_new.h ; \
-	if test `cat $(srcdir)/../include/opensm/osm_svn_revision_new.h | grep exported | wc -l` = 1; \
-	then \
-		cp $(srcdir)/../include/opensm/osm_svn_revision.h \
-		   $(srcdir)/../include/opensm/osm_svn_revision_new.h; \
+.PHONY: always
+$(srcdir)/../include/opensm/osm_svn_revision.h: always
+	if \
+		test '!' -d '$(srcdir)/.svn';\
+	then\
+		echo Exported svn revision;\
+	else\
+		echo -n "#define OSM_SVN_REVISION \"" >$(srcdir)/../include/opensm/osm_svn_revision_new.h ;\
+		svnversion -n $(srcdir)/.. >> $(srcdir)/../include/opensm/osm_svn_revision_new.h ;\
+		echo "\"" >> $(srcdir)/../include/opensm/osm_svn_revision_new.h ;\
+		if cmp -s $(srcdir)/../include/opensm/osm_svn_revision_new.h \
+			  $(srcdir)/../include/opensm/osm_svn_revision.h ;\
+		then\
+			rm $(srcdir)/../include/opensm/osm_svn_revision_new.h ;\
+		else\
+			mv $(srcdir)/../include/opensm/osm_svn_revision_new.h\
+			   $(srcdir)/../include/opensm/osm_svn_revision.h ;\
+		fi ;\
 	fi
-
-$(srcdir)/../include/opensm/osm_svn_revision.h: $(srcdir)/../include/opensm/osm_svn_revision_new.h
-	if cmp -s $(srcdir)/../include/opensm/osm_svn_revision_new.h \
-		  $(srcdir)/../include/opensm/osm_svn_revision.h ; \
-	then \
-		rm $(srcdir)/../include/opensm/osm_svn_revision_new.h ; \
-	else \
-		mv $(srcdir)/../include/opensm/osm_svn_revision_new.h \
-		   $(srcdir)/../include/opensm/osm_svn_revision.h ; \
-	fi
 endif
 
 libopensm_la_CFLAGS = -Wall $(OSMV_CFLAGS) -DVENDOR_RMPP_SUPPORT $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1


-- 
Michael S. Tsirkin
Staff Engineer, Mellanox Technologies
_______________________________________________
openib-general mailing list
openib-general at openib.org
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

 




 



More information about the general mailing list