sbsv2/raptor/lib/flm/e32abiv2.flm
changeset 0 044383f39525
child 3 e1eecf4d390d
child 590 360bd6b35136
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 # Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 # All rights reserved.
       
     3 # This component and the accompanying materials are made available
       
     4 # under the terms of the License "Eclipse Public License v1.0"
       
     5 # which accompanies this distribution, and is available
       
     6 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 #
       
     8 # Initial Contributors:
       
     9 # Nokia Corporation - initial contribution.
       
    10 #
       
    11 # Contributors:
       
    12 #
       
    13 # Description:
       
    14 # ARMv5 EXE/DLL ABIv2 Function Like Makefile (FLM)
       
    15 # Knows how to build all possible ABIV2 executables for ARM
       
    16 #
       
    17 #
       
    18 
       
    19 # Only build feature invariant binaries in non-product builds *and*
       
    20 # Only build feature variant binaries in product builds.
       
    21 #
       
    22 # FEATUREVARIANTNAME != "" implies product build
       
    23 # FEATUREVARIANT == 1 implies a feature variant binary
       
    24 #
       
    25 # test FEATUREVARIANTNAME=="" or FEATUREVARIANT==1
       
    26 #
       
    27 ifneq ($(or $(call equal,$(FEATUREVARIANTNAME),),$(call equal,$(FEATUREVARIANT),1)),)
       
    28 
       
    29 $(if $(FLMDEBUG),$(info <flm name='e32abiv2' target='$(TARGET)' type='$(TARGETTYPE)' outputpath='$(OUTPUTPATH)' metasource='$(METASOURCE)' postlinkfiletype='$(POSTLINKFILETYPE)' />))
       
    30 
       
    31 # Strip switch-type parameters
       
    32 #
       
    33 POSTLINKTARGETTYPE:=$(strip $(POSTLINKTARGETTYPE))
       
    34 UID1:=$(strip $(UID1))
       
    35 UID2:=$(strip $(UID2))
       
    36 UID3:=$(strip $(UID3))
       
    37 SID:=$(strip $(SECUREID))
       
    38 VENDORID:=$(strip $(VENDORID))
       
    39 AUTOEXPORTS:=$(strip $(AUTOEXPORTS))
       
    40 DEFFILE:=$(strip $(DEFFILE))
       
    41 IMPORTLIBRARYREQUIRED:=$(strip $(IMPORTLIBRARYREQUIRED))
       
    42 EPOCALLOWDLLDATA:=$(strip $(EPOCALLOWDLLDATA))
       
    43 PAGED:=$(strip $(PAGED))
       
    44 
       
    45 # the output directories
       
    46 VARIANTPLATFORM:=$(VARIANTPLATFORM)$(FEATUREVARIANTNAME)
       
    47 RELEASABLEPATH:=$(RELEASEPATH)/$(VARIANTPLATFORM)/$(VARIANTTYPE)
       
    48 INTERMEDIATEPATH:=$(OUTPUTPATH)/$(VARIANTPLATFORM)/$(VARIANTTYPE)
       
    49 INTERMEDIATE_PLATFORM_PATH:=$(OUTPUTPATH)/$(VARIANTPLATFORM)
       
    50 TRACE_MARKER_PATH:=$(OUTPUTPATH)
       
    51 IMPORTLIBPATH:=$(RUNTIME_LIBS_PATH)
       
    52 
       
    53 # LOCALLY USED VARIABLES
       
    54 CLEANTARGETS:=
       
    55 WHATRELEASE:=
       
    56 
       
    57 # Work out which new/delete library to use for binaries.
       
    58 CHECKLIB_TYPE:=symc++
       
    59 STDCPPTAGFILE:=
       
    60 ifeq ($(NOSTDCPP),1)
       
    61   ifeq ($(STDCPP),1)
       
    62     $(info <warning>STDCPP and NOSTDCPP both specified in $(PROJECT_META)</warning>)
       
    63   else
       
    64     ifeq ($(HAS_DEDICATED_OP_NEWDEL_LIB),1)
       
    65       DEFAULT_NEWLIB:=$(DEFAULT_SYMBIAN_NEWLIB)
       
    66     endif
       
    67   endif
       
    68 else
       
    69   ifeq ($(STDCPP),1)
       
    70     CDEFS:=$(CDEFS) __SYMBIAN_STDCPP_SUPPORT__
       
    71     ifneq ($(SUPPORTS_STDCPP_NEWLIB),)
       
    72       ifeq ($(HAS_DEDICATED_OP_NEWDEL_LIB),1)
       
    73         DEFAULT_NEWLIB:=$(DEFAULT_STDCPP_NEWLIB)
       
    74       endif
       
    75       CHECKLIB_TYPE:=stdc++
       
    76       STDCPPTAGFILE:=$(EPOCROOT)/epoc32/tools/tag/tag_elf
       
    77     endif
       
    78   endif
       
    79 endif
       
    80 
       
    81 # If NEWLIB is specified in the MMP file, it overrides all the past stuff.
       
    82 ifeq ($(NEWLIB),)
       
    83   NEWLIB:=$(DEFAULT_NEWLIB)
       
    84 endif
       
    85 
       
    86 
       
    87 ##########################################################################
       
    88 ## OUTPUTS - externally relevant targets that this FLM generates
       
    89 
       
    90 
       
    91 ifeq ($(EXPORTLIBRARY),)
       
    92   EXPORTLIBRARY:=$(TARGET)
       
    93 endif
       
    94 
       
    95 # This will insert the file version between the name and the extension.
       
    96 # If there is more than one dot in generated filename the inserted position will be
       
    97 # BEFORE the last but two dot. E.g name1.name2.name3.dll to name1.name2{version}.name3.dll
       
    98 LIBEXT:=$(lastword $(subst .,$(CHAR_SPACE) ,$(EXPORTLIBRARY)))
       
    99 LIBBASE:=$(patsubst %.$(LIBEXT),%,$(EXPORTLIBRARY))
       
   100 ifneq ($(findstring .,$(EXPORTLIBRARY)),)
       
   101   # Please note $(EXPORTLIBRARY) doesn't include target type.
       
   102   VER_E32IMPORTLIBBASE:=$(IMPORTLIBPATH)/$(LIBBASE){$(VERSIONHEX)}.$(LIBEXT)
       
   103 else
       
   104   VER_E32IMPORTLIBBASE:=$(IMPORTLIBPATH)/$(EXPORTLIBRARY){$(VERSIONHEX)}
       
   105 endif
       
   106 
       
   107 # Postlinkable targets need to be linked and elf2e32'd
       
   108 ifneq ($(DOPOSTLINK),)
       
   109     E32TARGET:=$(RELEASABLEPATH)/$(TARGET)$(if $(EXPLICITVERSION),{$(VERSIONHEX)},).$(if $(REQUESTEDTARGETEXT),$(REQUESTEDTARGETEXT),$(POSTLINKFILETYPE))
       
   110     LINK_TARGET:=$(RELEASABLEPATH)/$(TARGET)$(if $(EXPLICITVERSION),{$(VERSIONHEX)},).$(if $(REQUESTEDTARGETEXT),$(REQUESTEDTARGETEXT),$(POSTLINKFILETYPE)).sym
       
   111     MAPFILE:=$(RELEASABLEPATH)/$(TARGET).$(if $(REQUESTEDTARGETEXT),$(REQUESTEDTARGETEXT),$(POSTLINKFILETYPE)).map
       
   112 else
       
   113   E32TARGET:=
       
   114   LINK_TARGET:=
       
   115   MAPFILE:=
       
   116 endif
       
   117 
       
   118 # libs and klibs, on the other hand need to be archived
       
   119 ifneq ($(call isoneof,$(TARGETTYPE),lib klib stdlib),)
       
   120   ARTARGET:=$(RELEASABLEPATH)/$(TARGET).lib
       
   121   # We need libs and klibs before we can link stuff with them:
       
   122   LIBRARY:: $(ARTARGET)
       
   123 else
       
   124   ARTARGET:=
       
   125 endif
       
   126 
       
   127 
       
   128 ifneq ($(IMPORTLIBRARYREQUIRED),) # no dso files for plugins, animation dlls etc
       
   129   # make sure we don't build import libraries more than once for UDEB and UREL
       
   130   # Without this, wierd target-specific variable problems happen with LIBRARY in particular
       
   131 
       
   132   TMP_IMPORTLIBTARGET_ROOT:=$(IMPORTLIBPATH)/$(EXPORTLIBRARY)
       
   133 
       
   134   # ABIv2 .dso
       
   135   IMPORTLIBTARGET_DSO:=
       
   136   IMPORTLIBTARGETVERSIONED_DSO:=
       
   137 
       
   138   BUILDMARKER_IMPORTLIBTARGET_DSO:=TARGET_$(subst :,,$(VER_E32IMPORTLIBBASE)).dso
       
   139   WHATRELEASE:=$(WHATRELEASE) $(if $(EXPLICITVERSION),,$(TMP_IMPORTLIBTARGET_ROOT).dso)
       
   140   WHATRELEASE:=$(WHATRELEASE) $(VER_E32IMPORTLIBBASE).dso
       
   141   ifeq ($($(BUILDMARKER_IMPORTLIBTARGET_DSO)),)
       
   142     IMPORTLIBTARGET_DSO:=$(TMP_IMPORTLIBTARGET_ROOT).dso
       
   143     IMPORTLIBTARGETVERSIONED_DSO:=$(VER_E32IMPORTLIBBASE).dso
       
   144     $(eval $(BUILDMARKER_IMPORTLIBTARGET_DSO):=1)
       
   145   endif
       
   146 
       
   147   # ABIv1 .lib (for specific builds, toolchains and host OS platforms only)
       
   148   IMPORTLIBTARGET_LIB:=
       
   149   IMPORTLIBTARGETVERSIONED_LIB:=
       
   150   BUILDMARKER_IMPORTLIBTARGET_LIB:=TARGET_$(subst :,,$(VER_E32IMPORTLIBBASE)).lib
       
   151   # Only for builds that require and support them, and only on windows
       
   152   ifeq ($(OSTYPE),cygwin)
       
   153   ifeq ($(GENERATE_ABIV1_IMPLIBS),1)
       
   154     WHATRELEASE:=$(WHATRELEASE) $(if $(EXPLICITVERSION),,$(TMP_IMPORTLIBTARGET_ROOT).lib)
       
   155     WHATRELEASE:=$(WHATRELEASE) $(VER_E32IMPORTLIBBASE).lib
       
   156     ifeq ($($(BUILDMARKER_IMPORTLIBTARGET_LIB)),)
       
   157       IMPORTLIBTARGET_LIB:=$(TMP_IMPORTLIBTARGET_ROOT).lib
       
   158       IMPORTLIBTARGETVERSIONED_LIB:=$(VER_E32IMPORTLIBBASE).lib
       
   159       $(eval $(BUILDMARKER_IMPORTLIBTARGET_LIB):=1)
       
   160     endif
       
   161   endif
       
   162   endif
       
   163 endif
       
   164 
       
   165 # Try to make sure that we get the right linkas name
       
   166 # If linkas is specified then split it up and
       
   167 # put the hex version number in the right place
       
   168 ifeq ($(LINKAS),)
       
   169   LINKASNAME=$(TARGET)
       
   170   LINKASTYPE=$(if $(REQUESTEDTARGETEXT),$(REQUESTEDTARGETEXT),$(POSTLINKFILETYPE))
       
   171 else
       
   172   SPLIT_LINKAS=$(subst ., ,$(LINKAS))
       
   173   LINKASNAME=$(word 1,$(SPLIT_LINKAS))
       
   174   LINKASTYPE=$(word 2,$(SPLIT_LINKAS))
       
   175 endif
       
   176 
       
   177 # ignore UID3 if it is zero
       
   178 ifeq ($(UID3),00000000)
       
   179   LINKASVERSIONED=$(LINKASNAME){$(VERSIONHEX)}.$(LINKASTYPE)
       
   180 else
       
   181   LINKASVERSIONED=$(LINKASNAME){$(VERSIONHEX)}$(if $(UID3),[$(UID3)],).$(LINKASTYPE)
       
   182 endif
       
   183 
       
   184 ##########################################################################
       
   185 ## TARGET GROUPS ##
       
   186 RELEASABLES:=$(strip $(E32TARGET) $(ARTARGET) $(LINK_TARGET) $(MAPFILE))
       
   187 # More targets to be added later
       
   188 TARGETS:=$(strip $(E32TARGET) $(IMPORTLIBTARGET) $(LINK_TARGET) $(ARTARGET))
       
   189 
       
   190 CREATABLEPATHS:=$(OUTPUTPATH)
       
   191 CREATABLEPATHS:=$(CREATABLEPATHS) $(INTERMEDIATE_PLATFORM_PATH)
       
   192 CREATABLEPATHS:=$(CREATABLEPATHS) $(INTERMEDIATEPATH)
       
   193 CREATABLEPATHS:=$(CREATABLEPATHS) $(RELEASABLEPATH)
       
   194 CREATABLEPATHS:=$(CREATABLEPATHS) $(RUNTIME_LIBS_PATH)
       
   195 CREATABLEPATHS:=$(CREATABLEPATHS) $(IMPORTLIBPATH)
       
   196 WHATRELEASE:=$(WHATRELEASE) $(RELEASABLES)
       
   197 
       
   198 
       
   199 
       
   200 ## HIGH LEVEL Targets ##
       
   201 .PHONY:: $(ALLTARGET)
       
   202 
       
   203 ## GLOBAL TARGETS ############################################################
       
   204 $(ALLTARGET):: $(RELEASABLES)
       
   205 TARGET:: $(RELEASABLES)
       
   206 
       
   207 ## Internal targets ##
       
   208 
       
   209 # Determine the name of the generated DSO file ###############################
       
   210 # This is to generate the dso with the Some{Versionhex}.file.dso
       
   211 # It reproduces what appears to be a problem in the current build system
       
   212 # that affects messageintercept{000a0000}.esockdebug.dso whose
       
   213 # filename differs from it's "linkas" name.
       
   214 E32VAR:=$(subst .,$(CHAR_SPACE) ,$(TARGET))
       
   215 E32SOME:=$(word 1,$(E32VAR))
       
   216 E32VAR2:=$(patsubst $(E32SOME).%,%,$(TARGET))
       
   217 
       
   218 # Separate '_SH' variables created for output into bash - Preserves '{' and '}'
       
   219 
       
   220 ifneq ($(findstring .,$(TARGET)),)
       
   221 	DSODEFFILENAMEBASE:=$(E32SOME){$(VERSIONHEX)}.$(E32VAR2)
       
   222 else
       
   223 	DSODEFFILENAMEBASE:=$(TARGET){$(VERSIONHEX)}
       
   224 endif
       
   225 GENERATED_DSO:=$(call dblquote,$(INTERMEDIATEPATH)/$(DSODEFFILENAMEBASE).dso)
       
   226 GENERATED_DEFFILE:=$(call dblquote,$(INTERMEDIATEPATH)/$(DSODEFFILENAMEBASE).def)
       
   227 
       
   228 ## IMPORT LIBRARY  ###########################################################
       
   229 
       
   230 # Static libraries will be postlinked when they are used so don't try to postlink them
       
   231 
       
   232 ifneq ($(IMPORTLIBRARYREQUIRED),)
       
   233 ifneq ($(or $(DEFFILE),$(EXPORTUNFROZEN)),)
       
   234 # Both ABIv2 .dso and ABIv1 .lib import library generation require a processed .def file,
       
   235 # unless EXPORTUNFROZEN is being used
       
   236 PREPPEDDEFFILE:=
       
   237 ifneq ($(DEFFILE),)
       
   238   ifeq ($(EXPORTUNFROZEN),)
       
   239     PREPPEDDEFFILE:=$(INTERMEDIATEPATH)/$(TARGET).prep
       
   240     CLEANTARGETS:=$(CLEANTARGETS) $(PREPPEDDEFFILE)
       
   241     define importlibtarget_prepfile
       
   242       $(PREPPEDDEFFILE): $(DEFFILE)
       
   243 		$(call startrule,importlibtarget_prepfile,FORCESUCCESS) \
       
   244 		$(PREPDEF) $(call dblquote,$(DEFFILE)) $(call dblquote,$(PREPPEDDEFFILE)) \
       
   245 		$(call endrule,importlibtarget_prepfile)
       
   246     endef
       
   247     $(eval $(importlibtarget_prepfile))
       
   248   endif
       
   249 endif
       
   250 
       
   251 # ABIv2 .dso
       
   252 ifneq ($(IMPORTLIBTARGET_DSO),) # check that we haven't tried to specify this target already
       
   253 
       
   254   ifneq ($(EXPLICITVERSION),)
       
   255     TARGETS:=$(strip $(TARGETS) $(IMPORTLIBTARGETVERSIONED_DSO))
       
   256 
       
   257     # Add this importlibrary to our global targets
       
   258     LIBRARY:: $(IMPORTLIBTARGETVERSIONED_DSO)
       
   259     $(ALLTARGET):: $(IMPORTLIBTARGETVERSIONED_DSO)
       
   260     TARGET:: $(IMPORTLIBTARGETVERSIONED_DSO)
       
   261 
       
   262   else
       
   263     TARGETS:=$(strip $(TARGETS) $(IMPORTLIBTARGETVERSIONED_DSO) $(IMPORTLIBTARGET_DSO))
       
   264 
       
   265     # Add this importlibrary to our global targets
       
   266     LIBRARY:: $(IMPORTLIBTARGET_DSO)
       
   267     $(ALLTARGET):: $(IMPORTLIBTARGETVERSIONED_DSO) $(IMPORTLIBTARGET_DSO)
       
   268     TARGET:: $(IMPORTLIBTARGETVERSIONED_DSO) $(IMPORTLIBTARGET_DSO)
       
   269 
       
   270 
       
   271   endif
       
   272 
       
   273 
       
   274 
       
   275   ifneq ($(EXPORTUNFROZEN),) # Unfrozen  - warn and create .dso as side-effect of the final postlink
       
   276     $(info <warning project='$(PROJECT_META)' component='$(COMPONENT_META)'>EXPORTUNFROZEN present in $(PROJECT_META) - unfrozen exports will be represented in import library.</warning> )
       
   277     define importlibtarget_unfrozen
       
   278       $(IMPORTLIBTARGET_DSO): $(IMPORTLIBTARGETVERSIONED_DSO)
       
   279 		$(call startrule,importlibtarget_unfrozen,FORCESUCCESS) \
       
   280 		$(GNUCP) $$(call dblquote,$$<) $$(call dblquote,$$@) \
       
   281 		$(call endrule,importlibtarget_unfrozen)
       
   282 
       
   283        CLEANTARGETS:=$$(CLEANTARGETS) $(IMPORTLIBTARGET_DSO)
       
   284 
       
   285     endef
       
   286 
       
   287     define importlibtarget_unfrozen_ver
       
   288       $(IMPORTLIBTARGETVERSIONED_DSO): $(E32TARGET)
       
   289 		$(call startrule,importlibversioned_unfrozen,FORCESUCCESS) \
       
   290 		$(GNUCP) "$(GENERATED_DSO)" "$$@" \
       
   291 		$(call endrule,importlibversioned_unfrozen)
       
   292 
       
   293       CLEANTARGETS:=$$(CLEANTARGETS) $(IMPORTLIBTARGET_DSO)
       
   294     endef
       
   295 
       
   296     ifeq ($(EXPLICITVERSION),)
       
   297       # Generate the general dso if we aren't
       
   298       # being asked to make just the specific version.
       
   299       $(eval $(importlibtarget_unfrozen))
       
   300     endif
       
   301 
       
   302     $(eval $(importlibtarget_unfrozen_ver))
       
   303   else
       
   304     ifneq ($(DEFFILE),) # Frozen - use the def file and create .dso directly
       
   305       define importlibtarget_func
       
   306        $(IMPORTLIBTARGET_DSO): $(IMPORTLIBTARGETVERSIONED_DSO)
       
   307 	   $(call startrule,importlibtarget,FORCESUCCESS) \
       
   308 	   $(GNUCP) "$$<" "$$@" \
       
   309 	   $(call endrule,importlibtarget)
       
   310 
       
   311           CLEANTARGETS:=$$(CLEANTARGETS) $(IMPORTLIBTARGET_DSO)
       
   312       endef
       
   313 
       
   314       ifeq ($(EXPLICITVERSION),)
       
   315           # Generate the general dso if we aren't
       
   316           # being asked to make just the specific version.
       
   317           $(eval $(importlibtarget_func))
       
   318       endif
       
   319 
       
   320       define importlibtargetversioned_func
       
   321         $(IMPORTLIBTARGETVERSIONED_DSO): $(ELF2E32) $(PREPPEDDEFFILE)
       
   322 	      $(call startrule,importlibversioned,FORCESUCCESS) \
       
   323 	      $(ELF2E32) --sid=0x$(if $(SID),$(SID),$(if $(UID3),$(UID3),0))  --version=$(VERSION)  	   \
       
   324 	 	  --definput="$(PREPPEDDEFFILE)" 				   \
       
   325 	 	  --dso=$$(call dblquote,$$@) 				   \
       
   326 	 	  --linkas=$(call dblquote,$(LINKASVERSIONED)) \
       
   327 	      $(call endrule,importlibversioned)
       
   328 
       
   329               CLEANTARGETS:=$$(CLEANTARGETS) $(IMPORTLIBTARGETVERSIONED_DSO)
       
   330       endef
       
   331       $(eval $(importlibtargetversioned_func))
       
   332     endif #  ifneq ($(DEFFILE),)
       
   333   endif #  ifneq ($(EXPORTUNFROZEN),)
       
   334 endif #  ifneq ($(IMPORTLIBTARGET_DSO),)
       
   335 
       
   336 # ABIv1 .lib
       
   337 ifneq ($(IMPORTLIBTARGETVERSIONED_LIB),) # check that we haven't tried to specify this target already
       
   338   CLEANTARGETS:=$(CLEANTARGETS) $(IMPORTLIBTARGETVERSIONED_LIB) $(IMPORTLIBTARGET_LIB)
       
   339 
       
   340   define abiv1_generatelib
       
   341 
       
   342     ifeq ($(EXPLICITVERSION),)
       
   343       LIBRARY:: $(IMPORTLIBTARGETVERSIONED_LIB) $(IMPORTLIBTARGET_LIB)
       
   344 
       
   345     else
       
   346       LIBRARY:: $(IMPORTLIBTARGETVERSIONED_LIB)
       
   347 
       
   348     endif
       
   349 
       
   350     # If frozen, a prepped .def file is used as the basis for .lib creation
       
   351     # If unfrozen, .lib files are based on the .def file generated by the final postlink
       
   352     $(IMPORTLIBTARGETVERSIONED_LIB): $(if $(EXPORTUNFROZEN),$(E32TARGET),$(PREPPEDDEFFILE))
       
   353 	$(call startrule,importlibversioned_abiv1) \
       
   354         if [ -f "$(EPOCROOT)/epoc32/tools/def2dll.pl" -a -f "$(if $(EXPORTUNFROZEN),$(GENERATED_DEFFILE),$(PREPPEDDEFFILE))" ]; then \
       
   355                  $(PERL) $(EPOCROOT)/epoc32/tools/def2dll.pl \
       
   356 		--path=$(IMPORTLIBPATH) \
       
   357 		--bldpath=$(INTERMEDIATEPATH) \
       
   358 		--import=$(notdir $(basename $(IMPORTLIBTARGETVERSIONED_LIB))) \
       
   359 		--deffile="$(if $(EXPORTUNFROZEN),$(GENERATED_DEFFILE),$(PREPPEDDEFFILE))" \
       
   360 		--linkAs=$(call dblquote,$(LINKASVERSIONED)) \
       
   361 		--inter ; fi \
       
   362 	$(call endrule,importlibversioned_abiv1)
       
   363 
       
   364     ifeq ($(EXPLICITVERSION),)
       
   365       $(IMPORTLIBTARGET_LIB): $(IMPORTLIBTARGETVERSIONED_LIB)
       
   366 	$(call startrule,importlibtarget_abiv1) \
       
   367 	if [ -f $(EPOCROOT)/epoc32/tools/def2dll.pl ]; then $(GNUCP) "$$<" "$$@" ; fi \
       
   368 	$(call endrule,importlibtarget_abiv1)
       
   369     endif
       
   370   endef
       
   371 
       
   372   $(eval $(abiv1_generatelib))
       
   373 endif #  ifneq ($(IMPORTLIBTARGET_LIB),)
       
   374 endif #  ($(or $(DEFFILE),$(EXPORTUNFROZEN)),)
       
   375 endif #  ifneq ($(IMPORTLIBRARYREQUIRED),)
       
   376 
       
   377 
       
   378 ## POSTLINK ##################################################################
       
   379 
       
   380 # Set up the name of the exports file if this is a customdll
       
   381 EXPTARGET:=
       
   382 ifneq ($(DOPOSTLINK),)
       
   383   ifneq ($(and $(or $(STATICLIBRARY),$(ARMLIBS),$(ARMRT)),$(DEFFILE)),)
       
   384     EXPTARGET:=$(INTERMEDIATE_PLATFORM_PATH)/$(notdir $(VER_E32IMPORTLIBBASE)).exp
       
   385   endif
       
   386 endif
       
   387 
       
   388 # Generating the import library is enough if TARGETTYPE=implib #############
       
   389 
       
   390 ifneq ($(DOPOSTLINK),)
       
   391 include $(FLMHOME)/e32postlink.mk
       
   392 endif # ifneq ($(DOPOSTLINK),)
       
   393 
       
   394 ifneq ($(TARGETTYPE),implib)
       
   395 
       
   396 ## CUSTOM DLLS ###############################################################
       
   397 # exp file
       
   398 #
       
   399 # This tends to help getting exported objects
       
   400 # out of the arm libs and into custom dlls.
       
   401 
       
   402 ifneq ($(EXPTARGET),)
       
   403 ifeq ($(TARGET_$(EXPTARGET)),)
       
   404 # We only need one of these exptargets for UDEB and UREL
       
   405 TARGET_$(EXPTARGET):=1
       
   406 
       
   407 EXPTARGETASMFILE:=$(INTERMEDIATE_PLATFORM_PATH)/$(notdir $(VER_E32IMPORTLIBBASE)).s
       
   408 
       
   409 define e32expgen_func
       
   410 $(EXPTARGET): $(DEFFILE) $(ELF2E32)
       
   411 	$(call startrule,expgen) \
       
   412 	$(ELF2E32) \
       
   413 	   --definput=$$(call dblquote,$(DEFFILE)) \
       
   414 	   --dump=a \
       
   415 	   --output=$(call dblquote,$(EXPTARGETASMFILE)) && \
       
   416 	$(ASM) $(TARGET_ARCH_OPTION) $(AAPCS_OPTION) $(ASM_OUTPUT_OPTION) $$(call dblquote, $$@) $(EXPTARGETASMFILE) \
       
   417 	$(call endrule,expgen)
       
   418 endef
       
   419 
       
   420 $(eval $(e32expgen_func))
       
   421 CLEANTARGETS:=$(CLEANTARGETS) $(EXPTARGET) $(EXPTARGETASMFILE)
       
   422 endif
       
   423 endif
       
   424 
       
   425 
       
   426 
       
   427 
       
   428 ## SOURCE FILES ##############################################################
       
   429 
       
   430 # Source files can be either C++ files (.cpp) or Assmbler-in-C++ files (.cia)
       
   431 # We have to split the two because they have the same link stage, the compile
       
   432 # stage is different for each.
       
   433 
       
   434 CPPFILEEXTENSIONS:=.cpp .CPP .Cpp .CPp .CpP .cPP .cpP .cPp .cc .CC \
       
   435 	.Cc .c++ .C++ .cxx .CXX .Cxx .cXx .CxX .CXx .cC .cXX .cxX
       
   436 CFILEEXTENSIONS:=.c .C
       
   437 CIAFILEEXTENSIONS:=.CIA .cia .Cia .cIa .cIA .ciA .CIa .CiA
       
   438 ASMFILEEXTENSIONS:=.s .S
       
   439 
       
   440 
       
   441 # Extract the CPP files from our sources
       
   442 CPPFILES:=$(call extractfilesoftype,$(CPPFILEEXTENSIONS),$(SOURCE))
       
   443 CFILES:=$(call extractfilesoftype,$(CFILEEXTENSIONS),$(SOURCE))
       
   444 ASMFILES:=$(call extractfilesoftype,$(ASMFILEEXTENSIONS),$(SOURCE))
       
   445 
       
   446 # Find out what assember-in-c files there are
       
   447 # If appropriate, work out what CPP files will be created from the assembler files
       
   448 CIAFILES:=$(call extractfilesoftype,$(CIAFILEEXTENSIONS),$(SOURCE))
       
   449 CIA_CPPFILES:=
       
   450 ifeq ($(TRANSFORM_CIA),1)
       
   451   CIA_CPPFILES:=$(call relocatefiles,$(INTERMEDIATEPATH),$(call extractandmap,$(CIAFILEEXTENSIONS),_.cpp,$(CIAFILES)))
       
   452 else
       
   453 
       
   454 endif
       
   455 
       
   456 ## LINK ######################################################################
       
   457 # Bring together all the .o files compiled from  .cpp, .c, .s and .cia files.
       
   458 # These files are stored in the "non-releasable" output diretory.
       
   459 
       
   460 define mapcpp2object
       
   461 $(call relocatefiles,$(INTERMEDIATEPATH),$(call extractandmap,$(CPPFILEEXTENSIONS),.o,$1))
       
   462 endef
       
   463 
       
   464 define mapc2object
       
   465 $(call relocatefiles,$(INTERMEDIATEPATH),$(call extractandmap,$(CFILEEXTENSIONS),.o,$1))
       
   466 endef
       
   467 
       
   468 define mapasm2object
       
   469 $(call relocatefiles,$(INTERMEDIATEPATH),$(call extractandmap,$(ASMFILEEXTENSIONS),.o,$1))
       
   470 endef
       
   471 
       
   472 define mapcia2object
       
   473 $(call relocatefiles,$(INTERMEDIATEPATH),$(call extractandmap,$(CIAFILEEXTENSIONS),_.o,$1))
       
   474 endef
       
   475 
       
   476 # Determine what object files will be linked by using the source files.
       
   477 CPPFILES_LINKOBJECTS:=$(call mapcpp2object,$(CPPFILES))
       
   478 CFILES_LINKOBJECTS:=$(call mapc2object,$(CFILES))
       
   479 ifeq ($(TRANSFORM_CIA),1) 
       
   480   CIAFILES_LINKOBJECTS:=$(patsubst %_.cpp,%_.o,$(CIA_CPPFILES))
       
   481 else
       
   482   CIAFILES_LINKOBJECTS:=$(call mapcia2object,$(CIAFILES))
       
   483 endif
       
   484 ASMFILES_LINKOBJECTS:=$(call mapasm2object,$(ASMFILES))
       
   485 
       
   486 # Try to link object files in the order in which the source files were specified.
       
   487 # This makes BC comparisons with non-Raptor builds easier.
       
   488 # Use the order of the source list to establish the order of the object files:
       
   489 LINKOBJECTS:=$(call relocatefiles,$(INTERMEDIATEPATH),$(SOURCE))
       
   490 # Replace the file extensions of the Source files with .o (or _.o for cia files) now
       
   491 # the list will contain the object files in the same order as the list of source files.
       
   492 LINKOBJECTS:=$(foreach FILE,$(LINKOBJECTS),$(basename $(FILE))$(if $(filter $(addprefix %,$(CIAFILEEXTENSIONS)),$(FILE)),_).o)
       
   493 
       
   494 ifneq ($(MULTIFILE_ENABLED),)
       
   495 MULTIFILEOBJECT:=$(INTERMEDIATEPATH)/$(TARGET).$(POSTLINKFILETYPE)_$(VARIANTTYPE)_multifileobject.o
       
   496 MULTIFILE_VIAFILE:=$(INTERMEDIATEPATH)/$(TARGET)_$(VARIANTTYPE)_multifile.via
       
   497 endif
       
   498 
       
   499 ## Via file ####################################
       
   500 # list of all objects to be linked
       
   501 #
       
   502 VIAFILE:=$(INTERMEDIATEPATH)/$(TARGET)_$(VARIANTTYPE)_objects.via
       
   503 ifneq ($(GENERATELINKERFEEDBACK),)
       
   504 FEEDBACKFILE:=$(INTERMEDIATEPATH)/$(TARGET)_$(VARIANTTYPE)_feedback.fdb
       
   505 endif
       
   506 
       
   507 # The groupin10 macro allows us to construct a via file, 10 objects at a time
       
   508 # to avoid limits on argument lengths and sizes on Windows.
       
   509 # It expands to a list of commands, each of which is on a separate line.
       
   510 # This causes the shell to be invoked once for each line but each line should
       
   511 # be shorter than the maximum allowed by windows.
       
   512 define groupin10
       
   513 	$(if $1,@echo -e $(foreach L,$(wordlist 1,10,$1),"$(L)\\n") >>$(VIAFILE),)
       
   514 	$(if $1,$(call groupin10,$(wordlist 11,$(words $1),$1)),@true)
       
   515 endef
       
   516 
       
   517 ################################################
       
   518 
       
   519 
       
   520 ## Link-type selection:
       
   521 #	runtime static libraries link via AR
       
   522 ifneq ($(ARTARGET),)
       
   523 # Assuming that there are no libdeps in this case because this is probably one of the
       
   524 # Runtime libraries which has no deps.
       
   525 
       
   526 define artarget_func
       
   527 $(ARTARGET): $(if $(MULTIFILE_ENABLED),$(MULTIFILEOBJECT),$(LINKOBJECTS)) $(STDCPPTAGFILE)
       
   528 	$(if $(MULTIFILE_ENABLED),,@echo "$(STDCPPTAGFILE)" > $(VIAFILE);
       
   529 	$(call groupin10,$(LINKOBJECTS)) ;)
       
   530 	$(call startrule,ar,FORCESUCCESS) \
       
   531 	$$(call dblquote,$(AR)) $(ARCHIVER_CREATE_OPTION) $$@ $(if $(MULTIFILE_ENABLED),$(MULTIFILEOBJECT),$(COMMANDFILE_OPTION)$(VIAFILE)) \
       
   532 	$(if $(DUMPBCINFO),&& $(FROMELF) -v $$@  > $$@.elfdump,)  \
       
   533 	$(call endrule,ar)
       
   534 endef
       
   535 $(eval $(artarget_func))
       
   536 
       
   537 CLEANTARGETS:=$(CLEANTARGETS) $(VIAFILE) $(ARTARGET) $(if $(DUMPBCINFO),$(ARTARGET).elfdump,)
       
   538 endif
       
   539 
       
   540 
       
   541 
       
   542 # Targettype is some type of DLL or EXE (or derivative)
       
   543 ifneq ($(LINK_TARGET),)
       
   544 
       
   545 escaped_located_ARMLIBS:=$(foreach L,$(ARMLIBS),$(call ruleEscape,$(wildcard $(subst $(CHAR_SPACE),?,$(RVCTLIB)/*/$(L)))))
       
   546 quoted_located_ARMLIBS:=$(foreach L,$(ARMLIBS),$(call dblquoteitem,$(wildcard $(RVCTLIB)/*/$(L))))
       
   547 located_STATICLIBRARIES:=$(foreach L,$(STATICLIBRARY),$(STATIC_LIBRARY_DIR)/$(L).lib)
       
   548 e32abiv2_LIBS:=$(EXPTARGET) $(LINKER_STUB_LIBRARY) $(if $(STATIC_RUNTIME_LIB),$(STATIC_RUNTIME_DIR)/$(STATIC_RUNTIME_LIB),) $(located_STATICLIBRARIES)
       
   549 # DLLS and EXEs - These objects are linked by a linker
       
   550 ifeq ($(ARMRT),)
       
   551 # Some of the runtime libraries do not set ARMRT because of a circular reference
       
   552 # problem; we need to stop these from linking to their own dso and not link to
       
   553 # the STATIC_LIBS_LIST.
       
   554 ifneq ($(findstring $(TARGET).dso,$(RUNTIME_LIBS_LIST)),)
       
   555 # (almost) ARM RUNTIME LIBS
       
   556 REDUCED_RUNTIME_LIBS_LIST:=$(subst $(TARGET).dso,,$(RUNTIME_LIBS_LIST))
       
   557 
       
   558 ifeq ($(VARIANTTYPE),udeb)
       
   559   e32abiv2_LIBS:=$(e32abiv2_LIBS) $(addprefix $(IMPORTLIBPATH)/,$(LIBRARY_DEBUG)) $(addprefix $(RUNTIME_LIBS_PATH)/,$(REDUCED_RUNTIME_LIBS_LIST)) 
       
   560 else
       
   561   e32abiv2_LIBS:=$(e32abiv2_LIBS) $(addprefix $(IMPORTLIBPATH)/,$(LIBRARY)) $(addprefix $(RUNTIME_LIBS_PATH)/,$(REDUCED_RUNTIME_LIBS_LIST)) 
       
   562 endif
       
   563 quoted_e32abiv2_LIBS=$(e32abiv2_LIBS) $(quoted_located_ARMLIBS)
       
   564 escaped_e32abiv2_LIBS=$(e32abiv2_LIBS) $(escaped_located_ARMLIBS)
       
   565 
       
   566 else
       
   567 # NORMAL
       
   568 #
       
   569 ifeq ($(VARIANTTYPE),udeb)
       
   570   e32abiv2_LIBS:=$(e32abiv2_LIBS) $(addprefix $(IMPORTLIBPATH)/,$(LIBRARY_DEBUG))
       
   571 else
       
   572   e32abiv2_LIBS:=$(e32abiv2_LIBS) $(addprefix $(IMPORTLIBPATH)/,$(LIBRARY))
       
   573 endif
       
   574 ifeq ($(HAS_DEDICATED_OP_NEWDEL_LIB),1)
       
   575   e32abiv2_LIBS:=$(e32abiv2_LIBS) $(addprefix $(RUNTIME_LIBS_PATH)/,$(NEWLIB))
       
   576 endif
       
   577 quoted_e32abiv2_LIBS:=$(e32abiv2_LIBS) $(addprefix $(RUNTIME_LIBS_PATH)/,$(RUNTIME_LIBS_LIST)) $(call addquotedprefix,$(STATIC_LIBS_PATH)/,$(STATIC_LIBS_LIST)) $(quoted_located_ARMLIBS)
       
   578 escaped_e32abiv2_LIBS:=$(e32abiv2_LIBS) $(addprefix $(RUNTIME_LIBS_PATH)/,$(RUNTIME_LIBS_LIST)) $(addprefix $(call ruleEscape,$(STATIC_LIBS_PATH)/),$(STATIC_LIBS_LIST)) $(escaped_located_ARMLIBS)
       
   579 
       
   580 endif
       
   581 else
       
   582 # ARM RUNTIME LIBS
       
   583 ifeq ($(VARIANTTYPE),udeb)
       
   584   e32abiv2_LIBS:=$(e32abiv2_LIBS) $(addprefix $(IMPORTLIBPATH)/,$(LIBRARY_DEBUG)) 
       
   585 else
       
   586   e32abiv2_LIBS:=$(e32abiv2_LIBS) $(addprefix $(IMPORTLIBPATH)/,$(LIBRARY))
       
   587 endif
       
   588 quoted_e32abiv2_LIBS=$(e32abiv2_LIBS) $(quoted_located_ARMLIBS)
       
   589 escaped_e32abiv2_LIBS=$(e32abiv2_LIBS) $(escaped_located_ARMLIBS)
       
   590 endif
       
   591 
       
   592 # NOTE: the groupin10 macro must be used before a call to the "startrule" macro
       
   593 # because the code between startrule and endrule is packaged up into one
       
   594 # commandline which would defeat the purpose of groupin10.
       
   595 # This is undesirable because viafile generation commands appear
       
   596 # outside the relevant tags but it is also unavoidable.
       
   597 define linktarget_func
       
   598 ## The actual link target, dependencies and build step
       
   599 $(LINK_TARGET): $(if $(MULTIFILE_ENABLED),$(MULTIFILEOBJECT) $(CIAFILES_LINKOBJECTS),$(LINKOBJECTS)) $(escaped_e32abiv2_LIBS) $(LINKER_ENTRYPOINT_LIBDEP) $(if $(SUPPORTS_STDCPP_NEWLIB),$(CHECKLIB)) $(if $(LINKERFEEDBACK_STAGE2),$(FEEDBACKFILE),)
       
   600 	$(if $(MULTIFILE_ENABLED),,@echo -n "" > $(VIAFILE);
       
   601 	$(call groupin10,$(LINKOBJECTS)) ;)
       
   602 	$(call startrule,link) \
       
   603 	$(if $(PERTURBSTARTTIME),$(RANSLEEP) $(PERTURBMSECS) ;,) \
       
   604 	$(if $(SUPPORTS_STDCPP_NEWLIB),$(if $(located_STATICLIBRARIES),$(CHECKLIB) $(CHECKLIB_TYPE) --elf $(call dblquote,$(located_STATICLIBRARIES)) &&,),) \
       
   605 	$(LD) $(LINKER_MISC_FLAGS) $(LINKER_DEFAULT_LIB_PATHS) $(SYMBIAN_LINK_FLAGS) $(if $(DEBUG_INFO),$(LINKER_DEBUG_OPTION),$(LINKER_NODEBUG_OPTION)) \
       
   606 	  $(SHARED_OBJECT_OPTION) $(SPLIT_OPTION) \
       
   607 	  $(RW_BASE_OPTION) 0x400000 \
       
   608 	  $(LINKER_ARCH_OPTION) \
       
   609 	  $(SYMVER_OPTION) $(SO_NAME_OPTION) $(call dblquote,$(LINKASVERSIONED)) \
       
   610 	  $(LINKER_ENTRYPOINT_SETTING) \
       
   611 	  -o $$(call dblquote,$$@) \
       
   612 	  $(if $(LTCG),$(LTCG_OPTION),) \
       
   613 	  $(LINKER_SYMBOLS_OPTION) $(LINKER_SYMBOLS_FILE_OPTION) \
       
   614 	  $(call dblquote,$(MAPFILE)) \
       
   615   	  $(LINKEROPTION) \
       
   616 	  $(if $(MULTIFILE_ENABLED),$(call dblquote,$(MULTIFILEOBJECT) $(CIAFILES_LINKOBJECTS)),$(COMMANDFILE_OPTION)$(call dblquote,$(VIAFILE))) \
       
   617           $(if $(GENERATELINKERFEEDBACK),$(FEEDBACK_OPTION)$(call dblquote,$(FEEDBACKFILE))) \
       
   618 	  $(if $(LINKER_ADD_STATIC_RUNTIME),$(if $(STATIC_RUNTIME_LIB),$(LINKER_GROUP_START_OPTION) $(STATIC_RUNTIME_DIR)/$(STATIC_RUNTIME_LIB) $(LINKER_GROUP_END_OPTION),)) \
       
   619 	  $(quoted_e32abiv2_LIBS) $(LINKER_DEFAULT_LIBS)\
       
   620 	$(call endrule,link)
       
   621 
       
   622 $(MAPFILE): $(LINK_TARGET)
       
   623 endef
       
   624 $(eval $(linktarget_func))
       
   625 
       
   626 CLEANTARGETS:=$(CLEANTARGETS) $(LINK_TARGET) $(if $(GENERATELINKERFEEDBACK),$(FEEDBACKFILE)) $(if $(MULTIFILE_ENABLED),$(MULTIFILEOBJECT))
       
   627 CLEANTARGETS:=$(CLEANTARGETS) $(VIAFILE)
       
   628 CLEANTARGETS:=$(CLEANTARGETS) $(MAPFILE)
       
   629 WHATRELEASE:=$(WHATRELEASE) $(MAPFILE)
       
   630 
       
   631 endif # if TARGETTYPE lib
       
   632 
       
   633 
       
   634 ## Run trace compiler ##############################################
       
   635 ifeq ($(UID3),)
       
   636  ifeq ($(UID2),)
       
   637   USE_TRACE_COMPILER:=
       
   638  else
       
   639   UID_TC:=$(UID2)
       
   640  endif
       
   641 else
       
   642  UID_TC:=$(UID3)
       
   643 endif
       
   644 
       
   645 # USE_TRACE_COMPILER defaults to blank in Raptor config.
       
   646 # Users can turn TC on by setting it to 1 in user config.
       
   647 ifneq ($(USE_TRACE_COMPILER),)
       
   648   include $(FLMHOME)/tracecompiler.mk
       
   649 endif
       
   650 
       
   651 CC_CPPONLY_ARGS:=$(SYMBIAN_CCFLAGS) $(if $(DEBUG_INFO),-g) $(DEBUG_FORMAT) \
       
   652   $(RUNTIME_SYMBOL_VISIBILITY_OPTION) $(EXCEPTIONS) \
       
   653   $(CC_WARNINGS_CONTROL_OPTION) $(CC_ERRORS_CONTROL_OPTION) \
       
   654   $(TARGET_ARCH_OPTION) $(ENUM_OPTION) $(OWN_LIBRARY_OPTION) $(FPMODE_OPTION) \
       
   655   $(EXPORT_VTBL_OPTION) $(NO_UNALIGNED_ACCESS) $(VFE_OPTION) $(AAPCS_OPTION) \
       
   656   $(CPPONLYOPTION) $(INSTRUCTION_SET) \
       
   657   $(if $(ALWAYS_BUILD_AS_ARM),$(ARM_INSTRUCTION_SET),$(THUMB_INSTRUCTION_SET) $(call makemacrodef,-D,$(COMPILER_THUMB_DEFINES))) \
       
   658   $(COMPILER_FPU_FLAGS)
       
   659 
       
   660 ## COMPILE CPP Files #################################################################
       
   661 
       
   662 # For ARMCC we can compile all sourcefiles with one invocation
       
   663 # The pathprep macro is used to make sure that forward slashes in options
       
   664 # are not interpreted as being paths by CYGWIN on Windows.  On windows
       
   665 # pathprep makes a forward slash into two.
       
   666 
       
   667 # The majority of ARMCC arguments are common across all compiler invocations
       
   668 # Order is significant here in that OPTION_REPLACE here and in ABLD should
       
   669 # have the same impact
       
   670 CC_CORE_ARGS:=$(SYMBIAN_CCFLAGS) $(if $(DEBUG_INFO),-g) $(DEBUG_FORMAT) \
       
   671   $(RUNTIME_SYMBOL_VISIBILITY_OPTION) $(EXCEPTIONS) \
       
   672   $(CC_WARNINGS_CONTROL_OPTION) $(CC_ERRORS_CONTROL_OPTION) \
       
   673   $(TARGET_ARCH_OPTION) $(ENUM_OPTION) $(OWN_LIBRARY_OPTION) $(FPMODE_OPTION) \
       
   674   $(EXPORT_VTBL_OPTION) $(NO_UNALIGNED_ACCESS) $(VFE_OPTION) $(AAPCS_OPTION) \
       
   675   $(COMPILE_ONLY_OPTION) $(INSTRUCTION_SET) \
       
   676   $(if $(ALWAYS_BUILD_AS_ARM),$(ARM_INSTRUCTION_SET),$(THUMB_INSTRUCTION_SET) $(call makemacrodef,-D,$(COMPILER_THUMB_DEFINES))) \
       
   677   $(COMPILER_FPU_FLAGS)
       
   678 
       
   679 ifeq ($(STDCPP),1)
       
   680 SYSTEMINCLUDE:=$(SYSTEMINCLUDE) $(call concat, $(COMPILER_SYSTEM_INCLUDE_OPTION),$(call dblquote,$(STDCPP_INCLUDE)))
       
   681 endif
       
   682 
       
   683 define option_replace
       
   684   # Process a single, combined, item of the form 'search<->replace' in order to modify the command line tool call
       
   685   # We split this into its component arguments for use in substitutions
       
   686   # Spaces will have been escaped elsewhere to maintain distinct words, so we resurrect these
       
   687   # after the split.
       
   688   SEARCH:=$(subst %20,$(CHAR_SPACE),$(word 1,$(subst <->,$(CHAR_SPACE),$(1))))
       
   689   REPLACE:=$(subst %20,$(CHAR_SPACE),$(word 2,$(subst <->,$(CHAR_SPACE),$(1))))
       
   690 
       
   691   # Depending on whether there's a wildcard in the search, we may require either a normal $(subst) or a $(patsubst)
       
   692   PATSUBST:=$$(if $$(findstring %,$$(SEARCH)),1,)
       
   693 
       
   694   ifeq ($$(PATSUBST),1)
       
   695     CC_CORE_ARGS:=$$(patsubst $$(SEARCH),$$(REPLACE),$$(CC_CORE_ARGS))
       
   696   else
       
   697     CC_CORE_ARGS:=$$(subst $$(SEARCH),$$(REPLACE),$$(CC_CORE_ARGS))
       
   698   endif
       
   699 endef
       
   700 $(foreach ITEM,$(OPTION_REPLACE_COMPILER),$(eval $(call option_replace,$(ITEM))))
       
   701 
       
   702 define e32abiv2_compile
       
   703 
       
   704 $(eval DEPENDFILENAME:=$(1).d)
       
   705 $(eval DEPENDFILE:=$(wildcard $(DEPENDFILENAME)))
       
   706 
       
   707 # $4 is for language specific options (e.g. C++ vs C)
       
   708 $(1): $(2) $(PROJECT_META) $(if $(MULTIFILE_ENABLED),,$(if $(DEPENDFILE),,RESOURCE BITMAP EXPORT)) $(if $(USE_TRACE_COMPILER),$(TRACE_MARKER),) $(if $(LINKERFEEDBACK_STAGE2),$(FEEDBACKFILE),)
       
   709 	$(call startrule,compile,,$(2))		\
       
   710 		$(if $(PERTURBSTARTTIME), $(RANSLEEP) $(PERTURBMSECS) ;,) \
       
   711 		$(if $(MULTIFILE_ENABLED), echo $(2) $(3) > $(MULTIFILE_VIAFILE) ;,) \
       
   712 		$(CC) $(LICENSERETRY_OPTION) \
       
   713 			$(CC_CORE_ARGS) \
       
   714 			$(OPTION_COMPILER) $(if $(MULTIFILE_ENABLED),$(4),$(3)) \
       
   715 			$(if $(LTCG),$(LTCG_OPTION),) \
       
   716 			$(if $(USE_PROFILER_FEEDBACK),--profile=$(call dblquote,$(ARM_PROFILER_FILE)),) \
       
   717 			$(call makemacrodef,-D,$(COMPILER_INTERWORK_DEFINES) $(CDEFS))				\
       
   718 			$(if $(PREINCLUDE),$(PREINCLUDE_OPTION) ,)$(call concat, $(PREINCLUDE_OPTION) ,$(call dblquote,$(PREINCLUDE)))\
       
   719 			$(if $(SET_ARMINC),$(if $(RVCTINC),$(COMPILER_SYSTEM_INCLUDE_OPTION)$(call dblquoteitem,$(RVCTINC)),),)       \
       
   720 			$(COMPILER_SYSTEM_INCLUDE_OPTION)$$(call dblquote,$$(<D))                                                      \
       
   721 			$(if $(USERINCLUDE),$(COMPILER_SYSTEM_INCLUDE_OPTION),)$(call concat, $(COMPILER_SYSTEM_INCLUDE_OPTION),$(call dblquote,$(USERINCLUDE)))      \
       
   722 			$(if $(SYSTEMINCLUDE),$(COMPILER_SYSTEM_INCLUDE_OPTION),)$(call concat, $(COMPILER_SYSTEM_INCLUDE_OPTION),$(call dblquote,$(SYSTEMINCLUDE)))  \
       
   723 			$(if $(NOHIDEALL),--no_hide_all,) \
       
   724 			$(DEPEND_OPTION) $(call dblquote,$(1).d) \
       
   725                         $(if $(LINKERFEEDBACK_STAGE2),$(FEEDBACK_OPTION)$(call dblquote,$(FEEDBACKFILE))) \
       
   726 			$(if $(MULTIFILE_ENABLED),--multifile $(OUTPUT_OPTION) $(MULTIFILEOBJECT) \
       
   727 			--via $$(call dblquote, $(MULTIFILE_VIAFILE)),$(OUTPUT_OPTION) $$@ $$(call dblquote, $$<))  \
       
   728 	$(call endrule,compile)
       
   729 
       
   730 CLEANTARGETS:=$$(CLEANTARGETS) $(DEPENDFILENAME)
       
   731 ifneq "$(DEPENDFILE)" ""
       
   732 ifeq ($(NO_DEPEND_INCLUDE),)
       
   733   ifeq "$(filter %CLEAN,$(call uppercase,$(MAKECMDGOALS)))" ""
       
   734     -include $(DEPENDFILE)
       
   735   endif
       
   736 endif
       
   737 endif
       
   738 
       
   739 # individual source file compilation
       
   740 SOURCETARGET_$(call sanitise,$(2)): $(1)
       
   741 
       
   742 endef
       
   743 
       
   744 # Evaluate .cpp and .c files in one go for multifile, cannot do in separate steps since we have the same target.
       
   745 # This implementation means the .c files will always get put at the end of the .via file. Maybe there is a better way to do this?
       
   746 $(if $(MULTIFILE_ENABLED),$(eval $(call e32abiv2_compile,$(MULTIFILEOBJECT),$(CPPFILES),$(CFILES),$(CPP_LANG_OPTION))),$(foreach F,$(CPPFILES),$(eval $(call e32abiv2_compile,$(call mapcpp2object,$(F)),$(F),$(CPP_LANG_OPTION)))))
       
   747 $(if $(MULTIFILE_ENABLED),,$(foreach F,$(CFILES),$(eval $(call e32abiv2_compile,$(call mapc2object,$(F)),$(F),$(C_LANG_OPTION)))))
       
   748 ifneq ($(TRANSFORM_CIA),1)
       
   749   $(if $(MULTIFILE_ENABLED),,$(foreach F,$(CIAFILES),$(eval $(call e32abiv2_compile,$(call mapcia2object,$(F)),$(F),$(CPP_LANG_OPTION) $(COMPILER_CIA_FLAGS)))))
       
   750 endif
       
   751 
       
   752 CLEANTARGETS:=$(CLEANTARGETS) $(if $(MULTIFILE_ENABLED),$(MULTIFILE_VIAFILE) $(MULTIFILEOBJECT),$(CPPFILES_LINKOBJECTS) $(CFILES_LINKOBJECTS) $(CIAFILES_LINKOBJECTS)) $(if $(GENERATELINKERFEEDBACK),$(FEEDBACKFILE))
       
   753 
       
   754 ## Listing target ###################################################
       
   755 # Very similar to compile, apart from the extra flags passed to the
       
   756 # compile and different output options
       
   757 
       
   758 define map2listfile
       
   759 $(call relocatefiles,$(INTERMEDIATEPATH),$(call extractandmap,$(CPPFILEEXTENSIONS) $(CFILEEXTENSIONS),.lis,$1))
       
   760 endef
       
   761 
       
   762 
       
   763 define e32abiv2_cpponly
       
   764 # $1 is the sourcefile
       
   765 
       
   766 $(eval CPPONLYTARGET:=$(strip $(call extractandmap,$(CPPFILEEXTENSIONS) $(CFILEEXTENSIONS),.$(subst _,.,$(call sanitise,$(FULLVARIANTPATH))).pre,$1)))
       
   767 
       
   768 CPPONLY:: $(CPPONLYTARGET)
       
   769 
       
   770 $(CPPONLYTARGET): $(1) $(PROJECT_META)  $(if $(DEPENDFILE),,RESOURCE BITMAP EXPORT)
       
   771 	$(call startrule,e32cpponly,,$(1))		\
       
   772 		$(if $(PERTURBSTARTTIME), $(RANSLEEP) $(PERTURBMSECS) ;,) \
       
   773 		$(CC) $(LICENSERETRY_OPTION) $(SYMBIAN_CCFLAGS) \
       
   774 			$(CC_CPPONLY_ARGS) \
       
   775 			$(OPTION_COMPILER) 						\
       
   776 			$(call makemacrodef,-D,$(COMPILER_INTERWORK_DEFINES) $(CDEFS))				\
       
   777 			$(if $(PREINCLUDE),$(PREINCLUDE_OPTION) ,)$(call concat, $(PREINCLUDE_OPTION) ,$(call dblquote,$(PREINCLUDE)))\
       
   778 			$(if $(SET_ARMINC),$(if $(RVCTINC),$(COMPILER_SYSTEM_INCLUDE_OPTION)$(call dblquote,$(RVCTINC)),),)       \
       
   779 			$(COMPILER_SYSTEM_INCLUDE_OPTION)$$(call dblquote,$$(<D))                                                   \
       
   780 			$(if $(USERINCLUDE),$(COMPILER_SYSTEM_INCLUDE_OPTION),)$(call concat, $(COMPILER_SYSTEM_INCLUDE_OPTION),$(call dblquote,$(USERINCLUDE)))      \
       
   781 			$(if $(SYSTEMINCLUDE),$(COMPILER_SYSTEM_INCLUDE_OPTION),)$(call concat, $(COMPILER_SYSTEM_INCLUDE_OPTION),$(call dblquote,$(SYSTEMINCLUDE)))  \
       
   782 			$(if $(NOHIDEALL),--no_hide_all,) \
       
   783 			$$(call dblquote, $$<) $(OUTPUT_OPTION) $$(@) \
       
   784 	$(call endrule,e32cpponly)
       
   785 
       
   786 CLEANTARGETS:=$$(CLEANTARGETS) $(CPPONLYTARGET)
       
   787 endef
       
   788 
       
   789 ifneq ($(filter CPPONLY,$(call uppercase,$(MAKECMDGOALS))),)
       
   790 $(foreach F,$(CPPFILES) $(CFILES),$(eval $(call e32abiv2_cpponly,$(F))))
       
   791 endif
       
   792 
       
   793 define e32abiv2_listing
       
   794 # $1 is the sourcefile
       
   795 
       
   796 $(eval LISTINGTARGET:=$(strip $(call extractandmap,$(CPPFILEEXTENSIONS) $(CFILEEXTENSIONS),.$(subst _,.,$(call sanitise,$(FULLVARIANTPATH))).$(TARGET).$(if $(REQUESTEDTARGETEXT),$(REQUESTEDTARGETEXT),$(POSTLINKFILETYPE)).lst,$1)))
       
   797 $(eval DEPENDFILENAME:=$(call map2listfile,$1).d)
       
   798 $(eval DEPENDFILE:=$(wildcard $(DEPENDFILENAME)))
       
   799 
       
   800 
       
   801 LISTING:: $(LISTINGTARGET)
       
   802 
       
   803 $(LISTINGTARGET): $(1) $(PROJECT_META)  $(if $(DEPENDFILE),,RESOURCE BITMAP EXPORT)
       
   804 	$(call startrule,e32listing,,$(1))		\
       
   805 		$(if $(PERTURBSTARTTIME), $(RANSLEEP) $(PERTURBMSECS) ;,) \
       
   806 		$(CC) $(LICENSERETRY_OPTION) $(SYMBIAN_CCFLAGS) \
       
   807 			$(CC_CORE_ARGS) \
       
   808 			$(LISTING_OPTION)		            	\
       
   809 			$(OPTION_COMPILER) 						\
       
   810 			$(call makemacrodef,-D,$(COMPILER_INTERWORK_DEFINES) $(CDEFS))				\
       
   811 			$(if $(PREINCLUDE),$(PREINCLUDE_OPTION) ,)$(call concat, $(PREINCLUDE_OPTION) ,$(call dblquote,$(PREINCLUDE)))\
       
   812 			$(if $(SET_ARMINC),$(if $(RVCTINC),$(COMPILER_SYSTEM_INCLUDE_OPTION)$(call dblquoteitem,$(RVCTINC)),),)       \
       
   813 			$(COMPILER_SYSTEM_INCLUDE_OPTION)$$(call dblquote,$$(<D))                                                   \
       
   814 			$(if $(USERINCLUDE),$(COMPILER_SYSTEM_INCLUDE_OPTION),)$(call concat, $(COMPILER_SYSTEM_INCLUDE_OPTION),$(call dblquote,$(USERINCLUDE)))      \
       
   815 			$(if $(SYSTEMINCLUDE),$(COMPILER_SYSTEM_INCLUDE_OPTION),)$(call concat, $(COMPILER_SYSTEM_INCLUDE_OPTION),$(call dblquote,$(SYSTEMINCLUDE)))  \
       
   816 			$(if $(NOHIDEALL),--no_hide_all,) \
       
   817 			$(DEPEND_OPTION) $(call dblquote,$(DEPENDFILENAME)) \
       
   818 			$$(call dblquote, $$<) $(OUTPUT_OPTION) $$(@) \
       
   819 	$(call endrule,e32listing)
       
   820 
       
   821 CLEANTARGETS:=$$(CLEANTARGETS) $(LISTINGTARGET)
       
   822 
       
   823 CLEANTARGETS:=$$(CLEANTARGETS) $(DEPENDFILENAME)
       
   824 ifneq "$(DEPENDFILE)" ""
       
   825 ifeq ($(NO_DEPEND_INCLUDE),)
       
   826   ifeq "$(filter %CLEAN,$(call uppercase,$(MAKECMDGOALS)))" ""
       
   827     -include $(DEPENDFILE)
       
   828   endif
       
   829 endif
       
   830 endif
       
   831 
       
   832 endef
       
   833 
       
   834 # No point at all in generating listing targetsif we aren't going to make them
       
   835 ifneq ($(filter LISTING,$(call uppercase,$(MAKECMDGOALS))),)
       
   836 $(foreach F,$(CPPFILES) $(CFILES),$(eval $(call e32abiv2_listing,$(F))))
       
   837 endif
       
   838 
       
   839 
       
   840 
       
   841 # Function to execute FREEZE ###########################################
       
   842 ifneq ($(SUPPORT_FREEZE),)
       
   843 
       
   844 # Fivespaces variable created to ensure a suitable gap of space characters
       
   845 # Is placed between the separate arguments. This fixes a problem in Cygwin, where
       
   846 # separate arguments are interpreted as a single argument when passed to bash
       
   847 FIVESPACES=$(BLANK)     $(BLANK)
       
   848 
       
   849 FREEZEGUARD:=TARGET_$(TARGET)_$(if $(REQUESTEDTARGETEXT),$(REQUESTEDTARGETEXT),$(POSTLINKFILETYPE))_$(IMPORTLIBPATH)_EFREEZE
       
   850 
       
   851 define e32freeze
       
   852 
       
   853 FREEZE:: $(1)
       
   854 	$(call startrule,freeze,,$(RESOLVED_DEFFILE)) \
       
   855 	$(EFREEZE) $(EFREEZE_REMOVE_OPTION) "$(RESOLVED_DEFFILE)" $(FIVESPACES) $(GENERATED_DEFFILE) \
       
   856 	$(call endrule,freeze)
       
   857 endef
       
   858 
       
   859 # DEFFILE should only be generated for target types that have a def file
       
   860 ifeq ($(MAKEDEFFILE),1)
       
   861 # Eval freeze only once - no point making the DEFFILE for urel *and* udeb.
       
   862 ifeq ($($(FREEZEGUARD)),)
       
   863 $(eval $(call e32freeze,$(E32TARGET)))
       
   864 $(FREEZEGUARD):=1
       
   865 endif
       
   866 endif
       
   867 
       
   868 endif
       
   869 
       
   870 CLEANTARGETS:=$(CLEANTARGETS) $(if $(MULTIFILE_ENABLED),$(MULTIFILEOBJECT),$(CPPFILES_LINKOBJECTS) $(CFILES_LINKOBJECTS))
       
   871 
       
   872 ## ASSEMBLER FILES ###################################################################
       
   873 # CIA VERSION      ############################################
       
   874 define mapcia2xxx
       
   875 $(call relocatefiles,$(INTERMEDIATEPATH),$(call extractandmap,$(CIAFILEEXTENSIONS),$2,$1))
       
   876 endef
       
   877 
       
   878 define e32abiv2_CIA2CPP
       
   879 
       
   880 $(eval e32abiv2_OFILE:=$(call mapcia2xxx,$(1),_.o))
       
   881 $(eval e32abiv2_PREFILE:=$(call mapcia2xxx,$(1),_.pre))
       
   882 $(eval e32abiv2_CPPFILE:=$(call mapcia2xxx,$(1),_.cpp))
       
   883 $(eval CLEANTARGETS:=$(CLEANTARGETS) $(e32abiv2_OFILE) $(e32abiv2_CPPFILE) $(e32abiv2_PREFILE))
       
   884 
       
   885 $(e32abiv2_OFILE): $(e32abiv2_CPPFILE) $(PROJECT_META)
       
   886 	$(call startrule,cia2cpp2o,,$(e32abiv2_CPPFILE)) \
       
   887 		$(if $(PERTURBSTARTTIME),$(RANSLEEP) $(PERTURBMSECS) ;,) \
       
   888 			$(CC) $(LICENSERETRY_OPTION) \
       
   889 			$(CC_CORE_ARGS) \
       
   890 			$(if $(LTCG),$(LTCG_OPTION),) \
       
   891 			$(OPTION_COMPILER) \
       
   892 			$(call makemacrodef,-D,$(COMPILER_INTERWORK_DEFINES) $(CDEFS) $(CIADEFS)) $(CPP_LANG_OPTION)      \
       
   893 	 		$(if $(USERINCLUDE),$(COMPILER_SYSTEM_INCLUDE_OPTION),)$$(call concat, $(COMPILER_SYSTEM_INCLUDE_OPTION),$$(call dblquote,$(USERINCLUDE)))     \
       
   894 	 		$(if $(SYSTEMINCLUDE),$(COMPILER_SYSTEM_INCLUDE_OPTION),)$$(call concat, $(COMPILER_SYSTEM_INCLUDE_OPTION),$$(call dblquote,$(SYSTEMINCLUDE))) \
       
   895 	 		$$(call dblquote, $$<) $(OUTPUT_OPTION) $$@ \
       
   896 	$(call endrule,cia2cpp2o)
       
   897 
       
   898 
       
   899 # preprocessed CIA file to a CPP file
       
   900 $(e32abiv2_CPPFILE): $(e32abiv2_PREFILE)
       
   901 	$(call startrule,tranasm) \
       
   902 	$(if $(CPPFILT),CPPFILT="$(CPPFILT)",) \
       
   903 	$(TRANASM) --suppress-check --output="$$@" $$^ \
       
   904 	$(call endrule,tranasm)
       
   905 
       
   906 $(eval DEPENDFILENAME:=$(e32abiv2_PREFILE).d)
       
   907 $(eval DEPENDFILE:=$(wildcard $(DEPENDFILENAME)))
       
   908 
       
   909 # preprocess the cia file
       
   910 $(eval e32abiv2_PREFILE_OPTIONS:= $(LICENSERETRY_OPTION) $(PREPROCESSOR_OPTION) $(CPP_OPTION) \
       
   911        $(SYMBIAN_CCFLAGS) $(call makemacrodef,-D,$(COMPILER_INTERWORK_DEFINES) $(CDEFS) $(CIADEFS)) $(CPP_LANG_OPTION) \
       
   912        $(if $(PREINCLUDE),$(PREINCLUDE_OPTION) ,)$$(call concat, $(PREINCLUDE_OPTION) ,$$(call dblquote,$(PREINCLUDE))) \
       
   913        $(if $(USERINCLUDE),$(COMPILER_SYSTEM_INCLUDE_OPTION),)$$(call concat, $(COMPILER_SYSTEM_INCLUDE_OPTION),$$(call dblquote,$(USERINCLUDE))) \
       
   914        $(if $(SYSTEMINCLUDE),$(COMPILER_SYSTEM_INCLUDE_OPTION),)$$(call concat, $(COMPILER_SYSTEM_INCLUDE_OPTION),$$(call dblquote,$(SYSTEMINCLUDE))) \
       
   915        $(if $(ARMINC),$(if $(RVCTINC), $(COMPILER_SYSTEM_INCLUDE_OPTION)$$(call dblquoteitem,$(RVCTINC)),),) )
       
   916 
       
   917 
       
   918 $(e32abiv2_PREFILE): $1 $(PROJECT_META) $(if $(DEPENDFILE),,RESOURCE BITMAP EXPORT)
       
   919 	$(call startrule,cia2cpp,,$1) \
       
   920 	$(if $(PERTURBSTARTTIME),$(RANSLEEP) $(PERTURBMSECS) ;,) \
       
   921 	$(CC) $(e32abiv2_PREFILE_OPTIONS) $(OUTPUT_OPTION) $$@ $$(call dblquote,$1) && \
       
   922 	$(CC) -M $(e32abiv2_PREFILE_OPTIONS) --depend_format=unix \
       
   923 	  $(OUTPUT_OPTION) $$@ $$(call dblquote,$1) > $(call dblquote,$(e32abiv2_PREFILE).d) \
       
   924 	$(call endrule,cia2cpp)
       
   925 
       
   926 CLEANTARGETS:=$$(CLEANTARGETS) $(DEPENDFILENAME)
       
   927 ifneq "$(DEPENDFILE)" ""
       
   928 ifeq ($(NO_DEPEND_INCLUDE),)
       
   929   ifeq "$(filter %CLEAN,$(call uppercase,$(MAKECMDGOALS)))" ""
       
   930     -include $(DEPENDFILE)
       
   931   endif
       
   932 endif
       
   933 endif
       
   934 
       
   935 endef
       
   936 
       
   937 # Create a rule for each cia file
       
   938 ifeq ($(TRANSFORM_CIA),1)
       
   939   $(eval $(foreach e32abiv2_RULE,$(CIAFILES),$(call e32abiv2_CIA2CPP,$(e32abiv2_RULE))))
       
   940 endif
       
   941 
       
   942 # Pure assembler (.s files) ################################
       
   943 
       
   944 e32abiv2_asm_OPTIONS:=$(LICENSERETRY_OPTION) \
       
   945   $(CC_CORE_ARGS) \
       
   946   $(OPTION_COMPILER) \
       
   947   $(call makemacrodef,-D,$(COMPILER_INTERWORK_DEFINES) $(CDEFS)) \
       
   948   $(if $(USERINCLUDE),$(COMPILER_SYSTEM_INCLUDE_OPTION),)$$(call concat, $(COMPILER_SYSTEM_INCLUDE_OPTION),$$(call dblquote,$(USERINCLUDE)))     \
       
   949   $(if $(SYSTEMINCLUDE),$(COMPILER_SYSTEM_INCLUDE_OPTION),)$$(call concat, $(COMPILER_SYSTEM_INCLUDE_OPTION),$$(call dblquote,$(SYSTEMINCLUDE)))
       
   950 
       
   951 # note that the --no_rtti option cannot be passed with the -M option
       
   952 # so forcibly remove it when generating ASM dependencies.
       
   953 #
       
   954 define e32abiv2_asm
       
   955 
       
   956 $(eval DEPENDFILENAME:=$(1).d)
       
   957 $(eval DEPENDFILE:=$(wildcard $(DEPENDFILENAME)))
       
   958 
       
   959 $(1): $(2) $(PROJECT_META) $(if $(DEPENDFILE),,RESOURCE BITMAP EXPORT)
       
   960 	$(call startrule,asmcompile,,$(2)) \
       
   961 		$(if $(PERTURBSTARTTIME),$(RANSLEEP) $(PERTURBMSECS) ;,) \
       
   962 		$(CC) $(e32abiv2_asm_OPTIONS) \
       
   963 		$(DEPEND_OPTION) $(call dblquote,$(DEPENDFILENAME)) \
       
   964 	 	$$(call dblquote, $$<) $(OUTPUT_OPTION) $$@ \
       
   965 	$(call endrule,asmcompile)
       
   966 	$(call startrule,asmdependencies) \
       
   967 		$(CC) -M $(subst --no_rtti,,$(e32abiv2_asm_OPTIONS)) --depend_format=unix \
       
   968 	  	$(OUTPUT_OPTION) $$@ $$(call dblquote,$2) > $(call dblquote,$(DEPENDFILENAME)) \
       
   969 	$(call endrule,asmdependencies)
       
   970 
       
   971 CLEANTARGETS:=$$(CLEANTARGETS) $(DEPENDFILENAME)
       
   972 ifneq "$(DEPENDFILE)" ""
       
   973 ifeq ($(NO_DEPEND_INCLUDE),)
       
   974   ifeq "$(filter %CLEAN,$(call uppercase,$(MAKECMDGOALS)))" ""
       
   975     -include $(DEPENDFILE)
       
   976   endif
       
   977 endif
       
   978 endif
       
   979 
       
   980 CREATABLEPATHS:=$$(CREATABLEPATHS) $(INTERMEDIATEPATH)
       
   981 
       
   982 endef
       
   983 
       
   984 $(eval $(foreach F,$(ASMFILES), $(call e32abiv2_asm,$(call mapasm2object,$(F)),$(F))))
       
   985 CLEANTARGETS:=$(CLEANTARGETS) $(ASMFILES_LINKOBJECTS)
       
   986 
       
   987 endif # ifneq ($(TARGETTYPE),implib)
       
   988 
       
   989 
       
   990 ########################## Build ROMFILE target ############################
       
   991 EPOC_ROOT:=$(patsubst %/,%,$(EPOCROOT))
       
   992 TOBLDINF:=$(dir $(subst :,,$(subst $(EPOC_ROOT)/,,$(COMPONENT_META))))
       
   993 
       
   994 # Only build ROMFILE if asked
       
   995 ifneq ($(filter ROMFILE,$(call uppercase,$(MAKECMDGOALS))),)
       
   996     ifeq ($(ROMFILE_$(call sanitise,$(TARGET).$(REQUESTEDTARGETEXT))),)
       
   997         ROMFILE_$(call sanitise,$(TARGET).$(REQUESTEDTARGETEXT)):=1
       
   998         ROMDIR:=$(EPOC_ROOT)/epoc32/rom/$(TOBLDINF)
       
   999 
       
  1000         # Default values
       
  1001         ROMFILETYPE:=file
       
  1002         ROMFILE:=$(TARGET).$(REQUESTEDTARGETEXT)
       
  1003         ROMPATH:=sys/bin/
       
  1004         ROMDECORATIONS:=
       
  1005         ROMFILETYPE_RAM:=data
       
  1006         ROMFILE_RAM:=$(TARGET).$(REQUESTEDTARGETEXT)
       
  1007         ROMPATH_RAM:=sys/bin/
       
  1008         BUILDROMTARGET:=1
       
  1009         ABIDIR:=MAIN
       
  1010 
       
  1011         $(eval $(call DoRomSet))
       
  1012 
       
  1013         ifneq ($(EPOCFIXEDPROCESS),)
       
  1014             ROMDECORATIONS:=$(ROMDECORATIONS) fixed
       
  1015         endif
       
  1016         ifeq ($(PAGED),1)
       
  1017             ROMDECORATIONS:=$(ROMDECORATIONS) paged
       
  1018         endif
       
  1019         ifeq ($(PAGED),0)
       
  1020             ROMDECORATIONS:=$(ROMDECORATIONS) unpaged
       
  1021         endif
       
  1022 
       
  1023 
       
  1024         ifeq ($(TESTCODE),TRUE)
       
  1025         	# Add 'TEST' to the .iby filename
       
  1026         	ROMTEST:=test
       
  1027             ifeq ($(TEST_OPTION),BOTH)
       
  1028                 DATATEXT:="data=/epoc32/data/z/test/$(MODULE)/$(VARIANTPLATFORM).auto.bat test/$(MODULE).auto.bat"\n"data=/epoc32/data/z/test/$(MODULE)/$(VARIANTPLATFORM).manual.bat test/$(MODULE).manual.bat"
       
  1029             else
       
  1030                 ifneq ($(TEST_OPTION),NONE)
       
  1031                     DATATEXT:="data=/epoc32/data/z/test/$(MODULE)/$(VARIANTPLATFORM).$(TEST_OPTION).bat test/$(MODULE).$(TEST_OPTION).bat"
       
  1032                 endif
       
  1033             endif
       
  1034         else
       
  1035         	DATATEXT:=
       
  1036         endif
       
  1037 
       
  1038         # ROMTARGET
       
  1039         ifneq ($(ROMTARGET),)
       
  1040             ifneq ($(words $(ROMTARGET)),1)
       
  1041                 ROMTARGETALL:=$(ROMTARGET)
       
  1042                 ROMTARGET:=$(word 1,$(ROMTARGET))
       
  1043             endif
       
  1044 
       
  1045             ifeq ($(ROMTARGET),<none>)
       
  1046                 BUILDROMTARGET:=
       
  1047             else
       
  1048                 ifneq ($(ROMTARGET),+)
       
  1049                     ifneq ($(notdir $(ROMTARGET)),)
       
  1050                         ROMFILE:=$(notdir $(ROMTARGET))
       
  1051                     endif
       
  1052                     ifneq ($(dir $(ROMTARGET)),./)
       
  1053                         ROMPATH:=$(dir $(ROMTARGET))
       
  1054                     endif
       
  1055                 endif
       
  1056             endif
       
  1057         endif
       
  1058     endif
       
  1059 
       
  1060     ROMFILENAME:=$(ROMDIR)$(PLATFORM)$(ROMTEST).iby
       
  1061 
       
  1062     # RAMTARGET
       
  1063     ifneq ($(RAMTARGET),)
       
  1064         ROMDECORATIONS_RAM:=" attrib=r"
       
  1065         ifneq ($(RAMTARGET),+)
       
  1066             ifneq ($(notdir $(RAMTARGET)),)
       
  1067                 ROMFILE_RAM:=$(notdir $(RAMTARGET))
       
  1068             endif
       
  1069             ifneq ($(dir $(RAMTARGET)),./)
       
  1070                 ROMPATH_RAM:=$(dir $(RAMTARGET))
       
  1071             endif
       
  1072         endif
       
  1073     endif
       
  1074 
       
  1075     define BuildRomfileTarget
       
  1076         $(ALLTARGET)::ROMFILE
       
  1077         ROMFILE::
       
  1078 	        $(call startrule,rombuild)	\
       
  1079 	        $(GNUMKDIR) -p $(ROMDIR) \
       
  1080             $(if $(ROMFILE_CREATED_$(TOBLDINF)),,&& echo -e "// $(subst $(EPOC_ROOT)/,,$(ROMFILENAME))\n//\n$(DATATEXT)" > $(ROMFILENAME)) \
       
  1081             $(if $(BUILDROMTARGET),&& echo "$(ROMFILETYPE)=/epoc32/release/##$(ABIDIR)##/##BUILD##/$(TARGET).$(REQUESTEDTARGETEXT)   $(1)$(ROMDECORATIONS)" >> $(ROMFILENAME))	\
       
  1082 	        $(if $(RAMTARGET),&& echo "$(ROMFILETYPE_RAM)=/epoc32/release/##$(ABIDIR)##/##BUILD##/$(TARGET).$(REQUESTEDTARGETEXT)   $(ROMPATH_RAM)$(ROMFILE_RAM)$(ROMDECORATIONS_RAM)" >> $(ROMFILENAME))	\
       
  1083 	        $(call endrule,buildromfiletarget)
       
  1084     endef
       
  1085 
       
  1086     # When VARIANTTYPE changes, romfile is finished,
       
  1087     # apart from if this is a new component......
       
  1088     ifneq ($(PREVIOUSVARIANTTYPE),)
       
  1089         ifneq ($(VARIANTTYPE),$(PREVIOUSVARIANTTYPE))
       
  1090             ifneq ($(ROMFILE_CREATED_$(TOBLDINF)),)
       
  1091                 ROMFILEFINISHED:=1
       
  1092             else
       
  1093                 ROMFILEFINISHED:=
       
  1094             endif
       
  1095         endif
       
  1096     endif
       
  1097 
       
  1098     # When romfile is finished, don't continue to add to it
       
  1099     ifeq ($(ROMFILEFINISHED),)
       
  1100         $(eval $(call BuildRomfileTarget,$(ROMPATH)$(ROMFILE)))
       
  1101     endif
       
  1102 
       
  1103     # Don't allow romfile to be recreated for every MMP
       
  1104     ifeq ($(ROMFILE_CREATED_$(TOBLDINF)),)
       
  1105         ROMFILE_CREATED_$(TOBLDINF):=1
       
  1106     endif
       
  1107 
       
  1108     # Build other ROMTARGETs if there is more than one
       
  1109     ifneq ($(ROMTARGETALL),)
       
  1110         RAMTARGET:=
       
  1111         $(foreach ROMTARGET,$(wordlist 2,$(words $(ROMTARGETALL)),$(ROMTARGETALL)),$(eval $(call BuildRomfileTarget,$(ROMTARGET))))
       
  1112         ROMTARGETALL:=
       
  1113     endif
       
  1114 
       
  1115     # Keep track of variant type while romfile is being created
       
  1116     PREVIOUSVARIANTTYPE:=$(VARIANTTYPE)
       
  1117 
       
  1118     WHATRELEASE:=$(WHATRELEASE) $(ROMFILENAME)
       
  1119     CLEANTARGETS:=$(CLEANTARGETS) $(ROMFILENAME)
       
  1120 endif
       
  1121 
       
  1122 # Deal with test code batch files generation.
       
  1123 ifneq ($(TESTPATH),)
       
  1124 
       
  1125     CREATABLEPATHS:=$(CREATABLEPATHS) $(EPOCROOT)/epoc32/data/z/test/
       
  1126     $(eval $(call MakeTestBatchFiles,$(TARGET),$(EPOCROOT)/epoc32/data/z/test/$(MODULE)/$(VARIANTPLATFORM).$(TESTPATH)))
       
  1127     BATCHFILE_CREATED_$(EPOCROOT)/epoc32/data/z/test/$(MODULE)/$(VARIANTPLATFORM).$(TESTPATH):=1
       
  1128     TARGET_CREATED_$(EPOCROOT)/epoc32/data/z/test/$(MODULE)/$(VARIANTPLATFORM).$(TESTPATH)_$(TARGET):=1
       
  1129     WHATRELEASE:=$(WHATRELEASE) $(EPOCROOT)/epoc32/data/z/test/$(MODULE)/$(VARIANTPLATFORM).$(TESTPATH)
       
  1130     CLEANTARGETS:=$(CLEANTARGETS) $(EPOCROOT)/epoc32/data/z/test/$(MODULE)/$(VARIANTPLATFORM).$(TESTPATH)
       
  1131 endif
       
  1132 
       
  1133 ###################### End of Build ROMFILE target ######################
       
  1134 
       
  1135 # Feature Variation requires a .vmap file to be created for each binary
       
  1136 #
       
  1137 ifneq ($(FEATUREVARIANTNAME),)
       
  1138 ifneq ($(E32TARGET),)
       
  1139 
       
  1140 OUTPUTVMAP:=$(E32TARGET).vmap
       
  1141 WHATRELEASE:=$(WHATRELEASE) $(OUPUTVMAP)
       
  1142 
       
  1143 TARGET:: $(OUTPUTVMAP)
       
  1144 VMAPNEEDS:=$(E32TARGET) $(SOURCE) $(PROJECT_META)
       
  1145 
       
  1146 BV_SOURCELIST:=$(addprefix -s ,$(SOURCE) $(PROJECT_META))
       
  1147 BV_FEATURELIST:=$(addprefix -f ,$(FEATURELISTFILES))
       
  1148 BV_USER_INCLUDES:=$(addprefix -u ,$(USERINCLUDE))
       
  1149 BV_SYSTEM_INCLUDES:=$(addprefix -x ,$(SYSTEMINCLUDE))
       
  1150 
       
  1151 # translate double quoted macros because $(shell) messes them up in some make engines
       
  1152 BV_MACROLIST:=$(COMPILER_INTERWORK_DEFINES) $(CDEFS) $(if $(ALWAYS_BUILD_AS_ARM),,$(COMPILER_THUMB_DEFINES))
       
  1153 BV_DEFINES:=$(call makemacrodef,-D,$(subst ",__SBS__QUOTE__,$(BV_MACROLIST)))
       
  1154 
       
  1155 # the script to generate our .vmap file and hash value
       
  1156 VMAPCOMMAND:=$(CREATEVMAP) -o $(OUTPUTVMAP) $(BV_FEATURELIST) $(BV_DEFINES) -p $(PREINCLUDE) $(BV_SOURCELIST) $(BV_USER_INCLUDES) $(BV_SYSTEM_INCLUDES) -c $(CREATEVMAPCPP)
       
  1157 
       
  1158 # a recipe to create the .vmap from the "sources" with the createvmap script
       
  1159 $(call raptor_recipe,createvmap,$(OUTPUTVMAP),$(VMAPNEEDS),$(VMAPCOMMAND))
       
  1160 
       
  1161 endif # E32TARGET != ""
       
  1162 endif # FEATUREVARIANTNAME != ""
       
  1163 
       
  1164 ########################### CONCLUSION ###################################
       
  1165 
       
  1166 # make the output directories while reading makefile - some build engines prefer this
       
  1167 $(call makepath,$(CREATABLEPATHS))
       
  1168 
       
  1169 ## Clean up
       
  1170 $(eval $(call GenerateStandardCleanTarget,$(CLEANTARGETS) ,$(CREATABLEPATHS),))
       
  1171 
       
  1172 # For the abld -what target
       
  1173 $(eval $(call whatmacro,$(filter-out %.sym,$(WHATRELEASE)),WHATARMV5))
       
  1174 
       
  1175 endif # FEATUREVARIANTNAME=="" or FEATUREVARIANT==1
       
  1176 
       
  1177 ## The End
       
  1178