Merge fix
authortimothy.murphy@nokia.com
Fri, 23 Apr 2010 17:46:35 +0100
branchfix
changeset 531 5a168ca8e8d4
parent 530 c708fcd8e968 (diff)
parent 528 f6aa47076e0f (current diff)
child 532 1083c9a3a7cf
Merge
--- a/sbsv2/raptor/lib/flm/resource.flm	Fri Apr 23 17:44:43 2010 +0100
+++ b/sbsv2/raptor/lib/flm/resource.flm	Fri Apr 23 17:46:35 2010 +0100
@@ -52,15 +52,14 @@
 # There is only one resource header (.rsg) file and we only
 # make that if we are asked.
 RSGDIR:=$(EPOCROOT)/epoc32/include
+# If there are multiple LANGUAGES then it is the last one in the list
+# which produces the header.
+HEADLANG:=$(lastword $(LANGUAGES:SC=sc))
 ifneq ($(or $(HEADER),$(HEADERONLY)),)
         RESOURCEHEADER:=$(RSGDIR)/$(HEADER)
 
-        # If there are multiple LANGUAGES then it is the last one in the list
-        # which produces the header.
-        HEADLANG:=$(lastword $(LANGUAGES:SC=sc))
 else
-        HEADLANG:=
-    RESOURCEHEADER:=
+        RESOURCEHEADER:=
 endif
 
 # we create intermediate .rpp and .d files
@@ -140,56 +139,53 @@
 # $(1) is the RPPFILE		(eg. /epoc32/build/xxx/b_sc.rpp)
 # $(2) is the related RESOURCEFILE if any (eg. /a/b.rsc)
 # $(3) is the LANGUAGE		(eg. sc or 01 or 02 ...)
+# $(4) is the "primary" language on which all the others depend
 
   ifeq ($(TARGET_$(call sanitise,$1)),)
     TARGET_$(call sanitise,$1):=1
-    $(if $(FLMDEBUG),$(info <debug>preprocessresource: $(1) for $(2) LANG:$(3)</debug>))
+    $(if $(FLMDEBUG),$$(info <debug>preprocessresource: $(1) for $(2) LANG:$(3) dep $(4)</debug>))
 
 
     # Correct dependency information when a header file can't be found.
     # If the c preprocessor can't find a dependency it appears as it did in the #include statement
     # e.g. "filename.mbg" or "filename.rsg" in the dependency file.
     # we can correct the dependencies by assuming that the file will be in epoc32\include as this is the default
-    ifneq ($(NO_DEPEND_GENERATE),)
-      # This version minimises the size of dependency files, to contain only .mbg and .rsg deps.
-      # It allows resources to be built in the right order but doesn't impose the weight of
-      # of full dependency information which can overwhelm make in large builds.
-      # The strategy is to filter out lines (apart from the target line which is the first) which don't have .rsg or 
-      # .mbg dependencies in them.   The first line can sometimes not contain the target but  
-      # have a lonely "\" so we use a pattern to recognise the target line in order not to get confused. 
-      DEPENDENCY_CORRECTOR:={ $(GNUSED) -n -r '/.*: +.$$$$/ p;\%\.((rsg)|(mbg))%I {s% ([^ \/]+\.((rsg)|(mbg)))% __EPOCROOT\/epoc32\/include\/\1%ig;s% [^_][^_][^E][^ ]+%%g;s%__EPOCROOT%$(EPOCROOT)%g; p}' && echo "" ; }
-    else
-      # Generate full dependency information
-      DEPENDENCY_CORRECTOR:=$(GNUSED)  -r 's% ([^ \/]+\.((rsg)|(mbg)))% $(EPOCROOT)\/epoc32\/include\/\1%ig' 
-    endif
+    DEPENDENCY_CORRECTOR:=$(GNUSED)  -r 's% ([^ \/]+\.((rsg)|(mbg)))% $(EPOCROOT)\/epoc32\/include\/\1%ig' 
 
 
-    RESOURCE_DEPS:: $(1).d
-    $(1).d: $(SOURCE)
+    ifeq "$1" "$4"
+        RESOURCE_DEPS:: $1.d
+        $1.d: $(SOURCE)
 	  $(call startrule,resourcedependencies,FORCESUCCESS) \
