author | timothy.murphy@nokia.com |
Wed, 26 May 2010 15:13:02 +0100 | |
branch | fix |
changeset 576 | 0351d04638fa |
parent 575 | e8d124df4a90 |
child 577 | 70a350fada5a |
permissions | -rw-r--r-- |
394 | 1 |
# Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 | 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 |
# Function Like Makefile (FLM) to create a resource header (.rsg) |
|
15 |
# and resource files (.rsc, .r01, .r02 etc.) |
|
16 |
# |
|
17 |
# |
|
18 |
||
19 |
## Parameters that are expected: |
|
20 |
# TARGET |
|
21 |
# TARGETPATH |
|
22 |
# LANGUAGES |
|
23 |
# HEADER |
|
24 |
# HEADERONLY |
|
25 |
# EPOCROOT |
|
26 |
# MMPDEFS |
|
27 |
# PRODUCT_INCLUDE |
|
28 |
# SYSTEMINCLUDE |
|
29 |
# USERINCLUDE |
|
30 |
# GNUCPP |
|
31 |
# GNUSED |
|
32 |
# RCOMP |
|
33 |
# OUTPUTPATH |
|
34 |
# SOURCE |
|
35 |
# BINCOPYDIRS |
|
36 |
||
37 |
||
38 |
# The rss is pre-processed once for each language and results |
|
39 |
# in a file with extension r$(LANGUAGE) where $(LANGUAGE) is |
|
40 |
# either "sc" or a 2 (or more) digit number. |
|
41 |
ifneq ($(TARGETPATH),) |
|
42 |
RSCDIR:=$(subst //,/,$(EPOCROOT)/epoc32/data/z/$(TARGETPATH)) |
|
43 |
else |
|
44 |
RSCDIR:=$(subst //,/,$(EPOCROOT)/epoc32/data) |
|
45 |
endif |
|
46 |
RESBASE:=$(RSCDIR)/$(TARGET_lower) |
|
47 |
||
48 |
# Ensure that RELEASABLES and CLEANTARGETS cannot expand indefinitely in successive calls to this flm: |
|
49 |
CLEANTARGETS:= |
|
50 |
RELEASABLES:= |
|
532
1083c9a3a7cf
minimising dependencies might have helped after all by ecluding something that's getting updated that maybe shouldn't. Try it out again.
timothy.murphy@nokia.com
parents:
530
diff
changeset
|
51 |
CREATABLEPATHS:= |
3 | 52 |
|
53 |
# There is only one resource header (.rsg) file and we only |
|
54 |
# make that if we are asked. |
|
55 |
RSGDIR:=$(EPOCROOT)/epoc32/include |
|
530
c708fcd8e968
fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents:
529
diff
changeset
|
56 |
# If there are multiple LANGUAGES then it is the last one in the list |
c708fcd8e968
fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents:
529
diff
changeset
|
57 |
# which produces the header. |
c708fcd8e968
fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents:
529
diff
changeset
|
58 |
HEADLANG:=$(lastword $(LANGUAGES:SC=sc)) |
3 | 59 |
ifneq ($(or $(HEADER),$(HEADERONLY)),) |
60 |
RESOURCEHEADER:=$(RSGDIR)/$(HEADER) |
|
61 |
||
62 |
else |
|
530
c708fcd8e968
fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents:
529
diff
changeset
|
63 |
RESOURCEHEADER:= |
3 | 64 |
endif |
65 |
||
66 |
# we create intermediate .rpp and .d files |
|
536 | 67 |
INTERBASE_TMP:=$(OUTPUTPATH)/$(TARGET_lower)_$(notdir $(basename $(SOURCE))) |
3 | 68 |
|
542
80c21f026f0a
fix: switch rfi file creation back on
timothy.murphy@nokia.com
parents:
539
diff
changeset
|
69 |
|
3 | 70 |
# common pre-processor options |
471
8786668610ae
fix: revert -iquote since older cpps don't understand it
timothy.murphy@nokia.com
parents:
470
diff
changeset
|
71 |
|
8786668610ae
fix: revert -iquote since older cpps don't understand it
timothy.murphy@nokia.com
parents:
470
diff
changeset
|
72 |
# We really should be using -iquote with a recent cpp. This is a note for when we do update: |
8786668610ae
fix: revert -iquote since older cpps don't understand it
timothy.murphy@nokia.com
parents:
470
diff
changeset
|
73 |
#CPPOPT:=-nostdinc -undef -Wno-trigraphs -D_UNICODE -include $(PRODUCT_INCLUDE)\ |
8786668610ae
fix: revert -iquote since older cpps don't understand it
timothy.murphy@nokia.com
parents:
470
diff
changeset
|
74 |
# -I$(dir $(SOURCE)) $(foreach I, $(USERINCLUDE),-iquote $(I) ) $(foreach J,$(SYSTEMINCLUDE),-I $(J) ) |
8786668610ae
fix: revert -iquote since older cpps don't understand it
timothy.murphy@nokia.com
parents:
470
diff
changeset
|
75 |
|
393
629079c72ee4
Suppress trigraph warnings in resource file preprocessing.
Jon Chatten
parents:
5
diff
changeset
|
76 |
CPPOPT:=-nostdinc -undef -Wno-trigraphs -D_UNICODE -include $(PRODUCT_INCLUDE)\ |
471
8786668610ae
fix: revert -iquote since older cpps don't understand it
timothy.murphy@nokia.com
parents:
470
diff
changeset
|
77 |
-I$(dir $(SOURCE)) $(foreach I, $(USERINCLUDE),-I$(I) ) -I- $(foreach J,$(SYSTEMINCLUDE),-I$(J) ) |
3 | 78 |
|
549
d633be326c9f
fix: depcrunch was using re.match where re.findall was what was wanted. Add a test.
timothy.murphy@nokia.com
parents:
547
diff
changeset
|
79 |
CREATABLEPATHS:=$(CREATABLEPATHS) $(RSCDIR) $(RSGDIR) $(OUTPUTPATH) |
3 | 80 |
|
470
f45853a5ce36
comments: better commenting in resource.flm
timothy.murphy@nokia.com
parents:
466
diff
changeset
|
81 |
# We intend to generate the resource in an intermediate location and copy to the targetpath to |
f45853a5ce36
comments: better commenting in resource.flm
timothy.murphy@nokia.com
parents:
466
diff
changeset
|
82 |
# ensure that when the "same" resource is built into separare target paths, it doesn't have to be |
f45853a5ce36
comments: better commenting in resource.flm
timothy.murphy@nokia.com
parents:
466
diff
changeset
|
83 |
# completely recreated each time - just copied. |
466
b9e5cf94aac3
fix: don't regenrate resources for WINSCW
timothy.murphy@nokia.com
parents:
465
diff
changeset
|
84 |
RSCCOPYDIRS:=$(RSCDIR) |
470
f45853a5ce36
comments: better commenting in resource.flm
timothy.murphy@nokia.com
parents:
466
diff
changeset
|
85 |
|
3 | 86 |
# additional binary resource copies performed based on BINCOPYDIRS |
87 |
ifneq ($(BINCOPYDIRS),) |
|
464
a6aa62a0998d
fix: prevent regeneration of resources for winscw after an armv5 build
timothy.murphy@nokia.com
parents:
394
diff
changeset
|
88 |
RSCCOPYDIRS:=$(RSCCOPYDIRS) $(subst //,/,$(patsubst %,%/$(if $(TARGETPATH),/z/$(TARGETPATH),),$(BINCOPYDIRS))) |
3 | 89 |
endif |
464
a6aa62a0998d
fix: prevent regeneration of resources for winscw after an armv5 build
timothy.murphy@nokia.com
parents:
394
diff
changeset
|
90 |
CREATABLEPATHS:=$(CREATABLEPATHS) $(RSCCOPYDIRS) |
3 | 91 |
|
92 |
############################################################################### |
|
462
7f12c652f36d
Fix: Resource stage parse performance affected by huge size of included dependency files
timothy.murphy@nokia.com
parents:
394
diff
changeset
|
93 |
|
7f12c652f36d
Fix: Resource stage parse performance affected by huge size of included dependency files
timothy.murphy@nokia.com
parents:
394
diff
changeset
|
94 |
|
3 | 95 |
define preprocessresource |
573
e2b5644641c6
fix: ensure that intermediate resource filenames are unique in some uncommon situations
timothy.murphy@nokia.com
parents:
551
diff
changeset
|
96 |
# $1 is the RPPFILE (eg. /epoc32/build/xxx/b_sc.rpp) |
e2b5644641c6
fix: ensure that intermediate resource filenames are unique in some uncommon situations
timothy.murphy@nokia.com
parents:
551
diff
changeset
|
97 |
# $2 is the LANGUAGE (eg. sc or 01 or 02 ...) |
e2b5644641c6
fix: ensure that intermediate resource filenames are unique in some uncommon situations
timothy.murphy@nokia.com
parents:
551
diff
changeset
|
98 |
# $3 is the "primary" language on which all the others depend |
3 | 99 |
|
100 |
ifeq ($(TARGET_$(call sanitise,$1)),) |
|
101 |
TARGET_$(call sanitise,$1):=1 |
|
573
e2b5644641c6
fix: ensure that intermediate resource filenames are unique in some uncommon situations
timothy.murphy@nokia.com
parents:
551
diff
changeset
|
102 |
$(if $(FLMDEBUG),$$(info <debug>preprocessresource: $1 LANG:$2 dep $3</debug>)) |
3 | 103 |
|
462
7f12c652f36d
Fix: Resource stage parse performance affected by huge size of included dependency files
timothy.murphy@nokia.com
parents:
394
diff
changeset
|
104 |
|
466
b9e5cf94aac3
fix: don't regenrate resources for WINSCW
timothy.murphy@nokia.com
parents:
465
diff
changeset
|
105 |
# Correct dependency information when a header file can't be found. |
b9e5cf94aac3
fix: don't regenrate resources for WINSCW
timothy.murphy@nokia.com
parents:
465
diff
changeset
|
106 |
# If the c preprocessor can't find a dependency it appears as it did in the #include statement |
b9e5cf94aac3
fix: don't regenrate resources for WINSCW
timothy.murphy@nokia.com
parents:
465
diff
changeset
|
107 |
# e.g. "filename.mbg" or "filename.rsg" in the dependency file. |
532
1083c9a3a7cf
minimising dependencies might have helped after all by ecluding something that's getting updated that maybe shouldn't. Try it out again.
timothy.murphy@nokia.com
parents:
530
diff
changeset
|
108 |
|
1083c9a3a7cf
minimising dependencies might have helped after all by ecluding something that's getting updated that maybe shouldn't. Try it out again.
timothy.murphy@nokia.com
parents:
530
diff
changeset
|
109 |
ifneq ($(NO_DEPEND_GENERATE),) |
1083c9a3a7cf
minimising dependencies might have helped after all by ecluding something that's getting updated that maybe shouldn't. Try it out again.
timothy.murphy@nokia.com
parents:
530
diff
changeset
|
110 |
# This version minimises the size of dependency files, to contain only .mbg and .rsg deps. |
1083c9a3a7cf
minimising dependencies might have helped after all by ecluding something that's getting updated that maybe shouldn't. Try it out again.
timothy.murphy@nokia.com
parents:
530
diff
changeset
|
111 |
# It allows resources to be built in the right order but doesn't impose the weight of |
1083c9a3a7cf
minimising dependencies might have helped after all by ecluding something that's getting updated that maybe shouldn't. Try it out again.
timothy.murphy@nokia.com
parents:
530
diff
changeset
|
112 |
# of full dependency information which can overwhelm make in large builds. |
542
80c21f026f0a
fix: switch rfi file creation back on
timothy.murphy@nokia.com
parents:
539
diff
changeset
|
113 |
# The strategy is filter lines which don't have .rsg or .mbg dependencies in them and |
80c21f026f0a
fix: switch rfi file creation back on
timothy.murphy@nokia.com
parents:
539
diff
changeset
|
114 |
# to sift each line to leave out non-relevant things like other header files, .hrh |
80c21f026f0a
fix: switch rfi file creation back on
timothy.murphy@nokia.com
parents:
539
diff
changeset
|
115 |
# files etc. In the end don't print anything at all if we did not find the target. |
534
3b10c85868b1
fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents:
533
diff
changeset
|
116 |
|
3b10c85868b1
fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents:
533
diff
changeset
|
117 |
define DEPENDENCY_CORRECTOR |
546
e6381a1f4952
fix tests for resources. Add python dependency manipulation because it's understandable to humans.
timothy.murphy@nokia.com
parents:
545
diff
changeset
|
118 |
{ $(DEPCRUNCH) --extensions rsg,mbg --assume '$$$$(EPOCROOT)/epoc32/include' ; } |
534
3b10c85868b1
fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents:
533
diff
changeset
|
119 |
endef |
3b10c85868b1
fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents:
533
diff
changeset
|
120 |
|
532
1083c9a3a7cf
minimising dependencies might have helped after all by ecluding something that's getting updated that maybe shouldn't. Try it out again.
timothy.murphy@nokia.com
parents:
530
diff
changeset
|
121 |
else |
1083c9a3a7cf
minimising dependencies might have helped after all by ecluding something that's getting updated that maybe shouldn't. Try it out again.
timothy.murphy@nokia.com
parents:
530
diff
changeset
|
122 |
# This can correct the dependencies by assuming that the file will be in epoc32\include as this is the default |
530
c708fcd8e968
fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents:
529
diff
changeset
|
123 |
DEPENDENCY_CORRECTOR:=$(GNUSED) -r 's% ([^ \/]+\.((rsg)|(mbg)))% $(EPOCROOT)\/epoc32\/include\/\1%ig' |
532
1083c9a3a7cf
minimising dependencies might have helped after all by ecluding something that's getting updated that maybe shouldn't. Try it out again.
timothy.murphy@nokia.com
parents:
530
diff
changeset
|
124 |
endif |
462
7f12c652f36d
Fix: Resource stage parse performance affected by huge size of included dependency files
timothy.murphy@nokia.com
parents:
394
diff
changeset
|
125 |
|
7f12c652f36d
Fix: Resource stage parse performance affected by huge size of included dependency files
timothy.murphy@nokia.com
parents:
394
diff
changeset
|
126 |
|
573
e2b5644641c6
fix: ensure that intermediate resource filenames are unique in some uncommon situations
timothy.murphy@nokia.com
parents:
551
diff
changeset
|
127 |
ifeq "$1" "$3" |
530
c708fcd8e968
fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents:
529
diff
changeset
|
128 |
RESOURCE_DEPS:: $1.d |
536 | 129 |
|
530
c708fcd8e968
fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents:
529
diff
changeset
|
130 |
$1.d: $(SOURCE) |
3 | 131 |
$(call startrule,resourcedependencies,FORCESUCCESS) \ |
573
e2b5644641c6
fix: ensure that intermediate resource filenames are unique in some uncommon situations
timothy.murphy@nokia.com
parents:
551
diff
changeset
|
132 |
$(GNUCPP) -DLANGUAGE_$2 -DLANGUAGE_$(subst sc,SC,$2) $(call makemacrodef,-D,$(MMPDEFS))\ |
530
c708fcd8e968
fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents:
529
diff
changeset
|
133 |
$(CPPOPT) $(SOURCE) -M -MG -MT"$1" | \ |
474
d22e74b2b0f8
fix: resource dependencies sometimes not generated because of too-early expansion of variable.
timothy.murphy@nokia.com
parents:
472
diff
changeset
|
134 |
$$(DEPENDENCY_CORRECTOR) >$$@ \ |
3 | 135 |
$(call endrule,resourcedependencies) |
136 |
||
536 | 137 |
$1 : $1.d |
532
1083c9a3a7cf
minimising dependencies might have helped after all by ecluding something that's getting updated that maybe shouldn't. Try it out again.
timothy.murphy@nokia.com
parents:
530
diff
changeset
|
138 |
|
536 | 139 |
else |
573
e2b5644641c6
fix: ensure that intermediate resource filenames are unique in some uncommon situations
timothy.murphy@nokia.com
parents:
551
diff
changeset
|
140 |
$1 : $3 |
530
c708fcd8e968
fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents:
529
diff
changeset
|
141 |
endif |
536 | 142 |
|
143 |
$1: |
|
3 | 144 |
$(call startrule,resourcepreprocess,FORCESUCCESS) \ |
573
e2b5644641c6
fix: ensure that intermediate resource filenames are unique in some uncommon situations
timothy.murphy@nokia.com
parents:
551
diff
changeset
|
145 |
$(GNUCPP) -C -DLANGUAGE_$2 -DLANGUAGE_$(subst sc,SC,$2) $(call makemacrodef,-D,$(MMPDEFS))\ |
3 | 146 |
$(CPPOPT) $(SOURCE) -o $$@ \ |
147 |
$(call endrule,resourcepreprocess) |
|
487
fa72431a3f1a
fix: stop including dep files in the depfile generation stage. Remove other unnecessary stuff from RESOURCE_DEPS
timothy.murphy@nokia.com
parents:
486
diff
changeset
|
148 |
endif |
3 | 149 |
|
530
c708fcd8e968
fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents:
529
diff
changeset
|
150 |
CLEANTARGETS:= $$(CLEANTARGETS) $1 |
3 | 151 |
|
536 | 152 |
ifeq "$(MAKEFILE_GROUP)" "RESOURCE" |
573
e2b5644641c6
fix: ensure that intermediate resource filenames are unique in some uncommon situations
timothy.murphy@nokia.com
parents:
551
diff
changeset
|
153 |
ifeq "$1" "$3" |
530
c708fcd8e968
fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents:
529
diff
changeset
|
154 |
$(eval DEPENDFILENAME:=$1.d) |
c708fcd8e968
fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents:
529
diff
changeset
|
155 |
$(eval DEPENDFILE:=$(wildcard $(DEPENDFILENAME))) |
c708fcd8e968
fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents:
529
diff
changeset
|
156 |
|
c708fcd8e968
fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents:
529
diff
changeset
|
157 |
CLEANTARGETS:=$$(CLEANTARGETS) $(DEPENDFILENAME) |
c708fcd8e968
fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents:
529
diff
changeset
|
158 |
ifneq "$(DEPENDFILE)" "" |
c708fcd8e968
fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents:
529
diff
changeset
|
159 |
ifeq "$(filter %CLEAN,$(call uppercase,$(MAKECMDGOALS)))" "" |
c708fcd8e968
fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents:
529
diff
changeset
|
160 |
ifeq "$(MAKEFILE_GROUP)" "RESOURCE" |
536 | 161 |
-include $(DEPENDFILE) |
530
c708fcd8e968
fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents:
529
diff
changeset
|
162 |
endif |
466
b9e5cf94aac3
fix: don't regenrate resources for WINSCW
timothy.murphy@nokia.com
parents:
465
diff
changeset
|
163 |
endif |
3 | 164 |
endif |
165 |
endif |
|
166 |
||
167 |
endif |
|
168 |
endef # preprocessresource # |
|
169 |
||
170 |
############################################################################### |
|
171 |
define copyresource |
|
172 |
# $(1) is the source |
|
534
3b10c85868b1
fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents:
533
diff
changeset
|
173 |
# $(2) is the space separated list of destinations which must be filenames |
3 | 174 |
|
533
408bfff46ad7
fix performance: copy resources in the frontend. Helps cluster builds since remote copying is inefficient.
timothy.murphy@nokia.com
parents:
532
diff
changeset
|
175 |
RELEASABLES:=$$(RELEASABLES) $(2) |
534
3b10c85868b1
fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents:
533
diff
changeset
|
176 |
|
547
9fe7d0ab0f8f
fixes for review comments. better docs. copyrights. make copy filter more modular, change <copy> tag to <filtercopy>
timothy.murphy@nokia.com
parents:
546
diff
changeset
|
177 |
$(info <finalcopy source='$1'>$2</finalcopy>) |
533
408bfff46ad7
fix performance: copy resources in the frontend. Helps cluster builds since remote copying is inefficient.
timothy.murphy@nokia.com
parents:
532
diff
changeset
|
178 |
|
3 | 179 |
endef # copyresource # |
180 |
||
181 |
############################################################################### |
|
182 |
define generateresource |
|
183 |
||
573
e2b5644641c6
fix: ensure that intermediate resource filenames are unique in some uncommon situations
timothy.murphy@nokia.com
parents:
551
diff
changeset
|
184 |
# $(1) is the intermediate resource filename with path e.g. /a/b/resource.rsc |
3 | 185 |
# $(2) is the preprocessed resource to make it from |
186 |
# $(3) is the language e.g. sc or 01 or 02 |
|
573
e2b5644641c6
fix: ensure that intermediate resource filenames are unique in some uncommon situations
timothy.murphy@nokia.com
parents:
551
diff
changeset
|
187 |
# $(4) is the resource filename without path |
3 | 188 |
|
189 |
||
190 |
ifeq ($(TARGET_$(call sanitise,$1)),) |
|
191 |
TARGET_$(call sanitise,$1):=1 |
|
192 |
||
483
941b2742ee49
Fix a copyright date. Make sure all FLMBDEBUG usage is wrapped in <debug> tags.
timothy.murphy@nokia.com
parents:
479
diff
changeset
|
193 |
$(if $(FLMDEBUG),$(info <debug>generateresource: $(1) from $(2) LANG:$(3)</debug>),) |
941b2742ee49
Fix a copyright date. Make sure all FLMBDEBUG usage is wrapped in <debug> tags.
timothy.murphy@nokia.com
parents:
479
diff
changeset
|
194 |
$(if $(FLMDEBUG),$(info <debug>generateresource: copies: $(sort $(patsubst %,%/$(notdir $(1)),$(RSCCOPYDIRS)))</debug>)) |
3 | 195 |
|
475 | 196 |
CLEANTARGETS:=$$(CLEANTARGETS) $(1) |
3 | 197 |
|
198 |
RESOURCE:: $(1) |
|
199 |
||
200 |
$(1): $(2) $(RCOMP) |
|
201 |
$(call startrule,resourcecompile,FORCESUCCESS) \ |
|
533
408bfff46ad7
fix performance: copy resources in the frontend. Helps cluster builds since remote copying is inefficient.
timothy.murphy@nokia.com
parents:
532
diff
changeset
|
202 |
$(RCOMP) -m045,046,047 -u -o$(1) -s$(2) \ |
3 | 203 |
$(call endrule,resourcecompile) |
204 |
||
205 |
endif |
|
471
8786668610ae
fix: revert -iquote since older cpps don't understand it
timothy.murphy@nokia.com
parents:
470
diff
changeset
|
206 |
|
3 | 207 |
# Whether or not we have generated this resource for some other variant, check if there |
208 |
# are any new copies to be made for this variant. e.g. winscw requires that we make |
|
475 | 209 |
# some extra copies. We tried to copy after running rcomp itself but we still need these |
542
80c21f026f0a
fix: switch rfi file creation back on
timothy.murphy@nokia.com
parents:
539
diff
changeset
|
210 |
# targets for the sake of dependencies or, for example, if someone merely adds a new copy |
475 | 211 |
# when the resource is up-to-date |
3 | 212 |
|
573
e2b5644641c6
fix: ensure that intermediate resource filenames are unique in some uncommon situations
timothy.murphy@nokia.com
parents:
551
diff
changeset
|
213 |
$(call copyresource,$1,$(sort $(patsubst %,%/$4,$(RSCCOPYDIRS)))) |
533
408bfff46ad7
fix performance: copy resources in the frontend. Helps cluster builds since remote copying is inefficient.
timothy.murphy@nokia.com
parents:
532
diff
changeset
|
214 |
|
3 | 215 |
|
216 |
# individual source file compilation |
|
217 |
SOURCETARGET_$(call sanitise,$(SOURCE)): $(1) |
|
218 |
||
219 |
endef # generateresource |
|
220 |
||
221 |
||
222 |
############################################################################### |
|
223 |
define generateresourceheader |
|
224 |
# $(1) is the resource header (eg. /epoc32/include/a.rsg) |
|
225 |
# $(2) is the preprocessed resource to make it from |
|
226 |
# $(3) is the language to use (eg. sc) |
|
227 |
||
534
3b10c85868b1
fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents:
533
diff
changeset
|
228 |
RELEASABLES:= $$(RELEASABLES) $(1) |
3 | 229 |
|
230 |
ifeq ($(TARGET_$(call sanitise,$1)),) |
|
231 |
TARGET_$(call sanitise,$1):=1 |
|
466
b9e5cf94aac3
fix: don't regenrate resources for WINSCW
timothy.murphy@nokia.com
parents:
465
diff
changeset
|
232 |
$(if $(FLMDEBUG),$(info <debug>resourceheader: $(1) from $(2) LANG:$(3)</debug>)) |
3 | 233 |
|
234 |
RESOURCE:: $(1) |
|
235 |
||
236 |
$(1): $(2) $(RCOMP) |
|
237 |
$(call startrule,resourceheader,FORCESUCCESS) \ |
|
238 |
$(RCOMP) -m045,046,047 -u -h$(1) -s$(2) \ |
|
239 |
$(call endrule,resourceheader) |
|
240 |
||
241 |
endif |
|
242 |
||
243 |
||
244 |
# individual source file compilation |
|
245 |
SOURCETARGET_$(call sanitise,$(SOURCE)): $(1) |
|
246 |
||
247 |
endef |
|
248 |
||
249 |
############################################################################### |
|
250 |
## call the generator |
|
251 |
||
252 |
# We always create at least the header |
|
253 |
# even if we sometimes don't create the resources |
|
254 |
ifneq ($(RESOURCEHEADER),) |
|
536 | 255 |
$(eval $(call generateresourceheader,$(RESOURCEHEADER),$(INTERBASE_TMP)_$(HEADLANG).rpp,$(HEADLANG))) |
3 | 256 |
endif |
257 |
||
530
c708fcd8e968
fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents:
529
diff
changeset
|
258 |
# The one on which the others will depend i.e. they will |
c708fcd8e968
fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents:
529
diff
changeset
|
259 |
# "sit in it's dependency slipstream" or in other words |
c708fcd8e968
fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents:
529
diff
changeset
|
260 |
# We only have to make one dependency file because all of |
542
80c21f026f0a
fix: switch rfi file creation back on
timothy.murphy@nokia.com
parents:
539
diff
changeset
|
261 |
# the other languages will benefit from the dependency file |
80c21f026f0a
fix: switch rfi file creation back on
timothy.murphy@nokia.com
parents:
539
diff
changeset
|
262 |
# belonging to this language. |
536 | 263 |
PRIMARYRPPFILE:=$(INTERBASE_TMP)_$(HEADLANG).rpp |
3 | 264 |
ifeq ($(HEADERONLY),) |
265 |
# generate a resource file for each language |
|
266 |
# For sc we generate $(RESBASE).rsc and define LANGUAGE_SC and LANGUAGE_sc. |
|
573
e2b5644641c6
fix: ensure that intermediate resource filenames are unique in some uncommon situations
timothy.murphy@nokia.com
parents:
551
diff
changeset
|
267 |
$(foreach L,$(LANGUAGES:SC=sc),$(eval $(call preprocessresource,$(INTERBASE_TMP)_$(L).rpp,$(L),$(PRIMARYRPPFILE)))) |
487
fa72431a3f1a
fix: stop including dep files in the depfile generation stage. Remove other unnecessary stuff from RESOURCE_DEPS
timothy.murphy@nokia.com
parents:
486
diff
changeset
|
268 |
|
fa72431a3f1a
fix: stop including dep files in the depfile generation stage. Remove other unnecessary stuff from RESOURCE_DEPS
timothy.murphy@nokia.com
parents:
486
diff
changeset
|
269 |
ifeq "$(MAKEFILE_GROUP)" "RESOURCE" |
575
e8d124df4a90
remove unused INTERBASE variable. Use TARGET_lower where it's clearer.
timothy.murphy@nokia.com
parents:
573
diff
changeset
|
270 |
$(foreach L,$(LANGUAGES:SC=sc),$(eval $(call generateresource,$(INTERBASE_TMP).r$(L),$(INTERBASE_TMP)_$(L).rpp,$(L),$(TARGET_lower).r$(L)))) |
487
fa72431a3f1a
fix: stop including dep files in the depfile generation stage. Remove other unnecessary stuff from RESOURCE_DEPS
timothy.murphy@nokia.com
parents:
486
diff
changeset
|
271 |
endif |
3 | 272 |
else |
273 |
# No resources are going to be made so unless we specifically ask for it, there will be no |
|
274 |
# preprocessed file from which to create the header: |
|
275 |
||
536 | 276 |
$(eval $(call preprocessresource,$(INTERBASE_TMP)_$(HEADLANG).rpp,,$(HEADLANG),$(PRIMARYRPPFILE))) |
3 | 277 |
|
278 |
endif |
|
279 |
||
280 |
############################################################################### |
|
281 |
## .rfi generation in support of the gccxml build |
|
282 |
## Note that .rfi files are created from the dependency files generated from preprocessing resources to create .rpp files |
|
283 |
ifneq ($(RFIFILE),) |
|
284 |
RESOURCE:: $(RFIFILE) |
|
285 |
RELEASABLES:=$(RELEASABLES) $(RFIFILE) |
|
536 | 286 |
CREATABLEPATHS:=$(CREATABLEPATHS) $(dir $(RFIFILE))/ |
3 | 287 |
|
536 | 288 |
RPPFILES:=$(foreach L,$(LANGUAGES:SC=sc),$(INTERBASE_TMP)_$(L).rpp) |
543
61f929e4229d
fix: rfi files now only consist of one dependency file for all resources
timothy.murphy@nokia.com
parents:
542
diff
changeset
|
289 |
$(eval $(call generaterfifile,$(RFIFILE),$(RPPFILES),$(PRIMARYRPPFILE).d)) |
3 | 290 |
endif |
291 |
||
292 |
||
293 |
## Clean up |
|
5 | 294 |
$(call raptor_clean,$(CLEANTARGETS)) |
3 | 295 |
# make the output directories while reading makefile - some build engines prefer this |
296 |
$(call makepath,$(CREATABLEPATHS)) |
|
297 |
||
5 | 298 |
# for the --what option and the log file |
3 | 299 |
RELEASABLES:=$(RELEASABLES) $(DESTRPP) $(INFOFILE) |
5 | 300 |
$(call raptor_release,$(RELEASABLES),RESOURCE) |
3 | 301 |