sbsv2/raptor/lib/flm/tracecompiler.mk
branchfix
changeset 521 53251dd57e58
parent 519 206fd7d7ef46
child 563 51b77162794b
--- a/sbsv2/raptor/lib/flm/tracecompiler.mk	Tue May 04 17:50:27 2010 +0100
+++ b/sbsv2/raptor/lib/flm/tracecompiler.mk	Wed May 05 18:53:43 2010 +0100
@@ -97,15 +97,26 @@
 JAVA_COMMAND:=$(SBS_JAVATC)
 TRACE_COMPILER_PATH:=$(EPOCROOT)/epoc32/tools
 
-#
-#try to find TraceCompilerMain.class (the new posix-like interface)
-#
+# declare the trace_compile macro but only do it once in the build
 ifeq ($(trace_compile),)
+
+# Find out which macro to declare - the one supporting the new CLI 
+# or the old one.  First try to find TraceCompilerMain.class 
+# If it is there then it might be the new posix-like interface
+TRACE_VER:=
+TRACE_VSTR:=
+
 TCClass:=$(wildcard  $(TRACE_COMPILER_PATH)/tracecompiler/com/nokia/tracecompiler/TraceCompilerMain.class)
+ifneq ($(TCClass),) 
+# Get the version string from the TC (assume it's the new one)
+TRACE_COMPILER_START:=-classpath $(TRACE_COMPILER_PATH)/tracecompiler com.nokia.tracecompiler.TraceCompilerMain
+TRACE_VSTR:=$(firstword $(subst TraceCompiler version ,,$(shell $(JAVA_COMMAND) $(TRACE_COMPILER_START) --version)))
+# check if it looks like a version that supports the new cli interface: supporting up to verion 9 in the future.
+TRACE_VER:=$(findstring new,$(foreach version,2 3 4 5 6 7 8 9,$(patsubst $(version).%,new,$(TRACE_VSTR))))
+endif
+$(if $(FLMDEBUG),$(info <debug>TRACE_VSTR=$(TRACE_VSTR) TRACE_VER=$(TRACE_VER)</debug>))
 
-ifneq ($(TCClass),) #New Interface
-TRACE_VER:=new
-TRACE_COMPILER_START:=-classpath $(TRACE_COMPILER_PATH)/tracecompiler com.nokia.tracecompiler.TraceCompilerMain
+ifeq ($(TRACE_VER),new)
 define trace_compile
 $(TRACE_MARKER) : $(PROJECT_META)
 	$(call startrule,tracecompile) \
@@ -135,7 +146,6 @@
 	 $(GNUCAT) $(TRACE_SOURCE_LIST) ; true ; } \
 	$(call endrule,tracecompile)
 endef
-TRACE_VER:=old
 
 # End - new/old trace compiler
 endif