|
1 # |
|
2 # Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 # All rights reserved. |
|
4 # This component and the accompanying materials are made available |
|
5 # under the terms of the License "Eclipse Public License v1.0" |
|
6 # which accompanies this distribution, and is available |
|
7 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 # |
|
9 # Initial Contributors: |
|
10 # Nokia Corporation - initial contribution. |
|
11 # |
|
12 # Contributors: |
|
13 # |
|
14 # Description: |
|
15 # |
|
16 |
|
17 |
|
18 # Macros for creating Standard targets |
|
19 |
|
20 ifeq ($(_METAFLM_MK_),) |
|
21 _METAFLM_MK_:=1 |
|
22 |
|
23 # GENERATE STANDARD CLEAN TARGET |
|
24 # example usage: |
|
25 # $(eval $(call GenerateStandardCleanTarget,$(FILE_LIST),$(DIRECTORY_LIST))) |
|
26 |
|
27 ## CLEAN macros ##################################### |
|
28 # The clean macro does not generate a target but extension makefiles do have |
|
29 # CLEAN targets that need to be attached to something. |
|
30 .PHONY:: CLEAN |
|
31 |
|
32 define GenerateStandardCleanTarget |
|
33 $(info <clean bldinf='$(COMPONENT_META)' mmp='$(PROJECT_META)' config='$(SBS_CONFIGURATION)'>) |
|
34 $(foreach ITEM,$(1),$(info <file>$(ITEM)</file>)) |
|
35 $(foreach ITEM,$(2),$(info <dir>$(ITEM)</dir>)) |
|
36 $(info </clean>) |
|
37 endef |
|
38 |
|
39 ## End CLEAN macros ##################################### |
|
40 |
|
41 |
|
42 ## WHAT macros ##################################### |
|
43 |
|
44 |
|
45 ## Begin --what Macros ##### |
|
46 define outputWhat |
|
47 ifeq ($(OSTYPE),cygwin) |
|
48 $(2):: |
|
49 @for FILE in $(subst %20,$(CHAR_SPACE),$(subst /,\\,$(call dblquote,$(1)))); do \ |
|
50 echo $$$$FILE; \ |
|
51 done; |
|
52 else |
|
53 $(2):: |
|
54 @for FILE in $(subst %20,$(CHAR_SPACE),$(1)); do \ |
|
55 echo $$$$FILE; \ |
|
56 done |
|
57 endif |
|
58 endef |
|
59 |
|
60 ## End --what Macros ##### |
|
61 |
|
62 ## Begin .whatlog Macros ##### |
|
63 define whatLogOpen |
|
64 <whatlog bldinf='$(COMPONENT_META)' mmp='$(PROJECT_META)' config='$(SBS_CONFIGURATION)'> |
|
65 endef |
|
66 |
|
67 define whatLogItem |
|
68 $(if $(findstring EXPORT,$(1)),<export ,$(if $(findstring RESOURCE,$(1)),<resource>,$(if $(findstring BITMAP,$(1)),<bitmap>,$(if $(findstring STRINGTABLE,$(1)),<stringtable>,$(if $(findstring ARCHIVE,$(1)),<member>,<build>)))))$(subst %20,$(CHAR_SPACE),$(2))$(if $(findstring EXPORT,$(1)),/>,$(if $(findstring RESOURCE,$(1)),</resource>,$(if $(findstring BITMAP,$(1)),</bitmap>,$(if $(findstring STRINGTABLE,$(1)),</stringtable>,$(if $(findstring ARCHIVE,$(1)),</member>,</build>))))) |
|
69 endef |
|
70 |
|
71 define whatLogClose |
|
72 </whatlog> |
|
73 endef |
|
74 |
|
75 define outputWhatLog |
|
76 $(info $(call whatLogOpen)) |
|
77 $(foreach ITEM,$(1),$(info $(call whatLogItem,$(2),$(ITEM)))) |
|
78 $(info $(call whatLogClose)) |
|
79 endef |
|
80 |
|
81 ## End .whatlog Macros ##### |
|
82 |
|
83 # General FLM entry points for what-related processing |
|
84 define WhatExports |
|
85 endef |
|
86 |
|
87 define whatmacro |
|
88 $(call outputWhatLog,$(1),$(2)) |
|
89 endef |
|
90 |
|
91 define whatUnzip |
|
92 endef |
|
93 ## END WHAT UNZIP MACRO |
|
94 |
|
95 ## End WHAT macros ##################################### |
|
96 |
|
97 # Macro for creating the test BATCH files. |
|
98 # Arguments: $(1) -> Target Name $(2) -> Output Batch file path |
|
99 define MakeTestBatchFiles |
|
100 $(if $(BATCHFILE_CREATED_$(2)) |
|
101 , |
|
102 $(if $(TARGET_CREATED_$(2)_$(TARGET)) |
|
103 , |
|
104 , |
|
105 $$(shell echo -e "$(1)\r" >> $(2)) |
|
106 ) |
|
107 , |
|
108 $$(shell $(GNUMKDIR) -p $(dir $(2))) |
|
109 $$(shell echo -e "$(1)\r" > $(2)) |
|
110 ) |
|
111 endef |
|
112 |
|
113 ## path creation ######################### |
|
114 # Make the destination directory if neccessary. For some |
|
115 # make engines we must do this outside the rule or they |
|
116 # get confused by the apparent way in which different rules |
|
117 # can create a particular directory and they infer some kind |
|
118 # of dependency. |
|
119 |
|
120 # Makepath. Copyright (C) 2008 Symbian Software Ltd. |
|
121 # buffering with repeat prevention, makes directories after every 30 calls. Any more might overload |
|
122 # the createprocess limit on arguments. |
|
123 # |
|
124 # makepathLIST is initialised in globals.mk |
|
125 define makepath_single |
|
126 $(if $(findstring $1,$(makepathLIST)),,$(eval makepathLIST:=$(makepathLIST) $1)) |
|
127 $(if $(subst 30,,$(words $(makepathLIST))),,$(shell $(GNUMKDIR) -p $(makepathLIST))$(eval makepathLIST:=)) |
|
128 endef |
|
129 |
|
130 # The following turns out to be extremely slow - something to do with using eval |
|
131 # or to do with creating huge numbers of TARGET_ variables? BTW, this is an attempt |
|
132 # to not make things that we have already made. |
|
133 # define makepath |
|
134 # $(info makepath_start)$(foreach DIR,$1,$(if $(TARGET_$(1)),,$(call makepath_single,$(DIR))$(eval TARGET_$(1):=1)))$(info makepath_end) |
|
135 # endef |
|
136 |
|
137 # In general, makepath creates directories during FLM evaluation. |
|
138 # However, if the WHAT target is being processed then it should do nothing. |
|
139 ifeq ($(filter WHAT,$(call uppercase,$(MAKECMDGOALS))),) |
|
140 define makepath |
|
141 $(strip $(foreach DIR,$(sort $1),$(call makepath_single,$(DIR)))) |
|
142 endef |
|
143 else |
|
144 define makepath |
|
145 endef |
|
146 endif |
|
147 |
|
148 |
|
149 define makepathfor |
|
150 $(call makepath,$(dir $1)) |
|
151 endef |
|
152 |
|
153 # Make any remaining paths in the path buffer |
|
154 define makepathfinalise |
|
155 $(strip $(if $(makepathLIST),$(shell $(GNUMKDIR) -p $(makepathLIST))$(eval makepathLIST:=),)) |
|
156 endef |
|
157 |
|
158 ## ROMFILE macro ##################################### |
|
159 define DoRomSet |
|
160 |
|
161 ifeq ($(call uppercase,$(TARGETTYPE)),LIB) |
|
162 BUILDROMTARGET:= |
|
163 endif |
|
164 |
|
165 ifeq ($(call uppercase,$(TARGETTYPE)),KEXT) |
|
166 ROMFILETYPE:=extension[MAGIC] |
|
167 ABIDIR:=KMAIN |
|
168 endif |
|
169 ifeq ($(call uppercase,$(TARGETTYPE)),LDD) |
|
170 ROMFILETYPE:=device[MAGIC] |
|
171 ABIDIR:=KMAIN |
|
172 endif |
|
173 ifeq ($(call uppercase,$(TARGETTYPE)),PDD) |
|
174 ROMFILETYPE:=device[MAGIC] |
|
175 ABIDIR:=KMAIN |
|
176 endif |
|
177 ifeq ($(call uppercase,$(TARGETTYPE)),VAR) |
|
178 ROMFILETYPE:=variant[MAGIC] |
|
179 ABIDIR:=KMAIN |
|
180 endif |
|
181 ifeq ($(call uppercase,$(TARGETTYPE)),KDLL) |
|
182 ABIDIR:=KMAIN |
|
183 endif |
|
184 |
|
185 ifneq ($(CALLDLLENTRYPOINTS),) |
|
186 ROMFILETYPE:=dll |
|
187 endif |
|
188 ifeq ($(ROMFILETYPE),primary) |
|
189 ABIDIR:=KMAIN |
|
190 endif |
|
191 |
|
192 endef |
|
193 |
|
194 ## End of ROMFILE macro ############################## |
|
195 |
|
196 ## Macros for writing FLMs without needing to know eval |
|
197 |
|
198 # declaring targets as RELEASABLE, for example, |
|
199 # |
|
200 # $(call raptor_release,$(TARGET1) $(TARGET2),RESOURCE) |
|
201 # |
|
202 # the optional type (RESOURCE) can be one of, |
|
203 # EXPORT RESOURCE BITMAP STRINGTABLE ARCHIVE |
|
204 # |
|
205 # no argument means just a default (binary) releasable. |
|
206 # |
|
207 define raptor_release |
|
208 $(eval $(call outputWhatLog,$1,$2)) |
|
209 endef |
|
210 |
|
211 # declaring things that need to be cleaned. |
|
212 # |
|
213 # any files which are generated but are not RELEASABLE should be listed |
|
214 # using this macro, for example, |
|
215 # |
|
216 # $(call raptor_clean,$(OBJECT_FILES)) |
|
217 # |
|
218 define raptor_clean |
|
219 $(eval $(call GenerateStandardCleanTarget,$1)) |
|
220 endef |
|
221 |
|
222 endif |
|
223 # end of metaflm |
|
224 ## END TEST BATCH FILES MACRO |