-	  $(GNUCPP) -C -DLANGUAGE_$(3) -DLANGUAGE_$(subst sc,SC,$(3)) $(call makemacrodef,-D,$(MMPDEFS))\
-	  $(CPPOPT) $(SOURCE) -M -MG -MT"$(1)" | \
+	  $(GNUCPP) -C -DLANGUAGE_$(3) -DLANGUAGE_$(subst sc,SC,$3) $(call makemacrodef,-D,$(MMPDEFS))\
+	  $(CPPOPT) $(SOURCE) -M -MG -MT"$1" | \
 	  $$(DEPENDENCY_CORRECTOR) >$$@ \
 	  $(call endrule,resourcedependencies)
 
+        $1: $1.d
+    else
+        $1: $4
+    endif
     ifeq "$(MAKEFILE_GROUP)" "RESOURCE"
-    $(1): $(1).d
+    $1: 
 	  $(call startrule,resourcepreprocess,FORCESUCCESS) \
-	  $(GNUCPP) -C -DLANGUAGE_$(3) -DLANGUAGE_$(subst sc,SC,$(3)) $(call makemacrodef,-D,$(MMPDEFS))\
+	  $(GNUCPP) -C -DLANGUAGE_$3 -DLANGUAGE_$(subst sc,SC,$(3)) $(call makemacrodef,-D,$(MMPDEFS))\
 	  $(CPPOPT) $(SOURCE) -o $$@ \
 	  $(call endrule,resourcepreprocess)
     endif
 
-    CLEANTARGETS:= $$(CLEANTARGETS) $(1)
-
-    $(eval DEPENDFILENAME:=$(1).d)
-    $(eval DEPENDFILE:=$(wildcard $(DEPENDFILENAME)))
+    CLEANTARGETS:= $$(CLEANTARGETS) $1
 
-    CLEANTARGETS:=$$(CLEANTARGETS) $(DEPENDFILENAME)
-    ifneq "$(DEPENDFILE)" ""
-      ifeq "$(filter %CLEAN,$(call uppercase,$(MAKECMDGOALS)))" ""
-        ifeq "$(MAKEFILE_GROUP)" "RESOURCE"
-          -include $(DEPENDFILE)
+    ifeq "$1" "$4"
+      $(eval DEPENDFILENAME:=$1.d)
+      $(eval DEPENDFILE:=$(wildcard $(DEPENDFILENAME)))
+      
+      CLEANTARGETS:=$$(CLEANTARGETS) $(DEPENDFILENAME)
+      ifneq "$(DEPENDFILE)" ""
+        ifeq "$(filter %CLEAN,$(call uppercase,$(MAKECMDGOALS)))" ""
+          ifeq "$(MAKEFILE_GROUP)" "RESOURCE"
+            -include $(DEPENDFILE)
+          endif
         endif
       endif
     endif
@@ -296,10 +292,16 @@
         $(eval $(call generateresourceheader,$(RESOURCEHEADER),$(INTERBASE)_$(HEADLANG).rpp,$(HEADLANG)))
 endif
 
+# The one on which the others will depend i.e. they will 
+# "sit in it's dependency slipstream" or in other words
+# We only have to make one dependency file because all of
+# the other languages will benefit from this languages'
+# dependency file
+PRIMARYRPPFILE:=$(INTERBASE)_$(HEADLANG).rpp
 ifeq ($(HEADERONLY),)
         # generate a resource file for each language
         # For sc we generate $(RESBASE).rsc and define LANGUAGE_SC and LANGUAGE_sc.
-        $(foreach L,$(LANGUAGES:SC=sc),$(eval $(call preprocessresource,$(INTERBASE)_$(L).rpp,$(INTERBASE).r$(L),$(L))))
+        $(foreach L,$(LANGUAGES:SC=sc),$(eval $(call preprocessresource,$(INTERBASE)_$(L).rpp,$(INTERBASE).r$(L),$(L),$(PRIMARYRPPFILE))))
 
         ifeq "$(MAKEFILE_GROUP)" "RESOURCE"
             $(foreach L,$(LANGUAGES:SC=sc),$(eval $(call generateresource,$(INTERBASE).r$(L),$(INTERBASE)_$(L).rpp,$(L))))
@@ -308,7 +310,7 @@
         # No resources are going to be made so unless we specifically ask for it, there will be no
         # preprocessed file from which to create the header:
 
-        $(eval $(call preprocessresource,$(INTERBASE)_$(HEADLANG).rpp,,$(HEADLANG)))
+        $(eval $(call preprocessresource,$(INTERBASE)_$(HEADLANG).rpp,,$(HEADLANG),$(PRIMARYRPPFILE)))
 
 endif