e32abiv2.flm 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224
  1. # Copyright (c) 2006-2011 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. # E32 EXE/DLL ABIv2 Function Like Makefile (FLM)
  15. # Knows how to build all possible ABIV2 executables for ARM
  16. #
  17. #
  18. # Feature/Binary Variation
  19. #
  20. # FEATUREVARIANTNAME != "" implies a product build configuration
  21. # FEATUREVARIANT == 1 implies a .mmp defined feature variant binary
  22. #
  23. # By default:
  24. # Build all binaries in non-product builds *and*
  25. # Only build feature variant binaries in product builds.
  26. #
  27. # test FEATUREVARIANTNAME=="" or FEATUREVARIANT==1
  28. #
  29. # If FEATUREVARIANTSAFE is set:
  30. # Only build feature invariant binaries in non-product builds *and*
  31. # Only build feature variant binaries in product builds.
  32. #
  33. # test (FEATUREVARIANTNAME=="" and FEATUREVARIANT=="") or
  34. # (FEATUREVARIANTNAME!="" and FEATUREVARIANT==1)
  35. #
  36. DOBUILD:=
  37. ifeq ($(FEATUREVARIANTSAFE),)
  38. DOBUILD:=$(if $(or $(call equal,$(FEATUREVARIANTNAME),),\
  39. $(call equal,$(FEATUREVARIANT),1)),1)
  40. else
  41. DOBUILD:=$(if $(or $(and $(call equal,$(FEATUREVARIANTNAME),),\
  42. $(call equal,$(FEATUREVARIANT),)),\
  43. $(and $(call not,$(call equal,$(FEATUREVARIANTNAME),)),\
  44. $(call equal,$(FEATUREVARIANT),1))),1)
  45. endif
  46. ifeq ($(DOBUILD),1)
  47. $(if $(FLMDEBUG),$(info <debug><flm name='e32abiv2' target='$(TARGET)' type='$(TARGETTYPE)' outputpath='$(OUTPUTPATH)' metasource='$(METASOURCE)' postlinkfiletype='$(POSTLINKFILETYPE)' /></debug>))
  48. # Enable DELETE_ON_FAILED_COMPILE work around for failed RVCT 2.2 compiles
  49. ifneq ($(DELETE_ON_FAILED_COMPILE),)
  50. RVCT22_DELETE_WORKAROUND:=|| { $$(GNURM) $$@; exit 1; }
  51. endif # ifneq ($(DELETE_ON_FAILED_COMPILE),)
  52. # Strip switch-type parameters
  53. #
  54. POSTLINKTARGETTYPE:=$(strip $(POSTLINKTARGETTYPE))
  55. TARGETEXT:=$(if $(REQUESTEDTARGETEXT),$(REQUESTEDTARGETEXT),$(POSTLINKFILETYPE))
  56. UID1:=$(strip $(UID1))
  57. UID2:=$(strip $(UID2))
  58. UID3:=$(strip $(UID3))
  59. SID:=$(strip $(SECUREID))
  60. VENDORID:=$(strip $(VENDORID))
  61. AUTOEXPORTS:=$(strip $(AUTOEXPORTS))
  62. DEFFILE:=$(strip $(DEFFILE))
  63. IMPORTLIBRARYREQUIRED:=$(strip $(IMPORTLIBRARYREQUIRED))
  64. EPOCALLOWDLLDATA:=$(strip $(EPOCALLOWDLLDATA))
  65. PAGED:=$(strip $(PAGED))
  66. # the output directories
  67. VARIANTPLATFORM:=$(VARIANTPLATFORM)$(FEATUREVARIANTNAME)
  68. RELEASABLEPATH:=$(RELEASEPATH)/$(VARIANTPLATFORM)/$(VARIANTTYPE)
  69. INTERMEDIATEPATH:=$(OUTPUTPATH)/$(VARIANTPLATFORM)/$(VARIANTTYPE)
  70. INTERMEDIATE_PLATFORM_PATH:=$(OUTPUTPATH)/$(VARIANTPLATFORM)
  71. TRACE_MARKER_PATH:=$(OUTPUTPATH)
  72. IMPORTLIBPATH:=$(RUNTIME_LIBS_PATH)
  73. # LOCALLY USED VARIABLES
  74. ADDITIONAL_LIBS:=
  75. CLEANTARGETS:=
  76. WHATRELEASE:=
  77. LIBRARIES:=$(patsubst %.dso,%.$(IMPLIB_EXTENSION),$(LIBRARY))
  78. LIBRARIES_DEBUG:=$(patsubst %.dso,%.$(IMPLIB_EXTENSION),$(LIBRARY_DEBUG))
  79. # Work out which new/delete library to use for binaries.
  80. CHECKLIB_TYPE:=symc++
  81. STDCPPTAGFILE:=
  82. ifeq ($(NOSTDCPP),1)
  83. ifeq ($(STDCPP),1)
  84. $(info <warning>STDCPP and NOSTDCPP both specified in $(PROJECT_META)</warning>)
  85. else
  86. ifeq ($(HAS_DEDICATED_OP_NEWDEL_LIB),1)
  87. DEFAULT_NEWLIB:=$(DEFAULT_SYMBIAN_NEWLIB)
  88. endif
  89. endif
  90. else
  91. ifeq ($(STDCPP),1)
  92. CDEFS:=$(CDEFS) __SYMBIAN_STDCPP_SUPPORT__
  93. ifneq ($(SUPPORTS_STDCPP_NEWLIB),)
  94. ifeq ($(HAS_DEDICATED_OP_NEWDEL_LIB),1)
  95. DEFAULT_NEWLIB:=$(DEFAULT_STDCPP_NEWLIB)
  96. endif
  97. CHECKLIB_TYPE:=stdc++
  98. STDCPPTAGFILE:=$(EPOCROOT)/epoc32/tools/tag/tag_elf
  99. endif
  100. endif
  101. endif
  102. # If NEWLIB is specified in the MMP file, it overrides all the past stuff.
  103. ifeq ($(NEWLIB),)
  104. NEWLIB:=$(DEFAULT_NEWLIB)
  105. endif
  106. # Linker feedback requests have implications for both compile and link, but are
  107. # only available for specific toolchains
  108. # We respond accordingly based on flags set by variants and interfaces
  109. ifneq ($(LINKERFEEDBACK),)
  110. ifneq ($(SUPPORTS_LINKER_FEEDBACK),)
  111. DOLINKERFEEDBACK:=1
  112. FEEDBACKFILENAME:=$(INTERMEDIATEPATH)/$(TARGET)_$(VARIANTTYPE)_feedback.fdb
  113. endif
  114. else
  115. DOLINKERFEEDBACK:=
  116. endif
  117. ##########################################################################
  118. ## OUTPUTS - externally relevant targets that this FLM generates
  119. ifeq ($(EXPORTLIBRARY),)
  120. EXPORTLIBRARY:=$(TARGET)
  121. endif
  122. # This will insert the file version between the name and the extension.
  123. # If there is more than one dot in generated filename the inserted position will be
  124. # BEFORE the last but two dot. E.g name1.name2.name3.dll to name1.name2{version}.name3.dll
  125. LIBEXT:=$(lastword $(subst .,$(CHAR_SPACE) ,$(EXPORTLIBRARY)))
  126. LIBBASE:=$(patsubst %.$(LIBEXT),%,$(EXPORTLIBRARY))
  127. ifneq ($(findstring .,$(EXPORTLIBRARY)),)
  128. # Please note $(EXPORTLIBRARY) doesn't include target type.
  129. VER_E32IMPORTLIBBASE:=$(IMPORTLIBPATH)/$(LIBBASE){$(VERSIONHEX)}.$(LIBEXT)
  130. else
  131. VER_E32IMPORTLIBBASE:=$(IMPORTLIBPATH)/$(EXPORTLIBRARY){$(VERSIONHEX)}
  132. endif
  133. # Postlinkable targets need to be linked and elf2e32'd
  134. ifneq ($(DOPOSTLINK),)
  135. E32TARGET:=$(RELEASABLEPATH)/$(TARGET)$(if $(EXPLICITVERSION),{$(VERSIONHEX)},).$(TARGETEXT)
  136. LINK_TARGET:=$(RELEASABLEPATH)/$(TARGET)$(if $(EXPLICITVERSION),{$(VERSIONHEX)},).$(TARGETEXT).sym
  137. MAPFILE:=$(RELEASABLEPATH)/$(TARGET).$(TARGETEXT).map
  138. else
  139. E32TARGET:=
  140. LINK_TARGET:=
  141. MAPFILE:=
  142. endif
  143. # libs and klibs, on the other hand need to be archived
  144. ifneq ($(call isoneof,$(TARGETTYPE),lib klib stdlib),)
  145. ARTARGET:=$(RELEASABLEPATH)/$(TARGET).lib
  146. # We need libs and klibs before we can link stuff with them:
  147. LIBRARY:: $(ARTARGET)
  148. else
  149. ARTARGET:=
  150. endif
  151. ifneq ($(IMPORTLIBRARYREQUIRED),) # no dso files for plugins, animation dlls etc
  152. # make sure we don't build import libraries more than once for UDEB and UREL
  153. # Without this, wierd target-specific variable problems happen with LIBRARY in particular
  154. TMP_IMPORTLIBTARGET_ROOT:=$(IMPORTLIBPATH)/$(EXPORTLIBRARY)
  155. # ABIv2 .dso
  156. IMPORTLIBTARGET_DSO:=
  157. IMPORTLIBTARGETVERSIONED_DSO:=
  158. BUILDMARKER_IMPORTLIBTARGET_DSO:=TARGET_$(subst :,,$(VER_E32IMPORTLIBBASE)).$(IMPLIB_EXTENSION)
  159. WHATRELEASE:=$(WHATRELEASE) $(if $(EXPLICITVERSION),,$(TMP_IMPORTLIBTARGET_ROOT).$(IMPLIB_EXTENSION))
  160. WHATRELEASE:=$(WHATRELEASE) $(VER_E32IMPORTLIBBASE).$(IMPLIB_EXTENSION)
  161. ifeq ($($(BUILDMARKER_IMPORTLIBTARGET_DSO)),)
  162. IMPORTLIBTARGET_DSO:=$(TMP_IMPORTLIBTARGET_ROOT).$(IMPLIB_EXTENSION)
  163. IMPORTLIBTARGETVERSIONED_DSO:=$(VER_E32IMPORTLIBBASE).$(IMPLIB_EXTENSION)
  164. endif
  165. # ABIv1 .lib (for specific kits and toolchains only)
  166. IMPORTLIBTARGET_LIB:=
  167. IMPORTLIBTARGETVERSIONED_LIB:=
  168. BUILDMARKER_IMPORTLIBTARGET_LIB:=TARGET_$(subst :,,$(VER_E32IMPORTLIBBASE)).lib
  169. # Only for kits that require and tools that support them
  170. ifneq ($(SUPPORTS_ABIV1_IMPLIBS),)
  171. WHATRELEASE:=$(WHATRELEASE) $(if $(EXPLICITVERSION),,$(TMP_IMPORTLIBTARGET_ROOT).lib)
  172. WHATRELEASE:=$(WHATRELEASE) $(VER_E32IMPORTLIBBASE).lib
  173. ifeq ($($(BUILDMARKER_IMPORTLIBTARGET_LIB)),)
  174. IMPORTLIBTARGET_LIB:=$(TMP_IMPORTLIBTARGET_ROOT).lib
  175. IMPORTLIBTARGETVERSIONED_LIB:=$(VER_E32IMPORTLIBBASE).lib
  176. endif
  177. endif
  178. endif
  179. # Try to make sure that we get the right linkas name
  180. # If linkas is specified then split it up and
  181. # put the hex version number in the right place
  182. ifeq ($(LINKAS),)
  183. LINKASNAME=$(TARGET)
  184. LINKASTYPE=$(TARGETEXT)
  185. else
  186. SPLIT_LINKAS=$(subst ., ,$(LINKAS))
  187. LINKASNAME=$(word 1,$(SPLIT_LINKAS))
  188. LINKASTYPE=$(word 2,$(SPLIT_LINKAS))
  189. endif
  190. # ignore UID3 if it is zero
  191. ifeq ($(UID3),00000000)
  192. LINKASVERSIONED=$(LINKASNAME){$(VERSIONHEX)}.$(LINKASTYPE)
  193. else
  194. LINKASVERSIONED=$(LINKASNAME){$(VERSIONHEX)}$(if $(UID3),[$(UID3)],).$(LINKASTYPE)
  195. endif
  196. ##########################################################################
  197. ## TARGET GROUPS ##
  198. RELEASABLES:=$(strip $(E32TARGET) $(ARTARGET) $(LINK_TARGET) $(MAPFILE))
  199. # More targets to be added later
  200. TARGETS:=$(strip $(E32TARGET) $(IMPORTLIBTARGET) $(LINK_TARGET) $(ARTARGET))
  201. CREATABLEPATHS:=$(OUTPUTPATH)
  202. CREATABLEPATHS:=$(CREATABLEPATHS) $(INTERMEDIATE_PLATFORM_PATH)
  203. CREATABLEPATHS:=$(CREATABLEPATHS) $(INTERMEDIATEPATH)
  204. CREATABLEPATHS:=$(CREATABLEPATHS) $(RELEASABLEPATH)
  205. CREATABLEPATHS:=$(CREATABLEPATHS) $(RUNTIME_LIBS_PATH)
  206. CREATABLEPATHS:=$(CREATABLEPATHS) $(IMPORTLIBPATH)
  207. WHATRELEASE:=$(WHATRELEASE) $(RELEASABLES)
  208. ## HIGH LEVEL Targets ##
  209. .PHONY:: $(ALLTARGET)
  210. ## GLOBAL TARGETS ############################################################
  211. $(ALLTARGET):: $(RELEASABLES)
  212. TARGET:: $(RELEASABLES)
  213. ## Internal targets ##
  214. # Determine the name of the generated DSO file ###############################
  215. # This is to generate the dso with the Some{Versionhex}.file.dso
  216. # It reproduces what appears to be a problem in the current build system
  217. # that affects messageintercept{000a0000}.esockdebug.dso whose
  218. # filename differs from it's "linkas" name.
  219. E32VAR:=$(subst .,$(CHAR_SPACE) ,$(TARGET))
  220. E32SOME:=$(word 1,$(E32VAR))
  221. E32VAR2:=$(patsubst $(E32SOME).%,%,$(TARGET))
  222. # Separate '_SH' variables created for output into bash - Preserves '{' and '}'
  223. ifneq ($(findstring .,$(TARGET)),)
  224. DSODEFFILENAMEBASE:=$(E32SOME){$(VERSIONHEX)}.$(E32VAR2)
  225. else
  226. DSODEFFILENAMEBASE:=$(TARGET){$(VERSIONHEX)}
  227. endif
  228. GENERATED_DSO:=$(call dblquote,$(INTERMEDIATEPATH)/$(DSODEFFILENAMEBASE).$(IMPLIB_EXTENSION))
  229. GENERATED_DEFFILE:=$(INTERMEDIATEPATH)/$(DSODEFFILENAMEBASE).def
  230. ## IMPORT LIBRARY ###########################################################
  231. # Static libraries will be postlinked when they are used so don't try to postlink them
  232. ifeq ($(e32importlib_mk),)
  233. e32importlib_mk:=1
  234. include $(FLMHOME)/e32importlib.mk
  235. endif
  236. # A processed .def file is required for:
  237. # 1: ABIv2 .dso and ABIv1 .lib import library generation
  238. # 2: linking where the build fixes exports using a .exp file
  239. # That is, in both cases, unless EXPORTUNFROZEN is being used
  240. ifneq ($(or $(IMPORTLIBRARYREQUIRED),$(FIX_EXPORTS_USING_EXP_FILE)),)
  241. ifneq ($(or $(DEFFILE),$(EXPORTUNFROZEN)),)
  242. PREPPEDDEFFILE:=
  243. ifneq ($(DEFFILE),)
  244. ifeq ($(EXPORTUNFROZEN),)
  245. PREPPEDDEFFILE:=$(INTERMEDIATEPATH)/$(TARGET).prep
  246. CLEANTARGETS:=$(CLEANTARGETS) $(PREPPEDDEFFILE)
  247. $(eval $(importlibtarget_prepfile_$(BASE_ARCH)))
  248. endif
  249. endif
  250. endif
  251. endif
  252. ifneq ($(IMPORTLIBRARYREQUIRED),)
  253. ifneq ($(or $(DEFFILE),$(EXPORTUNFROZEN)),)
  254. # ABIv2 .dso
  255. ifneq ($(IMPORTLIBTARGET_DSO),) # check that we haven't tried to specify this target already
  256. # By Now we're committed to producing a target for this DSO so it's safe to
  257. # set the marker that will prevent any further targets from being made.
  258. $(eval $(BUILDMARKER_IMPORTLIBTARGET_DSO):=1)
  259. ifneq ($(EXPLICITVERSION),)
  260. TARGETS:=$(strip $(TARGETS) $(IMPORTLIBTARGETVERSIONED_DSO))
  261. # Add this importlibrary to our global targets
  262. LIBRARY:: $(IMPORTLIBTARGETVERSIONED_DSO)
  263. $(ALLTARGET):: $(IMPORTLIBTARGETVERSIONED_DSO)
  264. TARGET:: $(IMPORTLIBTARGETVERSIONED_DSO)
  265. else
  266. TARGETS:=$(strip $(TARGETS) $(IMPORTLIBTARGETVERSIONED_DSO) $(IMPORTLIBTARGET_DSO))
  267. # Add this importlibrary to our global targets
  268. LIBRARY:: $(IMPORTLIBTARGET_DSO)
  269. $(ALLTARGET):: $(IMPORTLIBTARGETVERSIONED_DSO) $(IMPORTLIBTARGET_DSO)
  270. TARGET:: $(IMPORTLIBTARGETVERSIONED_DSO) $(IMPORTLIBTARGET_DSO)
  271. endif
  272. ifneq ($(EXPORTUNFROZEN),) # Unfrozen - warn and create .dso as side-effect of the final postlink
  273. $(info <warning project='$(PROJECT_META)' component='$(COMPONENT_META)'>EXPORTUNFROZEN present in $(PROJECT_META) - unfrozen exports will be represented in import library.</warning> )
  274. define importlibtarget_unfrozen
  275. $(IMPORTLIBTARGET_DSO): $(IMPORTLIBTARGETVERSIONED_DSO)
  276. $(call startrule,importlibtarget_unfrozen,FORCESUCCESS) \
  277. $(GNUCP) $$(call dblquote,$$<) $$(call dblquote,$$@) \
  278. $(call endrule,importlibtarget_unfrozen)
  279. endef
  280. define importlibtarget_unfrozen_ver
  281. $(IMPORTLIBTARGETVERSIONED_DSO): $(E32TARGET)
  282. $(call startrule,importlibversioned_unfrozen,FORCESUCCESS) \
  283. $(GNUCP) "$(GENERATED_DSO)" "$$@" \
  284. $(call endrule,importlibversioned_unfrozen)
  285. endef
  286. ifeq ($(EXPLICITVERSION),)
  287. # Generate the general dso if we aren't
  288. # being asked to make just the specific version.
  289. $(eval $(importlibtarget_unfrozen))
  290. endif
  291. $(eval $(importlibtarget_unfrozen_ver))
  292. else
  293. ifneq ($(DEFFILE),)
  294. # Frozen with a .def file - use the .def file and create .dso directly
  295. define importlibtarget_func
  296. $(IMPORTLIBTARGET_DSO): $(IMPORTLIBTARGETVERSIONED_DSO)
  297. $(call startrule,importlibtarget,FORCESUCCESS) \
  298. $(GNUCP) "$$<" "$$@" \
  299. $(call endrule,importlibtarget)
  300. endef
  301. ifeq ($(EXPLICITVERSION),)
  302. # Generate the general dso if we aren't
  303. # being asked to make just the specific version.
  304. $(eval $(importlibtarget_func))
  305. endif
  306. $(eval $(importlibtargetversioned_$(BASE_ARCH)))
  307. endif # ifneq ($(DEFFILE),)
  308. endif # ifneq ($(EXPORTUNFROZEN),)
  309. endif # ifneq ($(IMPORTLIBTARGET_DSO),)
  310. # ABIv1 .lib
  311. ifneq ($(IMPORTLIBTARGETVERSIONED_LIB),) # check that we haven't tried to specify this target already
  312. # By Now we're committed to producing a target for this DSO so it's safe to
  313. # set the marker that will prevent any further targets from being made.
  314. $(eval $(BUILDMARKER_IMPORTLIBTARGET_LIB):=1)
  315. define abiv1_generatelib
  316. ifeq ($(EXPLICITVERSION),)
  317. LIBRARY:: $(IMPORTLIBTARGETVERSIONED_LIB) $(IMPORTLIBTARGET_LIB)
  318. else
  319. LIBRARY:: $(IMPORTLIBTARGETVERSIONED_LIB)
  320. endif
  321. # If frozen, a prepped .def file is used as the basis for .lib creation
  322. # If unfrozen, .lib files are based on the .def file generated by the final postlink
  323. $(IMPORTLIBTARGETVERSIONED_LIB): $(if $(EXPORTUNFROZEN),$(E32TARGET),$(PREPPEDDEFFILE))
  324. $(call startrule,importlibversioned_abiv1) \
  325. if [ -f "$(if $(EXPORTUNFROZEN),$(call dblquote,$(GENERATED_DEFFILE)),$(PREPPEDDEFFILE))" ]; then \
  326. $(DEF2DLLTOOL) \
  327. --path=$(IMPORTLIBPATH) \
  328. --bldpath=$(INTERMEDIATEPATH) \
  329. --import=$(notdir $(basename $(IMPORTLIBTARGETVERSIONED_LIB))) \
  330. --deffile="$(if $(EXPORTUNFROZEN),$(call dblquote,$(GENERATED_DEFFILE)),$(PREPPEDDEFFILE))" \
  331. --linkAs=$(call dblquote,$(LINKASVERSIONED)) \
  332. --inter ; fi \
  333. $(call endrule,importlibversioned_abiv1)
  334. ifeq ($(EXPLICITVERSION),)
  335. $(IMPORTLIBTARGET_LIB): $(IMPORTLIBTARGETVERSIONED_LIB)
  336. $(call startrule,importlibtarget_abiv1) \
  337. $(GNUCP) "$$<" "$$@" \
  338. $(call endrule,importlibtarget_abiv1)
  339. endif
  340. endef
  341. $(eval $(abiv1_generatelib))
  342. endif # ifneq ($(IMPORTLIBTARGET_LIB),)
  343. else
  344. # If we would normally generate an import library but can't
  345. # as no .def file exists, then we inform that this is the case
  346. ifeq ($(filter %CLEAN FREEZE,$(call uppercase,$(MAKECMDGOALS))),)
  347. $(info <info project='$(PROJECT_META)' component='$(COMPONENT_META)'>Import library generation suppressed as frozen .def file not present: $(RESOLVED_DEFFILE).</info> )
  348. endif
  349. endif # ($(or $(DEFFILE),$(EXPORTUNFROZEN)),)
  350. endif # ifneq ($(IMPORTLIBRARYREQUIRED),)
  351. ## POSTLINK ##################################################################
  352. # Set up the name of the exports file if this is a customdll
  353. EXPTARGET:=
  354. ifneq ($(DOPOSTLINK),)
  355. ifneq ($(and $(or $(STATICLIBRARY),$(ARMLIBS),$(ARMRT)),$(DEFFILE)),)
  356. EXPTARGET:=$(INTERMEDIATE_PLATFORM_PATH)/$(notdir $(VER_E32IMPORTLIBBASE)).exp
  357. endif
  358. endif
  359. # Generating the import library is enough if TARGETTYPE=implib #############
  360. ifneq ($(DOPOSTLINK),)
  361. # Capabilities
  362. FINAL_CAPABILITIES:=$(if $(CAPABILITY),$(CAPABILITY),NONE)
  363. # Paging options for the old postlinker
  364. POSTLINKER_PAGEDOPTION:=--defaultpaged
  365. ifeq ($(PAGED),1)
  366. POSTLINKER_PAGEDOPTION:=--paged
  367. endif
  368. ifeq ($(PAGED),0)
  369. POSTLINKER_PAGEDOPTION:=--unpaged
  370. endif
  371. CLEANTARGETS:=$(CLEANTARGETS) $(E32TARGET)
  372. CLEANTARGETS:=$(CLEANTARGETS) $(GENERATED_DEFFILE)
  373. CLEANTARGETS:=$(CLEANTARGETS) $(GENERATED_DSO)
  374. endif # ifneq ($(DOPOSTLINK),)
  375. ifneq ($(TARGETTYPE),implib)
  376. ## CUSTOM DLLS ###############################################################
  377. # exp file
  378. #
  379. # This tends to help getting exported objects
  380. # out of the arm libs and into custom dlls.
  381. ifneq ($(EXPTARGET),)
  382. ifeq ($(TARGET_$(EXPTARGET)),)
  383. # We only need one of these exptargets for UDEB and UREL
  384. TARGET_$(EXPTARGET):=1
  385. EXPTARGETASMFILE:=$(INTERMEDIATE_PLATFORM_PATH)/$(notdir $(VER_E32IMPORTLIBBASE)).s
  386. define e32expgen_func
  387. $(EXPTARGET): $(DEFFILE) $(POSTLINKER)
  388. $(call startrule,expgen) \
  389. $(POSTLINKER) \
  390. --definput=$$(call dblquote,$(DEFFILE)) \
  391. --dump=a $(POSTLINKER_ASM_OPTION) \
  392. --output=$(call dblquote,$(EXPTARGETASMFILE)) && \
  393. $(ASM) $(ASM_FLAGS) $(TARGET_ARCH_OPTION) $(AAPCS_OPTION) $(ASM_OUTPUT_OPTION) $$(call dblquote, $$@) $(EXPTARGETASMFILE) \
  394. $(call endrule,expgen)
  395. endef
  396. $(eval $(e32expgen_func))
  397. CLEANTARGETS:=$(CLEANTARGETS) $(EXPTARGET) $(EXPTARGETASMFILE)
  398. endif
  399. endif
  400. ## SOURCE FILES ##############################################################
  401. # Source files can be either C++ files (.cpp) or Assmbler-in-C++ files (.cia)
  402. # We have to split the two because they have the same link stage, the compile
  403. # stage is different for each.
  404. CPPFILEEXTENSIONS:=.cpp .CPP .Cpp .CPp .CpP .cPP .cpP .cPp .cc .CC \
  405. .Cc .c++ .C++ .cxx .CXX .Cxx .cXx .CxX .CXx .cC .cXX .cxX
  406. CFILEEXTENSIONS:=.c .C
  407. CIAFILEEXTENSIONS:=.CIA .cia .Cia .cIa .cIA .ciA .CIa .CiA
  408. ASMFILEEXTENSIONS:=.s .S
  409. # Extract the CPP files from our sources
  410. CPPFILES:=$(call extractfilesoftype,$(CPPFILEEXTENSIONS),$(SOURCE))
  411. CFILES:=$(call extractfilesoftype,$(CFILEEXTENSIONS),$(SOURCE))
  412. ASMFILES:=$(call extractfilesoftype,$(ASMFILEEXTENSIONS),$(SOURCE))
  413. # Find out what assember-in-c files there are
  414. # If appropriate, work out what CPP files will be created from the assembler files
  415. CIAFILES:=$(call extractfilesoftype,$(CIAFILEEXTENSIONS),$(SOURCE))
  416. CIA_CPPFILES:=
  417. ifeq ($(TRANSFORM_CIA),1)
  418. CIA_CPPFILES:=$(call relocatefiles,$(INTERMEDIATEPATH),$(call extractandmap,$(CIAFILEEXTENSIONS),_.cpp,$(CIAFILES)))
  419. endif
  420. ## LINK ######################################################################
  421. # Bring together all the .o files compiled from .cpp, .c, .s and .cia files.
  422. # These files are stored in the "non-releasable" output diretory.
  423. define mapcpp2object
  424. $(call relocatefiles,$(INTERMEDIATEPATH),$(call extractandmap,$(CPPFILEEXTENSIONS),.o,$1))
  425. endef
  426. define mapc2object
  427. $(call relocatefiles,$(INTERMEDIATEPATH),$(call extractandmap,$(CFILEEXTENSIONS),.o,$1))
  428. endef
  429. define mapasm2object
  430. $(call relocatefiles,$(INTERMEDIATEPATH),$(call extractandmap,$(ASMFILEEXTENSIONS),.o,$1))
  431. endef
  432. define mapcia2object
  433. $(call relocatefiles,$(INTERMEDIATEPATH),$(call extractandmap,$(CIAFILEEXTENSIONS),_.o,$1))
  434. endef
  435. # Determine what object files will be linked by using the source files.
  436. CPPFILES_LINKOBJECTS:=$(call mapcpp2object,$(CPPFILES))
  437. CFILES_LINKOBJECTS:=$(call mapc2object,$(CFILES))
  438. ifeq ($(TRANSFORM_CIA),1)
  439. CIAFILES_LINKOBJECTS:=$(patsubst %_.cpp,%_.o,$(CIA_CPPFILES))
  440. else
  441. CIAFILES_LINKOBJECTS:=$(call mapcia2object,$(CIAFILES))
  442. endif
  443. ASMFILES_LINKOBJECTS:=$(call mapasm2object,$(ASMFILES))
  444. # Try to link object files in the order in which the source files were specified.
  445. # This makes BC comparisons with non-Raptor builds easier.
  446. # Use the order of the source list to establish the order of the object files:
  447. LINKOBJECTS:=$(call relocatefiles,$(INTERMEDIATEPATH),$(SOURCE))
  448. # Replace the file extensions of the Source files with .o (or _.o for cia files) now
  449. # the list will contain the object files in the same order as the list of source files.
  450. LINKOBJECTS:=$(foreach FILE,$(LINKOBJECTS),$(basename $(FILE))$(if $(filter $(addprefix %,$(CIAFILEEXTENSIONS)),$(FILE)),_).o)
  451. # Set up variables if multifile compilation is being used.
  452. # Files are grouped in separate multifile compilations based on their extension
  453. # CPP and C files get separate multifile objects and .via files
  454. # Dependency files don't work when using multifile compilation
  455. ifneq ($(MULTIFILE_ENABLED),)
  456. NO_DEPEND_GENERATE:=1
  457. ifneq ($(strip $(CPPFILES)),)
  458. MULTIFILEOBJECT_CPP:=$(INTERMEDIATEPATH)/$(TARGET).$(POSTLINKFILETYPE)_$(VARIANTTYPE)_multifileobject_cpp.o
  459. MULTIFILE_VIAFILE_CPP:=$(INTERMEDIATEPATH)/$(TARGET)_$(VARIANTTYPE)_multifile_cpp.via
  460. endif
  461. ifneq ($(strip $(CFILES)),)
  462. MULTIFILEOBJECT_C:=$(INTERMEDIATEPATH)/$(TARGET).$(POSTLINKFILETYPE)_$(VARIANTTYPE)_multifileobject_c.o
  463. MULTIFILE_VIAFILE_C:=$(INTERMEDIATEPATH)/$(TARGET)_$(VARIANTTYPE)_multifile_c.via
  464. endif
  465. LINKOBJECTS_MULTIFILE:=$(MULTIFILEOBJECT_CPP) $(MULTIFILEOBJECT_C) $(CIAFILES_LINKOBJECTS) $(ASMFILES_LINKOBJECTS)
  466. endif
  467. ## Via file ####################################
  468. # list of all objects to be linked
  469. #
  470. VIAFILE:=$(INTERMEDIATEPATH)/$(TARGET)_$(VARIANTTYPE)_objects.via
  471. # The groupin10 macro allows us to construct a via file, 10 objects at a time
  472. # to avoid limits on argument lengths and sizes on Windows.
  473. # It expands to a list of commands, each of which is on a separate line.
  474. # This causes the shell to be invoked once for each line but each line should
  475. # be shorter than the maximum allowed by windows.
  476. define groupin10
  477. $(if $1,@echo -e $(foreach L,$(wordlist 1,10,$1),"$(L)\\n") >>$(VIAFILE),)
  478. $(if $1,$(call groupin10,$(wordlist 11,$(words $1),$1)),@true)
  479. endef
  480. ################################################
  481. ## ARMFPU postlinker option
  482. #
  483. POSTLINKER_FPU:=$(patsubst $(ARMFPU)>%,%,$(filter $(ARMFPU)>%,$(POSTLINKER_FPU_MAPPING)))
  484. POSTLINKER_FPU:=$(if $(POSTLINKER_FPU),$(POSTLINKER_FPU),$(POSTLINKER_FPU_DEFAULT))
  485. ################################################
  486. ## Link-type selection:
  487. # runtime static libraries link via AR
  488. ifneq ($(ARTARGET),)
  489. # Assuming that there are no libdeps in this case because this is probably one of the
  490. # Runtime libraries which has no deps.
  491. define artarget_func
  492. # Ensure that, when generating .via files, that they do not start with a blank line - some versions of GCC's AR reject
  493. # any further content in the file if the first line is empty
  494. # Also, disable multifile compilation when building static libraries, since it can potentially increase the size of any code
  495. # linking against that library.
  496. $(ARTARGET): $(LINKOBJECTS) $(STDCPPTAGFILE)
  497. @echo $(if $(STDCPPTAGFILE),"$(STDCPPTAGFILE)",-n "") > $(VIAFILE);
  498. $(call groupin10,$(LINKOBJECTS)) ;
  499. $(call startrule,ar,FORCESUCCESS) \
  500. $$(call dblquote,$(AR)) $(ARCHIVER_CREATE_OPTION) $$@ $(COMMANDFILE_OPTION)$(VIAFILE) \
  501. $(call endrule,ar)
  502. endef
  503. $(eval $(artarget_func))
  504. CLEANTARGETS:=$(CLEANTARGETS) $(VIAFILE)
  505. endif
  506. # Targettype is some type of DLL or EXE (or derivative)
  507. ifneq ($(LINK_TARGET),)
  508. located_ARMLIBS:=$(foreach L,$(ARMLIBS),$(wildcard $(RVCTLIB)/*/$(L)))
  509. located_STATICLIBRARIES:=$(foreach L,$(STATICLIBRARY),$(STATIC_LIBRARY_DIR)/$(L).lib)
  510. e32abiv2_LIBS:=$(EXPTARGET) $(LINKER_STUB_LIBRARY) $(if $(STATIC_RUNTIME_LIB),$(STATIC_RUNTIME_DIR)/$(STATIC_RUNTIME_LIB),) $(located_STATICLIBRARIES)
  511. # DLLS and EXEs - These objects are linked by a linker
  512. ifeq ($(ARMRT),)
  513. # Some of the runtime libraries do not set ARMRT because of a circular reference
  514. # problem; we need to stop these from linking to their own dso and not link to
  515. # the STATIC_LIBS_LIST.
  516. ifneq ($(findstring $(TARGET).dso,$(RUNTIME_LIBS_LIST)),)
  517. # (almost) ARM RUNTIME LIBS
  518. REDUCED_RUNTIME_LIBS_LIST:=$(subst $(TARGET).dso,,$(RUNTIME_LIBS_LIST))
  519. ifeq ($(VARIANTTYPE),udeb)
  520. e32abiv2_LIBS:=$(e32abiv2_LIBS) $(addprefix $(IMPORTLIBPATH)/,$(LIBRARIES_DEBUG)) $(addprefix $(RUNTIME_LIBS_PATH)/,$(REDUCED_RUNTIME_LIBS_LIST)) $(located_ARMLIBS)
  521. else
  522. e32abiv2_LIBS:=$(e32abiv2_LIBS) $(addprefix $(IMPORTLIBPATH)/,$(LIBRARIES)) $(addprefix $(RUNTIME_LIBS_PATH)/,$(REDUCED_RUNTIME_LIBS_LIST)) $(located_ARMLIBS)
  523. endif
  524. else
  525. # NORMAL
  526. #
  527. ifeq ($(VARIANTTYPE),udeb)
  528. e32abiv2_LIBS:=$(e32abiv2_LIBS) $(addprefix $(IMPORTLIBPATH)/,$(LIBRARIES_DEBUG))
  529. else
  530. e32abiv2_LIBS:=$(e32abiv2_LIBS) $(addprefix $(IMPORTLIBPATH)/,$(LIBRARIES))
  531. endif
  532. ifeq ($(HAS_DEDICATED_OP_NEWDEL_LIB),1)
  533. e32abiv2_LIBS:=$(e32abiv2_LIBS) $(addprefix $(RUNTIME_LIBS_PATH)/,$(NEWLIB))
  534. endif
  535. e32abiv2_LIBS:=$(e32abiv2_LIBS) $(addprefix $(RUNTIME_LIBS_PATH)/,$(RUNTIME_LIBS_LIST)) $(addprefix $(STATIC_LIBS_PATH)/,$(STATIC_LIBS_LIST)) $(located_ARMLIBS)
  536. endif
  537. else
  538. # ARM RUNTIME LIBS
  539. ifeq ($(VARIANTTYPE),udeb)
  540. e32abiv2_LIBS:=$(e32abiv2_LIBS) $(addprefix $(IMPORTLIBPATH)/,$(LIBRARIES_DEBUG)) $(located_ARMLIBS)
  541. else
  542. e32abiv2_LIBS:=$(e32abiv2_LIBS) $(addprefix $(IMPORTLIBPATH)/,$(LIBRARIES)) $(located_ARMLIBS)
  543. endif
  544. endif
  545. # NOTE: the groupin10 macro must be used before a call to the "startrule" macro
  546. # because the code between startrule and endrule is packaged up into one
  547. # commandline which would defeat the purpose of groupin10.
  548. # This is undesirable because viafile generation commands appear
  549. # outside the relevant tags but it is also unavoidable.
  550. ifeq ($(e32link_mk),)
  551. e32link_mk:=1
  552. include $(FLMHOME)/e32link.mk
  553. endif
  554. # Some configurations inject exports into the final binary by creating a .lib.exp file that is then fed to
  555. # the linker. How this .lib.exp is generated depends on whether a .def file is listed to control the build
  556. # or not. Either way, the .lib.exp is guarded so as to only be generated once.
  557. ifneq ($(FIX_EXPORTS_USING_EXP_FILE),)
  558. BUILDMARKER_EXPFILE:=$(call sanitise,EXPFILE_$(TARGET).lib.exp)
  559. ifeq ($(DEFFILE),)
  560. ifneq ($(AUTOEXPORTS),)
  561. ifeq ($($(BUILDMARKER_EXPFILE)),)
  562. $(eval $(call e32link_genlibexpfile,exports))
  563. $(eval $(BUILDMARKER_EXPFILE):=$(INTERMEDIATEPATH)/$(TARGET).lib.exp)
  564. endif
  565. endif
  566. else
  567. ifeq ($($(BUILDMARKER_EXPFILE)),)
  568. $(eval $(call e32link_genlibexpfile,deffile))
  569. $(eval $(BUILDMARKER_EXPFILE):=$(INTERMEDIATEPATH)/$(TARGET).lib.exp)
  570. endif
  571. endif
  572. ADDITIONAL_LIBS:=$($(BUILDMARKER_EXPFILE))
  573. endif
  574. ifeq ($(e32postlink_mk),)
  575. e32postlink_mk:=1
  576. include $(FLMHOME)/e32postlink.mk
  577. endif
  578. define linktarget_func
  579. # Supporting info in the logs for linker feedback users
  580. $(eval FEEDBACKFILE:=$(if $(DOLINKERFEEDBACK),$(wildcard $(FEEDBACKFILENAME)),))
  581. $(if $(filter %CLEAN,$(call uppercase,$(MAKECMDGOALS))),,\
  582. $(if $(DOLINKERFEEDBACK),
  583. $(if $(FEEDBACKFILE),, \
  584. $(info <info>Linker feedback file will be generated during the link of $(LINK_TARGET) - re-build to use in compilation</info>) \
  585. )))
  586. ## The actual link target, dependencies and build step
  587. $(E32TARGET): $(POSTLINKDEFFILE) $(POSTLINKER) $(if $(MULTIFILE_ENABLED),$(LINKOBJECTS_MULTIFILE),$(LINKOBJECTS)) $(e32abiv2_LIBS) $(ADDITIONAL_LIBS) $(LINKER_ENTRYPOINT_LIBDEP) $(if $(SUPPORTS_STDCPP_NEWLIB),$(CHECKLIB)) $(if $(HAVE_ORDERONLY),|,) $(EPOCROOT)/epoc32/build/TEM_LIB
  588. $(if $(MULTIFILE_ENABLED),,@echo -n "" > $(VIAFILE);
  589. $(call groupin10,$(LINKOBJECTS)) ;)
  590. $(call startrule,linkandpostlink) \
  591. $(if $(PERTURBSTARTTIME),$(RANSLEEP) $(PERTURBMSECS) ;,) \
  592. $(if $(SUPPORTS_STDCPP_NEWLIB),$(if $(located_STATICLIBRARIES),$(CHECKLIB) $(CHECKLIB_TYPE) --elf $(call dblquote,$(located_STATICLIBRARIES)) &&,),) \
  593. $(LD) $(LINKER_MISC_FLAGS) $(LINKER_DEFAULT_LIB_PATHS) $(SYMBIAN_LINK_FLAGS) $(if $(DEBUG_INFO),$(LINKER_DEBUG_OPTION),$(LINKER_NODEBUG_OPTION)) \
  594. $(if $(ARMLIBS),$(LD_WARNINGS_SUPPRESSION_ARMLIBS),) \
  595. $(if $(findstring EXE,$(POSTLINKTARGETTYPE)),$(if $(TREAT_EXES_AS_SHARED),$(SHARED_OBJECT_OPTION),),$(SHARED_OBJECT_OPTION)) \
  596. $(SPLIT_OPTION) \
  597. $(RW_BASE) \
  598. $(LINKER_ARCH_OPTION) \
  599. $(SYMVER_OPTION) \
  600. $(if $(REMOVE_UNUSED_SECTIONS),$(LINKER_REMOVE_OPTION),) \
  601. $(if $(SO_NAME_OPTION),$(SO_NAME_OPTION)=$(call dblquote,$(LINKASVERSIONED)),) \
  602. $(LINKER_ENTRY_OPTION)=$(LINKER_ENTRYPOINT_SETTING) \
  603. $(if $(NEED_ENTRYPOINT_LIBRARY),$(LINKER_ENTRYPOINT_LIBDEP),) \
  604. $(if $(ADDITIONAL_LIBS),$(call dblquote,$(ADDITIONAL_LIBS)),) \
  605. -o $$(call dblquote,$(LINK_TARGET)) \
  606. $(if $(LTCG),$(LTCG_OPTION),) \
  607. $(LINKER_SYMBOLS_OPTION) $(LINKER_SYMBOLS_FILE_OPTION)=$(call dblquote,$(MAPFILE)) \
  608. $(LINKEROPTION) \
  609. $(if $(MULTIFILE_ENABLED),$(call dblquote,$(LINKOBJECTS_MULTIFILE)),$(COMMANDFILE_OPTION)$(call dblquote,$(VIAFILE))) \
  610. $(if $(DOLINKERFEEDBACK),$(LINKER_FEEDBACK_OPTION)$(call dblquote,$(FEEDBACKFILENAME)_temp)) \
  611. $(if $(LINKER_ADD_STATIC_RUNTIME),$(if $(STATIC_RUNTIME_LIB),$(LINKER_GROUP_START_OPTION) $(STATIC_RUNTIME_DIR)/$(STATIC_RUNTIME_LIB) $(LINKER_GROUP_END_OPTION),)) \
  612. $(call dblquote,$(e32abiv2_LIBS)) $(LINKER_DEFAULT_LIBS) && \
  613. $(call e32postlink_$(BASE_ARCH)) \
  614. $(if $(DOLINKERFEEDBACK),&& $(call e32linkerfeedback_$(BASE_ARCH))) \
  615. $(if $(SAVESPACE),$(if $(EXPORTUNFROZEN),,&& { $(GNURM) -rf $(INTERMEDIATEPATH); true; })) \
  616. $(call endrule,linkandpostlink)
  617. $(MAPFILE): $(E32TARGET)
  618. $(LINK_TARGET): $(E32TARGET)
  619. endef
  620. ifneq ($(DOPOSTLINK),)
  621. $(eval $(linktarget_func))
  622. endif # ifneq ($(DOPOSTLINK),)
  623. CLEANTARGETS:=$(CLEANTARGETS) $(VIAFILE) $(if $(DOLINKERFEEDBACK),$(FEEDBACKFILENAME)_temp $(FEEDBACKFILENAME)) $(if $(MULTIFILE_ENABLED),$(MULTIFILEOBJECT_CPP) $(MULTIFILEOBJECT_C))
  624. endif # if TARGETTYPE lib
  625. ## Run trace compiler ##############################################
  626. # The following variable defines a prereq that source code will
  627. # depend on so that tracing happens before compilation. Must be
  628. # blank by default so that if tracing is off then there will be
  629. # no dependency. The tracecompiler code will set it if this
  630. # project actually does depend on trace-generated headers:
  631. TRACE_THISCOMPONENT_ALLRULE:=
  632. # Tracing requires a UID to make uniquely numbered trace points
  633. ifeq ($(UID3),)
  634. ifeq ($(UID2),)
  635. USE_TRACE_COMPILER:=
  636. else
  637. UID_TC:=$(UID2)
  638. endif
  639. else
  640. UID_TC:=$(UID3)
  641. endif
  642. # USE_TRACE_COMPILER defaults to blank in Raptor config.
  643. # Users can turn TC on by setting it to 1 in user config.
  644. ifneq ($(USE_TRACE_COMPILER),)
  645. # TARGETEXT is already set
  646. include $(FLMHOME)/tracecompiler.mk
  647. WHATRELEASE:=$(WHATRELEASE) $(TRACE_DICTIONARY) $(AUTOGEN_HEADER)
  648. endif
  649. ###################################################################
  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_OPTION)$(if $(ARMFPU),$(ARMFPU),$(COMPILER_FPU_DEFAULT))
  659. ## COMPILE CPP Files #################################################################
  660. # For ARMCC we can compile all sourcefiles with one invocation
  661. # The pathprep macro is used to make sure that forward slashes in options
  662. # are not interpreted as being paths by CYGWIN on Windows. On windows
  663. # pathprep makes a forward slash into two.
  664. # The majority of ARMCC arguments are common across all compiler invocations
  665. # Order is significant here in that OPTION_REPLACE here and in ABLD should
  666. # have the same impact
  667. CC_CORE_ARGS:=$(SYMBIAN_CCFLAGS) $(if $(DEBUG_INFO),-g) $(DEBUG_FORMAT) \
  668. $(RUNTIME_SYMBOL_VISIBILITY_OPTION) $(EXCEPTIONS) $(BITFIELD_SIGN_OPTION) \
  669. $(CC_WARNINGS_CONTROL_OPTION) $(CC_ERRORS_CONTROL_OPTION) \
  670. $(TARGET_ARCH_OPTION) $(ENUM_OPTION) $(OWN_LIBRARY_OPTION) $(FPMODE_OPTION) \
  671. $(EXPORT_VTBL_OPTION) $(NO_UNALIGNED_ACCESS) $(VFE_OPTION) $(AAPCS_OPTION) \
  672. $(COMPILE_ONLY_OPTION) $(INSTRUCTION_SET) \
  673. $(if $(ALWAYS_BUILD_AS_ARM),$(ARM_INSTRUCTION_SET),$(THUMB_INSTRUCTION_SET) $(call makemacrodef,-D,$(COMPILER_THUMB_DEFINES))) \
  674. $(COMPILER_FPU_OPTION)$(if $(ARMFPU),$(ARMFPU),$(COMPILER_FPU_DEFAULT))
  675. ifeq ($(STDCPP),1)
  676. SYSTEMINCLUDE:=$(SYSTEMINCLUDE) $(call concat, $(COMPILER_SYSTEM_INCLUDE_OPTION),$(call dblquote,$(STDCPP_INCLUDE)))
  677. endif
  678. # If requested, create and use a command file for include paths
  679. CC_USER_INCLUDES:=$(if $(USERINCLUDE),$(COMPILER_SYSTEM_INCLUDE_OPTION),)$(call concat, $(COMPILER_SYSTEM_INCLUDE_OPTION),$(call dblquote,$(USERINCLUDE)))
  680. CC_SYSTEM_INCLUDES:=$(if $(SYSTEMINCLUDE),$(COMPILER_SYSTEM_INCLUDE_OPTION),)$(call concat, $(COMPILER_SYSTEM_INCLUDE_OPTION),$(call dblquote,$(SYSTEMINCLUDE)))
  681. CC_INCLUDES:=$(CC_USER_INCLUDES) $(CC_SYSTEM_INCLUDES)
  682. ifneq ($(USE_COMPILATION_COMMAND_FILE),)
  683. CC_COMMAND_FILE:=$(INTERMEDIATEPATH)/cc.cmdfile
  684. $(eval $(call createcommandfile,$(CC_COMMAND_FILE),$(CC_INCLUDES)))
  685. endif
  686. define option_replace
  687. # Process a single, combined, item of the form 'search<->replace' in order to modify the command line tool call
  688. # We split this into its component arguments for use in substitutions
  689. # Spaces will have been escaped elsewhere to maintain distinct words, so we resurrect these
  690. # after the split.
  691. SEARCH:=$(subst %20,$(CHAR_SPACE),$(word 1,$(subst <->,$(CHAR_SPACE),$(1))))
  692. REPLACE:=$(subst %20,$(CHAR_SPACE),$(word 2,$(subst <->,$(CHAR_SPACE),$(1))))
  693. # Depending on whether there's a wildcard in the search, we may require either a normal $(subst) or a $(patsubst)
  694. PATSUBST:=$$(if $$(findstring %,$$(SEARCH)),1,)
  695. ifeq ($$(PATSUBST),1)
  696. CC_CORE_ARGS:=$$(patsubst $$(SEARCH),$$(REPLACE),$$(CC_CORE_ARGS))
  697. else
  698. CC_CORE_ARGS:=$$(subst $$(SEARCH),$$(REPLACE),$$(CC_CORE_ARGS))
  699. endif
  700. endef
  701. $(foreach ITEM,$(OPTION_REPLACE_COMPILER),$(eval $(call option_replace,$(ITEM))))
  702. define e32abiv2_compile
  703. # $(1) : target file
  704. # $(2) : single source file or c++ source file list <=> MULTIFILE_ENABLED
  705. # $(3) : via File name <=> MULTIFILE_ENABLED
  706. # $(4) : language specific options (e.g. C++ vs C)
  707. # $(5) : type (optional) - "compile" [default] or "preprocess"
  708. $(eval DEPENDFILENAME:=$(1).d)
  709. $(eval DEPENDFILE:=$(wildcard $(DEPENDFILENAME)))
  710. $(eval TYPE:=$(if $(5),$(5),compile))
  711. # linker feedback files are referenced if the variant has requested it, the
  712. # toolchains supports it and a feedback file already exists (from a prior
  713. # build)
  714. $(eval FEEDBACKFILE:=$(if $(DOLINKERFEEDBACK),$(wildcard $(FEEDBACKFILENAME)),))
  715. $(1): $(2) $(if $(MULTIFILE_ENABLED),,$(if $(DEPENDFILE),,RESOURCE BITMAP EXPORT)) $(FEEDBACKFILE) $(if $(USE_COMPILATION_COMMAND_FILE),$(CC_COMMAND_FILE),$(PROJECT_META_DEP)) | $(TRACE_THISCOMPONENT_ALLRULE)
  716. $(call startrule,$(TYPE),,$(2)) \
  717. $(if $(PERTURBSTARTTIME), $(RANSLEEP) $(PERTURBMSECS) ;,) \
  718. $(if $(MULTIFILE_ENABLED), echo $(2) > $(3) ;,) \
  719. $(CC) $(LICENSERETRY_OPTION) \
  720. $(if $(findstring preprocess,$(TYPE)),$(CPPONLYOPTION)) \
  721. $(CC_CORE_ARGS) \
  722. $(OPTION_COMPILER) $(if $(MULTIFILE_ENABLED),$(4),$(3)) \
  723. $(if $(LTCG),$(LTCG_OPTION),) \
  724. $(if $(USE_PROFILER_FEEDBACK),--profile=$(call dblquote,$(ARM_PROFILER_FILE)),) \
  725. $(call makemacrodef,-D,$(COMPILER_INTERWORK_DEFINES) $(CDEFS)) \
  726. $(if $(PREINCLUDE),$(PREINCLUDE_OPTION) ,)$(call concat, $(PREINCLUDE_OPTION) ,$(call dblquote,$(PREINCLUDE)))\
  727. $(if $(SET_ARMINC),$(if $(RVCTINC),$(COMPILER_SYSTEM_INCLUDE_OPTION)$(call dblquote,$(RVCTINC)),),) \
  728. $(COMPILER_SYSTEM_INCLUDE_OPTION)$$(call dblquote,$$(<D)) \
  729. $(if $(USE_COMPILATION_COMMAND_FILE),$(COMMANDFILE_OPTION)$(CC_COMMAND_FILE),$(CC_INCLUDES)) \
  730. $(if $(NOHIDEALL),$(COMPILER_NO_HIDE_ALL_OPTION),) \
  731. $(if $(or $(NO_DEPEND_GENERATE),$(findstring preprocess,$(TYPE))),,$(DEPEND_OPTION) $(call dblquote,$(1).d)) \
  732. $(if $(FEEDBACKFILE),$(COMPILER_FEEDBACK_OPTION)$(call dblquote,$(FEEDBACKFILE))) \
  733. $(if $(MULTIFILE_ENABLED),--multifile $(OUTPUT_OPTION) $$@ \
  734. $(COMMANDFILE_OPTION)$$(call dblquote, $(3)),$(OUTPUT_OPTION) $$@ $$(call dblquote, $$<)) $(if $(USE_RVCT22_DELETE_WORKAROUND),$(RVCT22_DELETE_WORKAROUND)) \
  735. $(call endrule,$(TYPE))
  736. ifeq ($(NO_DEPEND_GENERATE),)
  737. CLEANTARGETS:=$$(CLEANTARGETS) $(DEPENDFILENAME)
  738. endif
  739. ifneq ($(DEPENDFILE),)
  740. ifeq ($(NO_DEPEND_INCLUDE),)
  741. ifeq ($(filter %CLEAN,$(call uppercase,$(MAKECMDGOALS))),)
  742. -include $(DEPENDFILE)
  743. endif
  744. endif
  745. endif
  746. # individual source file compilation
  747. SOURCETARGET_$(call sanitise,$(2)): $(1)
  748. endef
  749. # Evaluate .cpp and .c files in separate groups for multifile.
  750. $(if $(MULTIFILE_ENABLED),$(eval $(call e32abiv2_compile,$(MULTIFILEOBJECT_CPP),$(CPPFILES),$(MULTIFILE_VIAFILE_CPP),$(CPP_LANG_OPTION))),$(foreach F,$(CPPFILES),$(eval $(call e32abiv2_compile,$(call mapcpp2object,$(F)),$(F),$(CPP_LANG_OPTION)))))
  751. $(if $(MULTIFILE_ENABLED),$(eval $(call e32abiv2_compile,$(MULTIFILEOBJECT_C),$(CFILES),$(MULTIFILE_VIAFILE_C),$(C_LANG_OPTION))),$(foreach F,$(CFILES),$(eval $(call e32abiv2_compile,$(call mapc2object,$(F)),$(F),$(C_LANG_OPTION)))))
  752. ifneq ($(TRANSFORM_CIA),1)
  753. $(if $(MULTIFILE_ENABLED),,$(foreach F,$(CIAFILES),$(eval $(call e32abiv2_compile,$(call mapcia2object,$(F)),$(F),$(CPP_LANG_OPTION) $(COMPILER_CIA_FLAGS) $(call makemacrodef,-D,$(CIADEFS))))))
  754. endif
  755. CLEANTARGETS:=$(CLEANTARGETS) $(if $(MULTIFILE_ENABLED),$(MULTIFILEOBJECT_CPP) $(MULTIFILEOBJECT_C) $(MULTIFILE_VIAFILE_CPP) $(MULTIFILE_VIAFILE_C),$(CPPFILES_LINKOBJECTS) $(CFILES_LINKOBJECTS) $(CIAFILES_LINKOBJECTS))
  756. ## Preprocess target ###################################################
  757. define e32abiv2_preprocess
  758. $(eval PREPROCESSTARGET:=$(1).$(VARIANTPLATFORM).$(VARIANTTYPE).$(TARGET).$(TARGETEXT).pre)
  759. PREPROCESS:: $(PREPROCESSTARGET)
  760. $(call e32abiv2_compile,$(PREPROCESSTARGET),$(1),$(2),,preprocess)
  761. CLEANTARGETS:=$$(CLEANTARGETS) $(PREPROCESSTARGET)
  762. endef
  763. # Only generate preprocess targets if they are requested
  764. ifneq ($(filter PREPROCESS,$(call uppercase,$(MAKECMDGOALS))),)
  765. $(foreach F,$(CFILES),$(eval $(call e32abiv2_preprocess,$(F),$(C_LANG_OPTION))))
  766. $(foreach F,$(CPPFILES),$(eval $(call e32abiv2_preprocess,$(F),$(CPP_LANG_OPTION))))
  767. endif
  768. ## Listing target ###################################################
  769. # Very similar to compile, apart from the extra flags passed to the
  770. # compile and different output options
  771. define map2listfile
  772. $(call relocatefiles,$(INTERMEDIATEPATH),$(call extractandmap,$(CPPFILEEXTENSIONS) $(CFILEEXTENSIONS),.lis,$1))
  773. endef
  774. define e32abiv2_listing
  775. # $1 is the sourcefile
  776. $(eval LISTINGTARGET:=$(strip $(call extractandmap,$(CPPFILEEXTENSIONS) $(CFILEEXTENSIONS),.$(subst _,.,$(call sanitise,$(FULLVARIANTPATH))).$(TARGET).$(TARGETEXT).lst,$1)))
  777. $(eval DEPENDFILENAME:=$(call map2listfile,$1).d)
  778. $(eval DEPENDFILE:=$(wildcard $(DEPENDFILENAME)))
  779. LISTING:: $(LISTINGTARGET)
  780. $(LISTINGTARGET): $(1) $(if $(USE_COMPILATION_COMMAND_FILE),$(CC_COMMAND_FILE),$(PROJECT_META_DEP)) $(if $(DEPENDFILE),,RESOURCE BITMAP EXPORT)
  781. $(call startrule,e32listing,,$(1)) \
  782. $(if $(PERTURBSTARTTIME), $(RANSLEEP) $(PERTURBMSECS) ;,) \
  783. $(CC) $(LICENSERETRY_OPTION) $(SYMBIAN_CCFLAGS) \
  784. $(CC_CORE_ARGS) \
  785. $(LISTING_OPTION) \
  786. $(OPTION_COMPILER) \
  787. $(call makemacrodef,-D,$(COMPILER_INTERWORK_DEFINES) $(CDEFS)) \
  788. $(if $(PREINCLUDE),$(PREINCLUDE_OPTION) ,)$(call concat, $(PREINCLUDE_OPTION) ,$(call dblquote,$(PREINCLUDE)))\
  789. $(if $(SET_ARMINC),$(if $(RVCTINC),$(COMPILER_SYSTEM_INCLUDE_OPTION)$(call dblquote,$(RVCTINC)),),) \
  790. $(COMPILER_SYSTEM_INCLUDE_OPTION)$$(call dblquote,$$(<D)) \
  791. $(if $(USE_COMPILATION_COMMAND_FILE),$(COMMANDFILE_OPTION)$(CC_COMMAND_FILE),$(CC_INCLUDES)) \
  792. $(if $(NOHIDEALL),$(COMPILER_NO_HIDE_ALL_OPTION),) \
  793. $(if $(NO_DEPEND_GENERATE),,$(DEPEND_OPTION) $(call dblquote,$(DEPENDFILENAME))) \
  794. $$(call dblquote, $$<) $(OUTPUT_OPTION) $$(@) $(if $(USE_RVCT22_DELETE_WORKAROUND),$(RVCT22_DELETE_WORKAROUND)) \
  795. $(call endrule,e32listing)
  796. CLEANTARGETS:=$$(CLEANTARGETS) $(LISTINGTARGET)
  797. ifeq ($(NO_DEPEND_GENERATE),)
  798. CLEANTARGETS:=$$(CLEANTARGETS) $(DEPENDFILENAME)
  799. endif
  800. ifneq ($(DEPENDFILE),)
  801. ifeq ($(NO_DEPEND_INCLUDE),)
  802. ifeq ($(filter %CLEAN,$(call uppercase,$(MAKECMDGOALS))),)
  803. -include $(DEPENDFILE)
  804. endif
  805. endif
  806. endif
  807. endef
  808. # No point at all in generating listing targets if we aren't going to make them
  809. ifneq ($(filter LISTING,$(call uppercase,$(MAKECMDGOALS))),)
  810. $(foreach F,$(CPPFILES) $(CFILES),$(eval $(call e32abiv2_listing,$(F))))
  811. endif
  812. # Function to execute FREEZE ###########################################
  813. ifneq ($(SUPPORT_FREEZE),)
  814. # Fivespaces variable created to ensure a suitable gap of space characters
  815. # Is placed between the separate arguments. This fixes a problem in Cygwin, where
  816. # separate arguments are interpreted as a single argument when passed to bash
  817. FIVESPACES=$(BLANK) $(BLANK)
  818. FREEZEGUARD:=TARGET_$(TARGET)_$(TARGETEXT)_$(IMPORTLIBPATH)_EFREEZE
  819. define e32freeze
  820. FREEZE:: $(1)
  821. $(call startrule,freeze,,$(RESOLVED_DEFFILE)) \
  822. $(EFREEZE) $(EFREEZE_REMOVE_OPTION) "$(RESOLVED_DEFFILE)" $(FIVESPACES) $(call dblquote,$(GENERATED_DEFFILE)) \
  823. $(call endrule,freeze)
  824. endef
  825. # Only freeze once - udeb and urel cannot differ
  826. ifeq ($($(FREEZEGUARD)),)
  827. # For most freezing activity we need the temporary .def file generated in the final post-link
  828. # that lists the current exports - FREEZE can therefore be dependent on the final post-linked binary,
  829. # with the side-effect that a build is triggered if someone tries to freeze without having built.
  830. #
  831. # However, there's one case where we don't want to be dependent on the post-linked binary in this way,
  832. # and that's when (a) there are missing exports, (b) the user's aware of them and (c) they're deliberately freezing to
  833. # remove them using EFREEZE's remove option. Being dependent on the post-linked binary in this case, where POSTLINKER
  834. # actually fails to generate a final binary, would mean that the freeze would never happen and post-linking would
  835. # just be continually re-attempted (to fail each time).
  836. #
  837. # So, as a special case, if the user is explicitly attempting to freeze and perform removals, we make FREEZE dependent
  838. # on the temporary .def file instead. This has no rule to actually make it, but gives a hint as to what is wrong if
  839. # the users performs a freeze with remove without having explicitly built previously.
  840. #
  841. ifneq ($(EFREEZE_REMOVE_OPTION),)
  842. $(eval $(call e32freeze,$(GENERATED_DEFFILE)))
  843. else
  844. $(eval $(call e32freeze,$(E32TARGET)))
  845. endif
  846. $(FREEZEGUARD):=1
  847. endif
  848. endif
  849. CLEANTARGETS:=$(CLEANTARGETS) $(if $(MULTIFILE_ENABLED),$(MULTIFILEOBJECT),$(CPPFILES_LINKOBJECTS) $(CFILES_LINKOBJECTS))
  850. ## ASSEMBLER FILES ###################################################################
  851. # CIA VERSION ############################################
  852. define mapcia2xxx
  853. $(call relocatefiles,$(INTERMEDIATEPATH),$(call extractandmap,$(CIAFILEEXTENSIONS),$2,$1))
  854. endef
  855. define e32abiv2_CIA2CPP
  856. $(eval e32abiv2_OFILE:=$(call mapcia2xxx,$(1),_.o))
  857. $(eval e32abiv2_PREFILE:=$(call mapcia2xxx,$(1),_.pre))
  858. $(eval e32abiv2_CPPFILE:=$(call mapcia2xxx,$(1),_.cpp))
  859. $(eval CLEANTARGETS:=$(CLEANTARGETS) $(e32abiv2_OFILE) $(e32abiv2_CPPFILE) $(e32abiv2_PREFILE))
  860. $(e32abiv2_OFILE): $(e32abiv2_CPPFILE) $(if $(USE_COMPILATION_COMMAND_FILE),$(CC_COMMAND_FILE),$(PROJECT_META_DEP))
  861. $(call startrule,cia2cpp2o,,$(e32abiv2_CPPFILE)) \
  862. $(if $(PERTURBSTARTTIME),$(RANSLEEP) $(PERTURBMSECS) ;,) \
  863. $(CC) $(LICENSERETRY_OPTION) \
  864. $(CC_CORE_ARGS) \
  865. $(if $(LTCG),$(LTCG_OPTION),) \
  866. $(OPTION_COMPILER) \
  867. $(call makemacrodef,-D,$(COMPILER_INTERWORK_DEFINES) $(CDEFS) $(CIADEFS)) $(CPP_LANG_OPTION) \
  868. $(if $(USE_COMPILATION_COMMAND_FILE),$(COMMANDFILE_OPTION)$(CC_COMMAND_FILE),$(CC_INCLUDES)) \
  869. $$(call dblquote, $$<) $(OUTPUT_OPTION) $$@ $(if $(USE_RVCT22_DELETE_WORKAROUND),$(RVCT22_DELETE_WORKAROUND)) \
  870. $(call endrule,cia2cpp2o)
  871. # preprocessed CIA file to a CPP file
  872. $(e32abiv2_CPPFILE): $(e32abiv2_PREFILE)
  873. $(call startrule,tranasm) \
  874. $(if $(CPPFILT),CPPFILT="$(CPPFILT)",) \
  875. $(TRANASM) --suppress-check --output="$$@" $$^ \
  876. $(call endrule,tranasm)
  877. $(eval DEPENDFILENAME:=$(e32abiv2_PREFILE).d)
  878. $(eval DEPENDFILE:=$(wildcard $(DEPENDFILENAME)))
  879. # preprocess the cia file
  880. $(eval e32abiv2_PREFILE_OPTIONS:= $(LICENSERETRY_OPTION) $(PREPROCESSOR_OPTION) $(CPP_OPTION) \
  881. $(SYMBIAN_CCFLAGS) $(call makemacrodef,-D,$(COMPILER_INTERWORK_DEFINES) $(CDEFS) $(CIADEFS)) $(CPP_LANG_OPTION) \
  882. $(if $(PREINCLUDE),$(PREINCLUDE_OPTION) ,)$$(call concat, $(PREINCLUDE_OPTION) ,$$(call dblquote,$(PREINCLUDE))) \
  883. $(if $(USE_COMPILATION_COMMAND_FILE),$(COMMANDFILE_OPTION)$(CC_COMMAND_FILE),$(CC_INCLUDES)) \
  884. $(if $(ARMINC),$(if $(RVCTINC), $(COMPILER_SYSTEM_INCLUDE_OPTION)$$(call dblquote,$(RVCTINC)),),) )
  885. $(e32abiv2_PREFILE): $1 $(if $(USE_COMPILATION_COMMAND_FILE),$(CC_COMMAND_FILE),$(PROJECT_META_DEP)) $(if $(DEPENDFILE),,RESOURCE BITMAP EXPORT)
  886. $(call startrule,cia2cpp,,$1) \
  887. $(if $(PERTURBSTARTTIME),$(RANSLEEP) $(PERTURBMSECS) ;,) \
  888. $(CC) $(e32abiv2_PREFILE_OPTIONS) $(OUTPUT_OPTION) $$@ $$(call dblquote,$1) $(if $(USE_RVCT22_DELETE_WORKAROUND),$(RVCT22_DELETE_WORKAROUND)) \
  889. $(if $(NO_DEPEND_GENERATE),,&& $(CC) -M $(e32abiv2_PREFILE_OPTIONS) --depend_format=unix $(OUTPUT_OPTION) $$@ $$(call dblquote,$1) > $(call dblquote,$(e32abiv2_PREFILE).d)) \
  890. $(call endrule,cia2cpp)
  891. ifeq ($(NO_DEPEND_GENERATE),)
  892. CLEANTARGETS:=$$(CLEANTARGETS) $(DEPENDFILENAME)
  893. endif
  894. ifneq ($(DEPENDFILE),)
  895. ifeq ($(NO_DEPEND_INCLUDE),)
  896. ifeq ($(filter %CLEAN,$(call uppercase,$(MAKECMDGOALS))),)
  897. -include $(DEPENDFILE)
  898. endif
  899. endif
  900. endif
  901. endef
  902. # Create a rule for each cia file
  903. ifeq ($(TRANSFORM_CIA),1)
  904. $(eval $(foreach e32abiv2_RULE,$(CIAFILES),$(call e32abiv2_CIA2CPP,$(e32abiv2_RULE))))
  905. endif
  906. # Pure assembler (.s files) ################################
  907. e32abiv2_asm_OPTIONS:=$(LICENSERETRY_OPTION) \
  908. $(CC_CORE_ARGS) \
  909. $(OPTION_COMPILER) \
  910. $(call makemacrodef,-D,$(COMPILER_INTERWORK_DEFINES) $(CDEFS)) \
  911. $(if $(USE_COMPILATION_COMMAND_FILE),$(COMMANDFILE_OPTION)$(CC_COMMAND_FILE),$(CC_INCLUDES))
  912. # note that the --no_rtti option cannot be passed with the -M option
  913. # so forcibly remove it when generating ASM dependencies.
  914. #
  915. define e32abiv2_asm
  916. $(eval DEPENDFILENAME:=$(1).d)
  917. $(eval DEPENDFILE:=$(wildcard $(DEPENDFILENAME)))
  918. $(1): $(2) $(if $(USE_COMPILATION_COMMAND_FILE),$(CC_COMMAND_FILE),$(PROJECT_META_DEP)) $(if $(DEPENDFILE),,RESOURCE BITMAP EXPORT)
  919. $(call startrule,asmcompile,,$(2)) \
  920. $(if $(PERTURBSTARTTIME),$(RANSLEEP) $(PERTURBMSECS) ;,) \
  921. $(CC) $(e32abiv2_asm_OPTIONS) \
  922. $(if $(NO_DEPEND_GENERATE),,$(DEPEND_OPTION) $(call dblquote,$(DEPENDFILENAME))) \
  923. $$(call dblquote, $$<) $(OUTPUT_OPTION) $$@ $(if $(USE_RVCT22_DELETE_WORKAROUND),$(RVCT22_DELETE_WORKAROUND)) \
  924. $(call endrule,asmcompile)
  925. ifeq ($(NO_DEPEND_GENERATE),)
  926. $(call startrule,asmdependencies) \
  927. $(CC) -M $(subst --no_rtti,,$(e32abiv2_asm_OPTIONS)) --depend_format=unix \
  928. $(OUTPUT_OPTION) $$@ $$(call dblquote,$2) > $(call dblquote,$(DEPENDFILENAME)) $(if $(USE_RVCT22_DELETE_WORKAROUND),$(RVCT22_DELETE_WORKAROUND)) \
  929. $(call endrule,asmdependencies)
  930. endif
  931. ifeq ($(NO_DEPEND_GENERATE),)
  932. CLEANTARGETS:=$$(CLEANTARGETS) $(DEPENDFILENAME)
  933. endif
  934. ifneq ($(DEPENDFILE),)
  935. ifeq ($(NO_DEPEND_INCLUDE),)
  936. ifeq ($(filter %CLEAN,$(call uppercase,$(MAKECMDGOALS))),)
  937. -include $(DEPENDFILE)
  938. endif
  939. endif
  940. endif
  941. CREATABLEPATHS:=$$(CREATABLEPATHS) $(INTERMEDIATEPATH)
  942. endef
  943. $(eval $(foreach F,$(ASMFILES), $(call e32abiv2_asm,$(call mapasm2object,$(F)),$(F))))
  944. CLEANTARGETS:=$(CLEANTARGETS) $(ASMFILES_LINKOBJECTS)
  945. endif # ifneq ($(TARGETTYPE),implib)
  946. ########################## Build ROMFILE target ############################
  947. # Only build ROMFILE if asked
  948. ifneq ($(filter ROMFILE,$(call uppercase,$(MAKECMDGOALS))),)
  949. include $(FLMHOME)/romfile.mk
  950. endif
  951. # Deal with test code batch files generation.
  952. ifneq ($(TESTPATH),)
  953. CREATABLEPATHS:=$(CREATABLEPATHS) $(EPOCROOT)/epoc32/data/z/test/
  954. $(eval $(call MakeTestBatchFiles,$(TARGET),$(EPOCROOT)/epoc32/data/z/test/$(MODULE_DIR)/$(VARIANTPLATFORM).$(TESTPATH)))
  955. BATCHFILE_CREATED_$(EPOCROOT)/epoc32/data/z/test/$(MODULE_DIR)/$(VARIANTPLATFORM).$(TESTPATH):=1
  956. TARGET_CREATED_$(EPOCROOT)/epoc32/data/z/test/$(MODULE_DIR)/$(VARIANTPLATFORM).$(TESTPATH)_$(TARGET):=1
  957. WHATRELEASE:=$(WHATRELEASE) $(EPOCROOT)/epoc32/data/z/test/$(MODULE_DIR)/$(VARIANTPLATFORM).$(TESTPATH)
  958. endif
  959. ###################### End of Build ROMFILE target ######################
  960. # Feature Variation requires a .vmap file to be created for each binary
  961. #
  962. ifneq ($(FEATUREVARIANTNAME),)
  963. ifneq ($(E32TARGET),)
  964. OUTPUTVMAP:=$(E32TARGET).vmap
  965. WHATRELEASE:=$(WHATRELEASE) $(OUTPUTVMAP)
  966. TARGET:: $(OUTPUTVMAP)
  967. VMAPNEEDS:=$(E32TARGET) $(SOURCE) $(PROJECT_META_DEP)
  968. BV_FEATURELIST:=$(addprefix -f ,$(FEATURELISTFILES))
  969. BV_USER_INCLUDES:=$(addprefix -u ,$(USERINCLUDE))
  970. BV_SYSTEM_INCLUDES:=$(addprefix -x ,$(SYSTEMINCLUDE))
  971. # translate double quoted macros because $(shell) messes them up in some make engines
  972. BV_MACROLIST:=$(COMPILER_INTERWORK_DEFINES) $(CDEFS) $(if $(ALWAYS_BUILD_AS_ARM),,$(COMPILER_THUMB_DEFINES))
  973. BV_DEFINES:=$(call makemacrodef,-D,$(subst ",__SBS__QUOTE__,$(BV_MACROLIST)))
  974. VMAPCOMMANDFILE:=$(INTERMEDIATEPATH)/$(TARGET).vmap.cmdfile
  975. CLEANTARGETS:=$(CLEANTARGETS) $(VMAPCOMMANDFILE)
  976. # the script to generate our .vmap file and hash value
  977. define createvmap
  978. $(OUTPUTVMAP): $(VMAPNEEDS)
  979. @echo -n "" > $(VMAPCOMMANDFILE);
  980. $(call groupin10infile,$(VMAPCOMMANDFILE),$(addprefix -s,$(SOURCE) $(PROJECT_META_DEP))) ;
  981. $(call startrule,createvmap) \
  982. $(CREATEVMAP) -o $(OUTPUTVMAP) $(BV_FEATURELIST) $(BV_DEFINES) -p $(PREINCLUDE) --command=$(VMAPCOMMANDFILE) $(BV_USER_INCLUDES) $(BV_SYSTEM_INCLUDES) -c $(CREATEVMAPCPP) \
  983. $(call endrule,createvmap)
  984. endef
  985. # a recipe to create the .vmap from the "sources" with the createvmap script
  986. $(eval $(createvmap))
  987. endif # E32TARGET != ""
  988. endif # FEATUREVARIANTNAME != ""
  989. ########################### CONCLUSION ###################################
  990. # make the output directories while reading makefile - some build engines prefer this
  991. $(call makepath,$(CREATABLEPATHS))
  992. ## Clean up
  993. $(call raptor_clean,$(CLEANTARGETS))
  994. # For the --what option and the log file
  995. $(call raptor_release,$(filter-out %.sym,$(WHATRELEASE)))
  996. endif # DOBUILD
  997. ## The End