Merge fix
authortimothy.murphy@nokia.com
Wed, 19 May 2010 15:47:58 +0100
branchfix
changeset 569 6656482ba0da
parent 562 50c238674c4b (current diff)
parent 568 d4ab34a8c6dc (diff)
child 570 971d2c670e06
child 573 e2b5644641c6
Merge
sbsv2/raptor/RELEASE-NOTES.html
--- a/sbsv2/raptor/RELEASE-NOTES.html	Wed May 19 09:33:35 2010 +0100
+++ b/sbsv2/raptor/RELEASE-NOTES.html	Wed May 19 15:47:58 2010 +0100
@@ -10,6 +10,7 @@
 
 <h3>Defect Fixes</h3>
 <ul>
+<li>Fix : tracecompiler.mk caused poor makefile parse performance due to use of $(shell)</li>
 <li><a href="http://developer.symbian.org/bugs/show_bug.cgi?id=2561"> SF Bug 2561 </a> - [Raptor] creates incorrect .iby files w.r.t target file versions &amp; ramtargets</li>
 <li><a href="http://developer.symbian.org/bugs/show_bug.cgi?id=2562"> SF Bug 2562 </a> - [Raptor] adds incorrect entries into .iby files w.r.t file paths</li>
 </ul>
--- a/sbsv2/raptor/lib/flm/tracecompiler.mk	Wed May 19 09:33:35 2010 +0100
+++ b/sbsv2/raptor/lib/flm/tracecompiler.mk	Wed May 19 15:47:58 2010 +0100
@@ -71,12 +71,42 @@
 TRACE_HEADERS:=
 
 TRACE_SOURCE_LIST:=$(TRACE_MARKER_PATH)/tracecompile_$(TRACE_RELEASABLE_ID)_$(UID_TC).sourcelist
+TRACE_VARIANT_SOURCE_LIST:=$(OUTPUTPATH)/$(VARIANTPLATFORM)/$(VARIANTTYPE)/tracecompile_$(TRACE_RELEASABLE_ID)_$(UID_TC).sourcelist
 
-# 1. Append to or create the list of source files for trace compiler to process
-# 2. Check if the hash in trace marker remain unchanged. If not, remove marker so trace compiler will run again. 
-X:=$(shell set -x ; $(GNUMKDIR) -p $(TRACE_MARKER_PATH) ; $(GNUTOUCH) $(TRACE_SOURCE_LIST) ; echo -e "$(subst $(CHAR_SPACE),\\n,$(SOURCE))" | $(GNUSORT) -u $(TRACE_SOURCE_LIST) - > $(TRACE_SOURCE_LIST).tmp && $(GNUMV) $(TRACE_SOURCE_LIST).tmp $(TRACE_SOURCE_LIST) ; $(GNUMD5SUM) -c $(TRACE_MARKER) || $(GNURM) $(TRACE_MARKER))
+# The sourcelist_grouped_write macro allows us to construct a source list file, 10 objects at a time
+# to avoid limits on argument lengths and sizes on Windows.
+# $1 = list of source files
+# $2 = ">" or ">>" i.e. for creating the file.
+define sourcelist_grouped_write
+	$(call startrule,sourcelist_write) \
+	$(if $1,echo -en '$(subst $(CHAR_SPACE),\n,$(strip $(wordlist 1,10,$1)))\n' $2 $$@,true) \
+	$(call endrule,sourcelist_write) 
+	$(if $1,$(call sourcelist_grouped_write,$(wordlist 11,$(words $1),$1),>>),)
+endef
 
-$(if $(FLMDEBUG),$(info <debug>Trace Compiler sourcelist generation output: $(X)</debug>))
+# Write the list of sources for this variant to a file
+# Make the combined sourcelist for this target depend on it
+# It's all to do with how make treats this file when it 
+# does exist. We are forcing it evaluate the target rule here 
+# even if the file is in place by making it PHONY. In other 
+# words, this is forcing the variant source list to always 
+# be written but later on we might not write to the combined 
+# source list if it isn't going to change.
+define sourcelist_write
+$(TRACE_SOURCE_LIST): $(TRACE_VARIANT_SOURCE_LIST)
+
+.PHONY:: $(TRACE_VARIANT_SOURCE_LIST)
+
+$(TRACE_VARIANT_SOURCE_LIST): $(SOURCE) 
+	$(call sourcelist_grouped_write,$(SOURCE),>)
+
+endef
+
+$(eval $(sourcelist_write))
+$(eval $(call GenerateStandardCleanTarget,$(TRACE_VARIANT_SOURCE_LIST),,))
+
+
+$(if $(FLMDEBUG),$(info <debug>Trace Compiler SOURCES: $(SOURCE)</debug>))
 
 $(TRACE_MARKER) : $(SOURCE)
 
