92 |
92 |
93 ############################################################################### |
93 ############################################################################### |
94 |
94 |
95 |
95 |
96 define preprocessresource |
96 define preprocessresource |
97 # $(1) is the RPPFILE (eg. /epoc32/build/xxx/b_sc.rpp) |
97 # $1 is the RPPFILE (eg. /epoc32/build/xxx/b_sc.rpp) |
98 # $(2) is the related RESOURCEFILE if any (eg. /a/b.rsc) |
98 # $2 is the LANGUAGE (eg. sc or 01 or 02 ...) |
99 # $(3) is the LANGUAGE (eg. sc or 01 or 02 ...) |
99 # $3 is the "primary" language on which all the others depend |
100 # $(4) is the "primary" language on which all the others depend |
|
101 |
100 |
102 ifeq ($(TARGET_$(call sanitise,$1)),) |
101 ifeq ($(TARGET_$(call sanitise,$1)),) |
103 TARGET_$(call sanitise,$1):=1 |
102 TARGET_$(call sanitise,$1):=1 |
104 $(if $(FLMDEBUG),$$(info <debug>preprocessresource: $(1) for $(2) LANG:$(3) dep $(4)</debug>)) |
103 $(if $(FLMDEBUG),$$(info <debug>preprocessresource: $1 LANG:$2 dep $3</debug>)) |
105 |
104 |
106 |
105 |
107 # Correct dependency information when a header file can't be found. |
106 # Correct dependency information when a header file can't be found. |
108 # If the c preprocessor can't find a dependency it appears as it did in the #include statement |
107 # If the c preprocessor can't find a dependency it appears as it did in the #include statement |
109 # e.g. "filename.mbg" or "filename.rsg" in the dependency file. |
108 # e.g. "filename.mbg" or "filename.rsg" in the dependency file. |
124 # This can correct the dependencies by assuming that the file will be in epoc32\include as this is the default |
123 # This can correct the dependencies by assuming that the file will be in epoc32\include as this is the default |
125 DEPENDENCY_CORRECTOR:=$(GNUSED) -r 's% ([^ \/]+\.((rsg)|(mbg)))% $(EPOCROOT)\/epoc32\/include\/\1%ig' |
124 DEPENDENCY_CORRECTOR:=$(GNUSED) -r 's% ([^ \/]+\.((rsg)|(mbg)))% $(EPOCROOT)\/epoc32\/include\/\1%ig' |
126 endif |
125 endif |
127 |
126 |
128 |
127 |
129 ifeq "$1" "$4" |
128 ifeq "$1" "$3" |
130 RESOURCE_DEPS:: $1.d |
129 RESOURCE_DEPS:: $1.d |
131 |
130 |
132 $1.d: $(SOURCE) |
131 $1.d: $(SOURCE) |
133 $(call startrule,resourcedependencies,FORCESUCCESS) \ |
132 $(call startrule,resourcedependencies,FORCESUCCESS) \ |
134 $(GNUCPP) -DLANGUAGE_$(3) -DLANGUAGE_$(subst sc,SC,$3) $(call makemacrodef,-D,$(MMPDEFS))\ |
133 $(GNUCPP) -DLANGUAGE_$2 -DLANGUAGE_$(subst sc,SC,$2) $(call makemacrodef,-D,$(MMPDEFS))\ |
135 $(CPPOPT) $(SOURCE) -M -MG -MT"$1" | \ |
134 $(CPPOPT) $(SOURCE) -M -MG -MT"$1" | \ |
136 $$(DEPENDENCY_CORRECTOR) >$$@ \ |
135 $$(DEPENDENCY_CORRECTOR) >$$@ \ |
137 $(call endrule,resourcedependencies) |
136 $(call endrule,resourcedependencies) |
138 |
137 |
139 $1 : $1.d |
138 $1 : $1.d |
140 |
139 |
141 else |
140 else |
142 $1 : $4 |
141 $1 : $3 |
143 endif |
142 endif |
144 |
143 |
145 $1: |
144 $1: |
146 $(call startrule,resourcepreprocess,FORCESUCCESS) \ |
145 $(call startrule,resourcepreprocess,FORCESUCCESS) \ |
147 $(GNUCPP) -C -DLANGUAGE_$3 -DLANGUAGE_$(subst sc,SC,$(3)) $(call makemacrodef,-D,$(MMPDEFS))\ |
146 $(GNUCPP) -C -DLANGUAGE_$2 -DLANGUAGE_$(subst sc,SC,$2) $(call makemacrodef,-D,$(MMPDEFS))\ |
148 $(CPPOPT) $(SOURCE) -o $$@ \ |
147 $(CPPOPT) $(SOURCE) -o $$@ \ |
149 $(call endrule,resourcepreprocess) |
148 $(call endrule,resourcepreprocess) |
150 endif |
149 endif |
151 |
150 |
152 CLEANTARGETS:= $$(CLEANTARGETS) $1 |
151 CLEANTARGETS:= $$(CLEANTARGETS) $1 |
153 |
152 |
154 ifeq "$(MAKEFILE_GROUP)" "RESOURCE" |
153 ifeq "$(MAKEFILE_GROUP)" "RESOURCE" |
155 ifeq "$1" "$4" |
154 ifeq "$1" "$3" |
156 $(eval DEPENDFILENAME:=$1.d) |
155 $(eval DEPENDFILENAME:=$1.d) |
157 $(eval DEPENDFILE:=$(wildcard $(DEPENDFILENAME))) |
156 $(eval DEPENDFILE:=$(wildcard $(DEPENDFILENAME))) |
158 |
157 |
159 CLEANTARGETS:=$$(CLEANTARGETS) $(DEPENDFILENAME) |
158 CLEANTARGETS:=$$(CLEANTARGETS) $(DEPENDFILENAME) |
160 ifneq "$(DEPENDFILE)" "" |
159 ifneq "$(DEPENDFILE)" "" |
181 endef # copyresource # |
180 endef # copyresource # |
182 |
181 |
183 ############################################################################### |
182 ############################################################################### |
184 define generateresource |
183 define generateresource |
185 |
184 |
186 # $(1) is the resource filename e.g. /a/b/resource.rsc |
185 # $(1) is the intermediate resource filename with path e.g. /a/b/resource.rsc |
187 # $(2) is the preprocessed resource to make it from |
186 # $(2) is the preprocessed resource to make it from |
188 # $(3) is the language e.g. sc or 01 or 02 |
187 # $(3) is the language e.g. sc or 01 or 02 |
|
188 # $(4) is the resource filename without path |
189 |
189 |
190 |
190 |
191 ifeq ($(TARGET_$(call sanitise,$1)),) |
191 ifeq ($(TARGET_$(call sanitise,$1)),) |
192 TARGET_$(call sanitise,$1):=1 |
192 TARGET_$(call sanitise,$1):=1 |
193 |
193 |
209 # are any new copies to be made for this variant. e.g. winscw requires that we make |
209 # are any new copies to be made for this variant. e.g. winscw requires that we make |
210 # some extra copies. We tried to copy after running rcomp itself but we still need these |
210 # some extra copies. We tried to copy after running rcomp itself but we still need these |
211 # targets for the sake of dependencies or, for example, if someone merely adds a new copy |
211 # targets for the sake of dependencies or, for example, if someone merely adds a new copy |
212 # when the resource is up-to-date |
212 # when the resource is up-to-date |
213 |
213 |
214 $(call copyresource,$1,$(sort $(patsubst %,%/$(notdir $1),$(RSCCOPYDIRS)))) |
214 $(call copyresource,$1,$(sort $(patsubst %,%/$4,$(RSCCOPYDIRS)))) |
215 |
215 |
216 |
216 |
217 # individual source file compilation |
217 # individual source file compilation |
218 SOURCETARGET_$(call sanitise,$(SOURCE)): $(1) |
218 SOURCETARGET_$(call sanitise,$(SOURCE)): $(1) |
219 |
219 |
263 # belonging to this language. |
263 # belonging to this language. |
264 PRIMARYRPPFILE:=$(INTERBASE_TMP)_$(HEADLANG).rpp |
264 PRIMARYRPPFILE:=$(INTERBASE_TMP)_$(HEADLANG).rpp |
265 ifeq ($(HEADERONLY),) |
265 ifeq ($(HEADERONLY),) |
266 # generate a resource file for each language |
266 # generate a resource file for each language |
267 # For sc we generate $(RESBASE).rsc and define LANGUAGE_SC and LANGUAGE_sc. |
267 # For sc we generate $(RESBASE).rsc and define LANGUAGE_SC and LANGUAGE_sc. |
268 $(foreach L,$(LANGUAGES:SC=sc),$(eval $(call preprocessresource,$(INTERBASE_TMP)_$(L).rpp,$(INTERBASE).r$(L),$(L),$(PRIMARYRPPFILE)))) |
268 $(foreach L,$(LANGUAGES:SC=sc),$(eval $(call preprocessresource,$(INTERBASE_TMP)_$(L).rpp,$(L),$(PRIMARYRPPFILE)))) |
269 |
269 |
270 ifeq "$(MAKEFILE_GROUP)" "RESOURCE" |
270 ifeq "$(MAKEFILE_GROUP)" "RESOURCE" |
271 $(foreach L,$(LANGUAGES:SC=sc),$(eval $(call generateresource,$(INTERBASE).r$(L),$(INTERBASE_TMP)_$(L).rpp,$(L)))) |
271 $(foreach L,$(LANGUAGES:SC=sc),$(eval $(call generateresource,$(INTERBASE_TMP).r$(L),$(INTERBASE_TMP)_$(L).rpp,$(L),$(notdir $(INTERBASE)).r$(L)))) |
272 endif |
272 endif |
273 else |
273 else |
274 # No resources are going to be made so unless we specifically ask for it, there will be no |
274 # No resources are going to be made so unless we specifically ask for it, there will be no |
275 # preprocessed file from which to create the header: |
275 # preprocessed file from which to create the header: |
276 |
276 |