sbsv2/raptor/lib/flm/resource.flm
branchfix
changeset 532 1083c9a3a7cf
parent 530 c708fcd8e968
child 533 408bfff46ad7
equal deleted inserted replaced
531:5a168ca8e8d4 532:1083c9a3a7cf
    46 RESBASE:=$(RSCDIR)/$(TARGET_lower)
    46 RESBASE:=$(RSCDIR)/$(TARGET_lower)
    47 
    47 
    48 # Ensure that RELEASABLES and CLEANTARGETS cannot expand indefinitely in successive calls to this flm:
    48 # Ensure that RELEASABLES and CLEANTARGETS cannot expand indefinitely in successive calls to this flm:
    49 CLEANTARGETS:=
    49 CLEANTARGETS:=
    50 RELEASABLES:=
    50 RELEASABLES:=
       
    51 CREATABLEPATHS:=
    51 
    52 
    52 # There is only one resource header (.rsg) file and we only
    53 # There is only one resource header (.rsg) file and we only
    53 # make that if we are asked.
    54 # make that if we are asked.
    54 RSGDIR:=$(EPOCROOT)/epoc32/include
    55 RSGDIR:=$(EPOCROOT)/epoc32/include
    55 # If there are multiple LANGUAGES then it is the last one in the list
    56 # If there are multiple LANGUAGES then it is the last one in the list
    74 
    75 
    75 ifeq ($(HEADERONLY),)
    76 ifeq ($(HEADERONLY),)
    76 
    77 
    77 RSSBASENAME:=$(call lowercase,$(basename $(notdir $(SOURCE))))
    78 RSSBASENAME:=$(call lowercase,$(basename $(notdir $(SOURCE))))
    78 DESTRPP:=$(EPOCROOT)/epoc32/localisation/$(RSSBASENAME)/rsc/$(RSSBASENAME).rpp
    79 DESTRPP:=$(EPOCROOT)/epoc32/localisation/$(RSSBASENAME)/rsc/$(RSSBASENAME).rpp
    79 $(call makepath,$(EPOCROOT)/epoc32/localisation/$(RSSBASENAME)/rsc)
    80 CREATABLEPATHS:=$(CREATABLEPATHS) $(EPOCROOT)/epoc32/localisation/$(RSSBASENAME)/rsc
    80 
    81 
    81 INFOFILE:=$(EPOCROOT)/epoc32/localisation/group/$(RSSBASENAME).info
    82 INFOFILE:=$(EPOCROOT)/epoc32/localisation/group/$(RSSBASENAME).info
    82 # If there are MULTIPLE languages then copy the .rpp for the last one
    83 # If there are MULTIPLE languages then copy the .rpp for the last one
    83 RPPLANG:=$(lastword $(LANGUAGES:SC=sc))
    84 RPPLANG:=$(lastword $(LANGUAGES:SC=sc))
    84 
    85 
   105 
   106 
   106 $(eval $(call CreateRppAndInfo))
   107 $(eval $(call CreateRppAndInfo))
   107 endif
   108 endif
   108 ################################# end of localisation ###################################
   109 ################################# end of localisation ###################################
   109 
   110 
   110 # make the output directories while reading makefile - some build engines prefer this
       
   111 $(call makepath,$(INTERBASE))
       
   112 
       
   113 # common pre-processor options
   111 # common pre-processor options
   114 
   112 
   115 # We really should be using -iquote with a recent cpp.  This is a note for when we do update:
   113 # We really should be using -iquote with a recent cpp.  This is a note for when we do update:
   116 #CPPOPT:=-nostdinc -undef -Wno-trigraphs -D_UNICODE -include $(PRODUCT_INCLUDE)\
   114 #CPPOPT:=-nostdinc -undef -Wno-trigraphs -D_UNICODE -include $(PRODUCT_INCLUDE)\
   117 # -I$(dir $(SOURCE)) $(foreach I, $(USERINCLUDE),-iquote $(I) ) $(foreach J,$(SYSTEMINCLUDE),-I $(J) )
   115 # -I$(dir $(SOURCE)) $(foreach I, $(USERINCLUDE),-iquote $(I) ) $(foreach J,$(SYSTEMINCLUDE),-I $(J) )
   118 
   116 
   119 CPPOPT:=-nostdinc -undef -Wno-trigraphs -D_UNICODE -include $(PRODUCT_INCLUDE)\
   117 CPPOPT:=-nostdinc -undef -Wno-trigraphs -D_UNICODE -include $(PRODUCT_INCLUDE)\
   120  -I$(dir $(SOURCE)) $(foreach I, $(USERINCLUDE),-I$(I) ) -I- $(foreach J,$(SYSTEMINCLUDE),-I$(J) )
   118  -I$(dir $(SOURCE)) $(foreach I, $(USERINCLUDE),-I$(I) ) -I- $(foreach J,$(SYSTEMINCLUDE),-I$(J) )
   121 
   119 
   122 CREATABLEPATHS:=$(RSCDIR) $(RSGDIR) $(OUTPUTPATH)
   120 CREATABLEPATHS:=$(CREATABLEPATHS) $(RSCDIR) $(RSGDIR) $(OUTPUTPATH) $(INTERBASE) 
   123 
   121 
   124 # We intend to generate the resource in an intermediate location and copy to the targetpath to
   122 # We intend to generate the resource in an intermediate location and copy to the targetpath to
   125 # ensure that when the "same" resource is built into separare target paths, it doesn't have to be 
   123 # ensure that when the "same" resource is built into separare target paths, it doesn't have to be 
   126 # completely recreated each time - just copied.
   124 # completely recreated each time - just copied.
   127 RSCCOPYDIRS:=$(RSCDIR)
   125 RSCCOPYDIRS:=$(RSCDIR)
   147 
   145 
   148 
   146 
   149     # Correct dependency information when a header file can't be found.
   147     # Correct dependency information when a header file can't be found.
   150     # If the c preprocessor can't find a dependency it appears as it did in the #include statement
   148     # If the c preprocessor can't find a dependency it appears as it did in the #include statement
   151     # e.g. "filename.mbg" or "filename.rsg" in the dependency file.
   149     # e.g. "filename.mbg" or "filename.rsg" in the dependency file.
   152     # we can correct the dependencies by assuming that the file will be in epoc32\include as this is the default
   150 
       
   151 ifneq ($(NO_DEPEND_GENERATE),)
       
   152     # This version minimises the size of dependency files, to contain only .mbg and .rsg deps.
       
   153     # It allows resources to be built in the right order but doesn't impose the weight of
       
   154     # of full dependency information which can overwhelm make in large builds.
       
   155     # The strategy is to filter out lines (apart from the target line which is the first) which don't have .rsg or 
       
   156     # .mbg dependencies in them.   The first line can sometimes not contain the target but  
       
   157     # have a lonely "\" so we use a pattern to recognise the target line in order not to get confused. 
       
   158     DEPENDENCY_CORRECTOR:={ $(GNUGREP) -E " ([^ /]+)\.((rsg)|(mbg))" | $(GNUSED) -r 's%([^ ]*\.[^rm ][^sb ][^g ])%%g;s%[\\ ]+% %g' | { DEPS=''; read L; while [ $$$$? -eq 0 ]; do DEPS="$$$${DEPS} $$$$L"; read L; done; DEPTXT="$$$$RPP: \\\\\n"; DEPCOUNT=0; for i in $$$${DEPS}; do DEPTXT="$$$$DEPTXT \$$$$(EPOCROOT)/epoc32/include/$$$$i \\\\\n"; (( DEPCOUNT += 1 )) ; done; if [ $$$$DEPCOUNT -ne 0 ]; then  echo -e "$$$${DEPTXT%%\\\\\\n}\n"; fi ; } ; }
       
   159 else
       
   160     # This can correct the dependencies by assuming that the file will be in epoc32\include as this is the default
   153     DEPENDENCY_CORRECTOR:=$(GNUSED)  -r 's% ([^ \/]+\.((rsg)|(mbg)))% $(EPOCROOT)\/epoc32\/include\/\1%ig' 
   161     DEPENDENCY_CORRECTOR:=$(GNUSED)  -r 's% ([^ \/]+\.((rsg)|(mbg)))% $(EPOCROOT)\/epoc32\/include\/\1%ig' 
       
   162 endif
   154 
   163 
   155 
   164 
   156     ifeq "$1" "$4"
   165     ifeq "$1" "$4"
   157         RESOURCE_DEPS:: $1.d
   166         RESOURCE_DEPS:: $1.d
   158         $1.d: $(SOURCE)
   167         $1.d: $(SOURCE)
   159 	  $(call startrule,resourcedependencies,FORCESUCCESS) \
   168 	  $(call startrule,resourcedependencies,FORCESUCCESS) \
   160 	  $(GNUCPP) -C -DLANGUAGE_$(3) -DLANGUAGE_$(subst sc,SC,$3) $(call makemacrodef,-D,$(MMPDEFS))\
   169 	  RPP=$1; $(GNUCPP) -C -DLANGUAGE_$(3) -DLANGUAGE_$(subst sc,SC,$3) $(call makemacrodef,-D,$(MMPDEFS))\
   161 	  $(CPPOPT) $(SOURCE) -M -MG -MT"$1" | \
   170 	  $(CPPOPT) $(SOURCE) -M -MG -MT"$1" | \
   162 	  $$(DEPENDENCY_CORRECTOR) >$$@ \
   171 	  $$(DEPENDENCY_CORRECTOR) >$$@ \
   163 	  $(call endrule,resourcedependencies)
   172 	  $(call endrule,resourcedependencies)
   164 
   173 
   165         $1: $1.d
       
   166     else
   174     else
   167         $1: $4
   175         $1: $4
       
   176 
   168     endif
   177     endif
   169     ifeq "$(MAKEFILE_GROUP)" "RESOURCE"
   178     ifeq "$(MAKEFILE_GROUP)" "RESOURCE"
   170     $1: 
   179     $1: 
   171 	  $(call startrule,resourcepreprocess,FORCESUCCESS) \
   180 	  $(call startrule,resourcepreprocess,FORCESUCCESS) \
   172 	  $(GNUCPP) -C -DLANGUAGE_$3 -DLANGUAGE_$(subst sc,SC,$(3)) $(call makemacrodef,-D,$(MMPDEFS))\
   181 	  $(GNUCPP) -C -DLANGUAGE_$3 -DLANGUAGE_$(subst sc,SC,$(3)) $(call makemacrodef,-D,$(MMPDEFS))\