sbsv2/raptor/lib/flm/resource.flm
changeset 616 24e4ef208cca
parent 590 360bd6b35136
child 625 a1925fb7753a
--- a/sbsv2/raptor/lib/flm/resource.flm	Wed Jul 14 16:22:24 2010 +0800
+++ b/sbsv2/raptor/lib/flm/resource.flm	Wed Jul 14 14:50:01 2010 +0100
@@ -65,7 +65,6 @@
 
 # we create intermediate .rpp and .d files
 INTERBASE_TMP:=$(OUTPUTPATH)/$(TARGET_lower)_$(notdir $(basename $(SOURCE)))
-INTERBASE:=$(OUTPUTPATH)/$(TARGET_lower)
 
 
 # common pre-processor options
@@ -94,14 +93,13 @@
 
 
 define preprocessresource
-# $(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
+# $1 is the RPPFILE		(eg. /epoc32/build/xxx/b_sc.rpp)
+# $2 is the LANGUAGE		(eg. sc or 01 or 02 ...)
+# $3 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) dep $(4)</debug>))
+    $(if $(FLMDEBUG),$$(info <debug>preprocessresource: $1 LANG:$2 dep $3</debug>))
 
 
     # Correct dependency information when a header file can't be found.
@@ -126,12 +124,12 @@
 endif
 
 
-    ifeq "$1" "$4"
+    ifeq "$1" "$3"
         RESOURCE_DEPS:: $1.d
 
         $1.d: $(SOURCE)
 	  $(call startrule,resourcedependencies,FORCESUCCESS) \
-	  $(GNUCPP) -DLANGUAGE_$(3) -DLANGUAGE_$(subst sc,SC,$3) $(call makemacrodef,-D,$(MMPDEFS))\
+	  $(GNUCPP) -DLANGUAGE_$2 -DLANGUAGE_$(subst sc,SC,$2) $(call makemacrodef,-D,$(MMPDEFS))\
 	  $(CPPOPT) $(SOURCE) -M -MG -MT"$1" | \
 	  $$(DEPENDENCY_CORRECTOR) >$$@ \
 	  $(call endrule,resourcedependencies)
@@ -139,12 +137,12 @@
          $1 : $1.d
 
     else
-         $1 : $4
+         $1 : $3
     endif
 
     $1:
 	  $(call startrule,resourcepreprocess,FORCESUCCESS) \
-	  $(GNUCPP) -C -DLANGUAGE_$3 -DLANGUAGE_$(subst sc,SC,$(3)) $(call makemacrodef,-D,$(MMPDEFS))\
+	  $(GNUCPP) -C -DLANGUAGE_$2 -DLANGUAGE_$(subst sc,SC,$2) $(call makemacrodef,-D,$(MMPDEFS))\
 	  $(CPPOPT) $(SOURCE) -o $$@ \
 	  $(call endrule,resourcepreprocess)
     endif
@@ -152,7 +150,7 @@
     CLEANTARGETS:= $$(CLEANTARGETS) $1
 
     ifeq "$(MAKEFILE_GROUP)" "RESOURCE"
-    ifeq "$1" "$4"
+    ifeq "$1" "$3"
       $(eval DEPENDFILENAME:=$1.d)
       $(eval DEPENDFILE:=$(wildcard $(DEPENDFILENAME)))
       
@@ -183,9 +181,10 @@
 ###############################################################################
 define generateresource
 
-# $(1) is the resource filename e.g. /a/b/resource.rsc
+# $(1) is the intermediate resource filename with path e.g. /a/b/resource.rsc
 # $(2) is the preprocessed resource to make it from
 # $(3) is the language e.g. sc or 01 or 02
+# $(4) is the target resource filename without path
 
 
         ifeq ($(TARGET_$(call sanitise,$1)),)
@@ -211,7 +210,7 @@
 #       targets for the sake of dependencies or, for example, if someone merely adds a new copy 
 #       when the resource is up-to-date
 
-        $(call copyresource,$1,$(sort $(patsubst %,%/$(notdir $1),$(RSCCOPYDIRS))))
+        $(call copyresource,$1,$(sort $(patsubst %,%/$4,$(RSCCOPYDIRS))))
 
 
         # individual source file compilation
@@ -265,16 +264,16 @@
 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_TMP)_$(L).rpp,$(INTERBASE).r$(L),$(L),$(PRIMARYRPPFILE))))
+        $(foreach L,$(LANGUAGES:SC=sc),$(eval $(call preprocessresource,$(INTERBASE_TMP)_$(L).rpp,$(L),$(PRIMARYRPPFILE))))
 
         ifeq "$(MAKEFILE_GROUP)" "RESOURCE"
-            $(foreach L,$(LANGUAGES:SC=sc),$(eval $(call generateresource,$(INTERBASE).r$(L),$(INTERBASE_TMP)_$(L).rpp,$(L))))
+            $(foreach L,$(LANGUAGES:SC=sc),$(eval $(call generateresource,$(INTERBASE_TMP).r$(L),$(INTERBASE_TMP)_$(L).rpp,$(L),$(TARGET_lower).r$(L))))
         endif
 else
         # 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_TMP)_$(HEADLANG).rpp,,$(HEADLANG),$(PRIMARYRPPFILE)))
+        $(eval $(call preprocessresource,$(INTERBASE_TMP)_$(HEADLANG).rpp,$(HEADLANG),$(PRIMARYRPPFILE)))
 
 endif