sbsv2/raptor/lib/flm/resource.flm
changeset 616 24e4ef208cca
parent 590 360bd6b35136
child 625 a1925fb7753a
equal deleted inserted replaced
613:839712f5a78c 616:24e4ef208cca
    63         RESOURCEHEADER:=
    63         RESOURCEHEADER:=
    64 endif
    64 endif
    65 
    65 
    66 # we create intermediate .rpp and .d files
    66 # we create intermediate .rpp and .d files
    67 INTERBASE_TMP:=$(OUTPUTPATH)/$(TARGET_lower)_$(notdir $(basename $(SOURCE)))
    67 INTERBASE_TMP:=$(OUTPUTPATH)/$(TARGET_lower)_$(notdir $(basename $(SOURCE)))
    68 INTERBASE:=$(OUTPUTPATH)/$(TARGET_lower)
       
    69 
    68 
    70 
    69 
    71 # common pre-processor options
    70 # common pre-processor options
    72 
    71 
    73 # We really should be using -iquote with a recent cpp.  This is a note for when we do update:
    72 # We really should be using -iquote with a recent cpp.  This is a note for when we do update:
    92 
    91 
    93 ###############################################################################
    92 ###############################################################################
    94 
    93 
    95 
    94 
    96 define preprocessresource
    95 define preprocessresource
    97 # $(1) is the RPPFILE		(eg. /epoc32/build/xxx/b_sc.rpp)
    96 # $1 is the RPPFILE		(eg. /epoc32/build/xxx/b_sc.rpp)
    98 # $(2) is the related RESOURCEFILE if any (eg. /a/b.rsc)
    97 # $2 is the LANGUAGE		(eg. sc or 01 or 02 ...)
    99 # $(3) is the LANGUAGE		(eg. sc or 01 or 02 ...)
    98 # $3 is the "primary" language on which all the others depend
   100 # $(4) is the "primary" language on which all the others depend
       
   101 
    99 
   102   ifeq ($(TARGET_$(call sanitise,$1)),)
   100   ifeq ($(TARGET_$(call sanitise,$1)),)
   103     TARGET_$(call sanitise,$1):=1
   101     TARGET_$(call sanitise,$1):=1
   104     $(if $(FLMDEBUG),$$(info <debug>preprocessresource: $(1) for $(2) LANG:$(3) dep $(4)</debug>))
   102     $(if $(FLMDEBUG),$$(info <debug>preprocessresource: $1 LANG:$2 dep $3</debug>))
   105 
   103 
   106 
   104 
   107     # Correct dependency information when a header file can't be found.
   105     # Correct dependency information when a header file can't be found.
   108     # If the c preprocessor can't find a dependency it appears as it did in the #include statement
   106     # If the c preprocessor can't find a dependency it appears as it did in the #include statement
   109     # e.g. "filename.mbg" or "filename.rsg" in the dependency file.
   107     # e.g. "filename.mbg" or "filename.rsg" in the dependency file.
   124     # This can correct the dependencies by assuming that the file will be in epoc32\include as this is the default
   122     # This can correct the dependencies by assuming that the file will be in epoc32\include as this is the default
   125     DEPENDENCY_CORRECTOR:=$(GNUSED)  -r 's% ([^ \/]+\.((rsg)|(mbg)))% $(EPOCROOT)\/epoc32\/include\/\1%ig' 
   123     DEPENDENCY_CORRECTOR:=$(GNUSED)  -r 's% ([^ \/]+\.((rsg)|(mbg)))% $(EPOCROOT)\/epoc32\/include\/\1%ig' 
   126 endif
   124 endif
   127 
   125 
   128 
   126 
   129     ifeq "$1" "$4"
   127     ifeq "$1" "$3"
   130         RESOURCE_DEPS:: $1.d
   128         RESOURCE_DEPS:: $1.d
   131 
   129 
   132         $1.d: $(SOURCE)
   130         $1.d: $(SOURCE)
   133 	  $(call startrule,resourcedependencies,FORCESUCCESS) \
   131 	  $(call startrule,resourcedependencies,FORCESUCCESS) \
   134 	  $(GNUCPP) -DLANGUAGE_$(3) -DLANGUAGE_$(subst sc,SC,$3) $(call makemacrodef,-D,$(MMPDEFS))\
   132 	  $(GNUCPP) -DLANGUAGE_$2 -DLANGUAGE_$(subst sc,SC,$2) $(call makemacrodef,-D,$(MMPDEFS))\
   135 	  $(CPPOPT) $(SOURCE) -M -MG -MT"$1" | \
   133 	  $(CPPOPT) $(SOURCE) -M -MG -MT"$1" | \
   136 	  $$(DEPENDENCY_CORRECTOR) >$$@ \
   134 	  $$(DEPENDENCY_CORRECTOR) >$$@ \
   137 	  $(call endrule,resourcedependencies)
   135 	  $(call endrule,resourcedependencies)
   138 
   136 
   139          $1 : $1.d
   137          $1 : $1.d
   140 
   138 
   141     else
   139     else
   142          $1 : $4
   140          $1 : $3
   143     endif
   141     endif
   144 
   142 
   145     $1:
   143     $1:
   146 	  $(call startrule,resourcepreprocess,FORCESUCCESS) \
   144 	  $(call startrule,resourcepreprocess,FORCESUCCESS) \
   147 	  $(GNUCPP) -C -DLANGUAGE_$3 -DLANGUAGE_$(subst sc,SC,$(3)) $(call makemacrodef,-D,$(MMPDEFS))\
   145 	  $(GNUCPP) -C -DLANGUAGE_$2 -DLANGUAGE_$(subst sc,SC,$2) $(call makemacrodef,-D,$(MMPDEFS))\
   148 	  $(CPPOPT) $(SOURCE) -o $$@ \
   146 	  $(CPPOPT) $(SOURCE) -o $$@ \
   149 	  $(call endrule,resourcepreprocess)
   147 	  $(call endrule,resourcepreprocess)
   150     endif
   148     endif
   151 
   149 
   152     CLEANTARGETS:= $$(CLEANTARGETS) $1
   150     CLEANTARGETS:= $$(CLEANTARGETS) $1
   153 
   151 
   154     ifeq "$(MAKEFILE_GROUP)" "RESOURCE"
   152     ifeq "$(MAKEFILE_GROUP)" "RESOURCE"
   155     ifeq "$1" "$4"
   153     ifeq "$1" "$3"
   156       $(eval DEPENDFILENAME:=$1.d)
   154       $(eval DEPENDFILENAME:=$1.d)
   157       $(eval DEPENDFILE:=$(wildcard $(DEPENDFILENAME)))
   155       $(eval DEPENDFILE:=$(wildcard $(DEPENDFILENAME)))
   158       
   156       
   159       CLEANTARGETS:=$$(CLEANTARGETS) $(DEPENDFILENAME)
   157       CLEANTARGETS:=$$(CLEANTARGETS) $(DEPENDFILENAME)
   160       ifneq "$(DEPENDFILE)" ""
   158       ifneq "$(DEPENDFILE)" ""
   181 endef # copyresource #
   179 endef # copyresource #
   182 
   180 
   183 ###############################################################################
   181 ###############################################################################
   184 define generateresource
   182 define generateresource
   185 
   183 
   186 # $(1) is the resource filename e.g. /a/b/resource.rsc
   184 # $(1) is the intermediate resource filename with path e.g. /a/b/resource.rsc
   187 # $(2) is the preprocessed resource to make it from
   185 # $(2) is the preprocessed resource to make it from
   188 # $(3) is the language e.g. sc or 01 or 02
   186 # $(3) is the language e.g. sc or 01 or 02
       
   187 # $(4) is the target resource filename without path
   189 
   188 
   190 
   189 
   191         ifeq ($(TARGET_$(call sanitise,$1)),)
   190         ifeq ($(TARGET_$(call sanitise,$1)),)
   192                 TARGET_$(call sanitise,$1):=1
   191                 TARGET_$(call sanitise,$1):=1
   193 
   192 
   209 #       are any new copies to be made for this variant. e.g. winscw requires that we make
   208 #       are any new copies to be made for this variant. e.g. winscw requires that we make
   210 #       some extra copies.  We tried to copy after running rcomp itself but we still need these
   209 #       some extra copies.  We tried to copy after running rcomp itself but we still need these
   211 #       targets for the sake of dependencies or, for example, if someone merely adds a new copy 
   210 #       targets for the sake of dependencies or, for example, if someone merely adds a new copy 
   212 #       when the resource is up-to-date
   211 #       when the resource is up-to-date
   213 
   212 
   214         $(call copyresource,$1,$(sort $(patsubst %,%/$(notdir $1),$(RSCCOPYDIRS))))
   213         $(call copyresource,$1,$(sort $(patsubst %,%/$4,$(RSCCOPYDIRS))))
   215 
   214 
   216 
   215 
   217         # individual source file compilation
   216         # individual source file compilation
   218         SOURCETARGET_$(call sanitise,$(SOURCE)): $(1)
   217         SOURCETARGET_$(call sanitise,$(SOURCE)): $(1)
   219 
   218 
   263 # belonging to this language.
   262 # belonging to this language.
   264 PRIMARYRPPFILE:=$(INTERBASE_TMP)_$(HEADLANG).rpp
   263 PRIMARYRPPFILE:=$(INTERBASE_TMP)_$(HEADLANG).rpp
   265 ifeq ($(HEADERONLY),)
   264 ifeq ($(HEADERONLY),)
   266         # generate a resource file for each language
   265         # generate a resource file for each language
   267         # For sc we generate $(RESBASE).rsc and define LANGUAGE_SC and LANGUAGE_sc.
   266         # For sc we generate $(RESBASE).rsc and define LANGUAGE_SC and LANGUAGE_sc.
   268         $(foreach L,$(LANGUAGES:SC=sc),$(eval $(call preprocessresource,$(INTERBASE_TMP)_$(L).rpp,$(INTERBASE).r$(L),$(L),$(PRIMARYRPPFILE))))
   267         $(foreach L,$(LANGUAGES:SC=sc),$(eval $(call preprocessresource,$(INTERBASE_TMP)_$(L).rpp,$(L),$(PRIMARYRPPFILE))))
   269 
   268 
   270         ifeq "$(MAKEFILE_GROUP)" "RESOURCE"
   269         ifeq "$(MAKEFILE_GROUP)" "RESOURCE"
   271             $(foreach L,$(LANGUAGES:SC=sc),$(eval $(call generateresource,$(INTERBASE).r$(L),$(INTERBASE_TMP)_$(L).rpp,$(L))))
   270             $(foreach L,$(LANGUAGES:SC=sc),$(eval $(call generateresource,$(INTERBASE_TMP).r$(L),$(INTERBASE_TMP)_$(L).rpp,$(L),$(TARGET_lower).r$(L))))
   272         endif
   271         endif
   273 else
   272 else
   274         # No resources are going to be made so unless we specifically ask for it, there will be no
   273         # No resources are going to be made so unless we specifically ask for it, there will be no
   275         # preprocessed file from which to create the header:
   274         # preprocessed file from which to create the header:
   276 
   275 
   277         $(eval $(call preprocessresource,$(INTERBASE_TMP)_$(HEADLANG).rpp,,$(HEADLANG),$(PRIMARYRPPFILE)))
   276         $(eval $(call preprocessresource,$(INTERBASE_TMP)_$(HEADLANG).rpp,$(HEADLANG),$(PRIMARYRPPFILE)))
   278 
   277 
   279 endif
   278 endif
   280 
   279 
   281 ###############################################################################
   280 ###############################################################################
   282 ## .rfi generation in support of the gccxml build
   281 ## .rfi generation in support of the gccxml build