150 |
150 |
151 ifneq ($(NO_DEPEND_GENERATE),) |
151 ifneq ($(NO_DEPEND_GENERATE),) |
152 # This version minimises the size of dependency files, to contain only .mbg and .rsg deps. |
152 # This version minimises the size of dependency files, to contain only .mbg and .rsg deps. |
153 # It allows resources to be built in the right order but doesn't impose the weight of |
153 # It allows resources to be built in the right order but doesn't impose the weight of |
154 # of full dependency information which can overwhelm make in large builds. |
154 # of full dependency information which can overwhelm make in large builds. |
155 # The strategy is to filter out lines (apart from the target line which is the first) which don't have .rsg or |
155 # The strategy is filter lines which don't have .rsg or |
156 # .mbg dependencies in them. The first line can sometimes not contain the target but |
156 # .mbg dependencies in them and if to sift eah line to leave out non-relevant things like |
157 # have a lonely "\" so we use a pattern to recognise the target line in order not to get confused. |
157 # other header files, .hrh files etc. In the end we don't print anything at all if we |
158 DEPENDENCY_CORRECTOR:={ $(GNUGREP) -E " ([^ /]+)\.((rsg)|(mbg))" | $(GNUSED) -r 's%([^ ]*\.[^rm ][^sb ][^g ])%%g;s%[\\ ]+% %g' | { DEPS=''; read L; while [ $$$$? -eq 0 ]; do DEPS="$$$${DEPS} $$$$L"; read L; done; DEPTXT="$$$$RPP: \\\\\n"; DEPCOUNT=0; for i in $$$${DEPS}; do DEPTXT="$$$$DEPTXT \$$$$(EPOCROOT)/epoc32/include/$$$$i \\\\\n"; (( DEPCOUNT += 1 )) ; done; if [ $$$$DEPCOUNT -ne 0 ]; then echo -e "$$$${DEPTXT%%\\\\\\n}\n"; fi ; } ; } |
158 # did not find the target. |
|
159 |
|
160 define DEPENDENCY_CORRECTOR |
|
161 { set +x; $(GNUSED) -rn '\% ([^ /]+)\.((rsg)|(mbg))%I {y/\\/ /;p;}' | \ |
|
162 { \ |
|
163 DEPTXT="$$$$RPP: \\\\\n"; \ |
|
164 DEPCOUNT=0; \ |
|
165 DEPS=''; read L; \ |
|
166 while [ $$$$? -eq 0 ]; do \ |
|
167 for i in $$$${L}; do \ |
|
168 if [[ ( "$$$${i%%.[Rr][Ss][Gg]}" != "$$$$i" || "$$$${i%%.[Mm][Bb][Gg]}" != "$$$$i" ) && ( "$$$${i:1:1}" != ':' && "$$$${i:0:1}" != '/' ) ]]; then \ |
|
169 DEPTXT="$$$$DEPTXT \$$$$(EPOCROOT)/epoc32/include/$$$$i \\\\\n"; \ |
|
170 (( DEPCOUNT += 1 )) ; \ |
|
171 fi; \ |
|
172 done; \ |
|
173 read L; \ |
|
174 done; \ |
|
175 if [ $$$$DEPCOUNT -ne 0 ]; then echo -e "$$$${DEPTXT%%\\\\\\n}\n"; fi ;\ |
|
176 } ;\ |
|
177 } |
|
178 endef |
|
179 |
159 else |
180 else |
160 # This can correct the dependencies by assuming that the file will be in epoc32\include as this is the default |
181 # This can correct the dependencies by assuming that the file will be in epoc32\include as this is the default |
161 DEPENDENCY_CORRECTOR:=$(GNUSED) -r 's% ([^ \/]+\.((rsg)|(mbg)))% $(EPOCROOT)\/epoc32\/include\/\1%ig' |
182 DEPENDENCY_CORRECTOR:=$(GNUSED) -r 's% ([^ \/]+\.((rsg)|(mbg)))% $(EPOCROOT)\/epoc32\/include\/\1%ig' |
162 endif |
183 endif |
163 |
184 |
203 endef # preprocessresource # |
224 endef # preprocessresource # |
204 |
225 |
205 ############################################################################### |
226 ############################################################################### |
206 define copyresource |
227 define copyresource |
207 # $(1) is the source |
228 # $(1) is the source |
208 # $(2) is the destination |
229 # $(2) is the space separated list of destinations which must be filenames |
209 |
230 |
210 RELEASABLES:=$$(RELEASABLES) $(2) |
231 RELEASABLES:=$$(RELEASABLES) $(2) |
|
232 |
211 $(if $(TARGET_$(call sanitise,$2)),,$(eval TARGET_$(call sanitise,$2):=1)$(info <copy source='$1'>$2</copy>)) |
233 $(if $(TARGET_$(call sanitise,$2)),,$(eval TARGET_$(call sanitise,$2):=1)$(info <copy source='$1'>$2</copy>)) |
212 |
234 |
213 |
|
214 |
|
215 endef # copyresource # |
235 endef # copyresource # |
216 |
236 |
217 ############################################################################### |
237 ############################################################################### |
218 define generateresource |
238 define generateresource |
219 |
239 |
258 define generateresourceheader |
278 define generateresourceheader |
259 # $(1) is the resource header (eg. /epoc32/include/a.rsg) |
279 # $(1) is the resource header (eg. /epoc32/include/a.rsg) |
260 # $(2) is the preprocessed resource to make it from |
280 # $(2) is the preprocessed resource to make it from |
261 # $(3) is the language to use (eg. sc) |
281 # $(3) is the language to use (eg. sc) |
262 |
282 |
263 RELEASABLES:= $$(RELEASABLES) $(1) |
283 RELEASABLES:= $$(RELEASABLES) $(1) |
264 |
284 |
265 ifeq ($(TARGET_$(call sanitise,$1)),) |
285 ifeq ($(TARGET_$(call sanitise,$1)),) |
266 TARGET_$(call sanitise,$1):=1 |
286 TARGET_$(call sanitise,$1):=1 |
267 $(if $(FLMDEBUG),$(info <debug>resourceheader: $(1) from $(2) LANG:$(3)</debug>)) |
287 $(if $(FLMDEBUG),$(info <debug>resourceheader: $(1) from $(2) LANG:$(3)</debug>)) |
268 |
288 |