@@ -116,14 +146,33 @@
 endif
 $(if $(FLMDEBUG),$(info <debug>TRACE_VSTR=$(TRACE_VSTR) TRACE_VER=$(TRACE_VER)</debug>))
 
+
+# 0. Generate a combined sourcelist from all variants. 
+# 0.1 Write the combined list to a temporary file
+# 0.2 Check if there are new files since the last build
+#      md5 stored in the trace marker.
+# 0.3 Rewrite the combined sourcelist if new sourcefiles have appeared
+#      since the last build
+# 1. Use pipe to send inputs to trace compiler to process
+# 2. Create a hash regarding to source names and put it in marker.
+# 3. Show source names that are processed by trace compiler
+
 ifeq ($(TRACE_VER),new)
 define trace_compile
-$(TRACE_MARKER) : $(PROJECT_META)
+
+$(TRACE_SOURCE_LIST):
+	$(call startrule,sourcelist_combine) \
+	$(GNUCAT) $(TRACE_SOURCE_LIST) $$^ 2>/dev/null | $(GNUSORT) -u > $$@.new && \
+	$(GNUMD5SUM) -c $(TRACE_MARKER) 2>/dev/null ||  \
+	  $(GNUCP) $$@.new $$@ \
+	$(call endrule,sourcelist_combine)
+
+$(TRACE_MARKER) : $(PROJECT_META) $(TRACE_SOURCE_LIST)
 	$(call startrule,tracecompile) \
 	( $(GNUCAT) $(TRACE_SOURCE_LIST); \
 	  echo -en "*ENDOFSOURCEFILES*\n" ) | \
 	$(JAVA_COMMAND) $(TRACE_COMPILER_START) $(if $(FLMDEBUG),-d,) --uid=$(UID_TC) --project=$(TRACE_PRJNAME) --mmp=$(PROJECT_META) --traces=$(TRACE_PATH) &&  \
-	$(GNUMD5SUM) $(TRACE_SOURCE_LIST) > $(TRACE_MARKER) && \
+	$(GNUMD5SUM) $(TRACE_SOURCE_LIST).new > $$@ 2>/dev/null && \
 	{ $(GNUTOUCH) $(TRACE_DICTIONARY) $(AUTOGEN_HEADER); \
 	 $(GNUCAT) $(TRACE_SOURCE_LIST) ; true ; } \
 	$(call endrule,tracecompile)
@@ -131,17 +180,23 @@
 
 else # Old inteface
 TRACE_COMPILER_START:=-classpath $(TRACE_COMPILER_PATH)/tracecompiler com.nokia.tracecompiler.TraceCompiler
-# 1. Use pipe to send inputs to trace compiler to process
-# 2. Create a hash regarding to source names and put it in marker.
-# 3. Show source names that are processed by trace compiler
+
 define trace_compile
-$(TRACE_MARKER) : $(PROJECT_META)
+
+$(TRACE_SOURCE_LIST):
+	$(call startrule,sourcelist_combine) \
+	$(GNUCAT) $(TRACE_SOURCE_LIST) $$^ 2>/dev/null | $(GNUSORT) -u > $$@.new && \
+	$(GNUMD5SUM) -c $(TRACE_MARKER) 2>/dev/null ||  \
+	  $(GNUCP) $$@.new $$@ \
+	$(call endrule,sourcelist_combine)
+
+$(TRACE_MARKER) : $(PROJECT_META) $(TRACE_SOURCE_LIST)
 	$(call startrule,tracecompile) \
 	( echo -en "$(OLDTC_TRACE_PRJNAME)\n$(PROJECT_META)\n"; \
 	  $(GNUCAT) $(TRACE_SOURCE_LIST); \
 	  echo -en "*ENDOFSOURCEFILES*\n" ) | \
 	$(JAVA_COMMAND) $(TRACE_COMPILER_START) $(UID_TC) &&  \
-	$(GNUMD5SUM) $(TRACE_SOURCE_LIST) > $(TRACE_MARKER) && \
+	$(GNUMD5SUM) $(TRACE_SOURCE_LIST).new > $$@ 2>/dev/null && \
 	{ $(GNUTOUCH) $(TRACE_DICTIONARY) $(AUTOGEN_HEADER); \
 	 $(GNUCAT) $(TRACE_SOURCE_LIST) ; true ; } \
 	$(call endrule,tracecompile)