author | Jon Chatten |
Thu, 25 Mar 2010 14:13:00 +0000 | |
branch | fix |
changeset 396 | f50e1b89b7ce |
parent 248 | 760086c28ab8 |
permissions | -rw-r--r-- |
225
d401dbd3a410
Ensure that parallel parsing sbs calls pass on --no-depend-generate and --no-depend-include (as these influence makefile generation).
Jon Chatten
parents:
223
diff
changeset
|
1 |
# Copyright (c) 2008-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 |
# All targets Function Like Makefile (FLM) supporting the execution of |
|
15 |
# gccxml_cc1plus on source, the creation of project and resource descriptive XML files |
|
16 |
# and packaging into an appropriate archive for CDB processing. |
|
17 |
# |
|
18 |
# |
|
19 |
||
20 |
||
21 |
# passed in values, stripped of whitespace |
|
22 |
DEFFILE:=$(strip $(DEFFILE)) |
|
23 |
LINKAS:=$(strip $(LINKAS)) |
|
24 |
UID1:=$(strip $(UID1)) |
|
25 |
UID2:=$(strip $(UID2)) |
|
26 |
UID3:=$(strip $(UID3)) |
|
27 |
||
28 |
# local variables |
|
29 |
CREATABLEPATHS:= |
|
30 |
CLEANTARGETS:= |
|
31 |
RELEASABLES:= |
|
32 |
STDCPP_BUILD:= |
|
33 |
CIAFILEEXTENSIONS:=%.CIA %.cia %.Cia %.cIa %.cIA %.ciA %.CIa %.CiA |
|
34 |
||
35 |
ROOTBLDPATH:=$(OUTPUTPATH)/gccxml |
|
36 |
VARIANTBLDPATH:=$(OUTPUTPATH)/$(FULLVARIANTPATH) |
|
37 |
ROOTRELEASEPATH:=$(RELEASEPATH)/gccxml |
|
38 |
VARIANTRELEASEPATH:=$(RELEASEPATH)/$(FULLVARIANTPATH) |
|
39 |
||
40 |
CREATABLEPATHS:=$(CREATABLEPATHS) $(VARIANTBLDPATH) $(VARIANTRELEASEPATH) $(ROOTBLDPATH) $(ROOTRELEASEPATH) |
|
41 |
||
42 |
# type-specific definitions |
|
43 |
BASE_TYPE:=dll |
|
44 |
TARGET_MACRO:=__DLL__ |
|
45 |
ifneq ($(findstring exe,$(TARGETTYPE)),) |
|
46 |
BASE_TYPE:=exe |
|
47 |
TARGET_MACRO:=__EXE__ |
|
48 |
endif |
|
49 |
ifneq ($(findstring lib,$(TARGETTYPE)),) |
|
50 |
BASE_TYPE:=lib |
|
51 |
TARGET_MACRO:= |
|
52 |
endif |
|
53 |
||
54 |
# utility functions |
|
55 |
# returns absolutely-pathed temporary build filenames based solely on the basename of the source file, but with an additional "_" for .cia files |
|
56 |
# $(1) input source file list |
|
57 |
# $(2) output file extension |
|
58 |
define mapsource2output |
|
59 |
$(foreach SOURCEFILE,$(1),$(patsubst %, $(VARIANTBLDPATH)/%, $(basename $(notdir $(SOURCEFILE)))$(if $(filter $(CIAFILEEXTENSIONS),$(SOURCEFILE)),_,)$(2))) |
|
60 |
endef |
|
61 |
||
62 |
# returns absolutely-pathed temporary build filenames based on the full resource filename |
|
63 |
# $(1) input resource file list |
|
64 |
# $(2) output file extension |
|
65 |
define mapresource2output |
|
66 |
$(patsubst %, $(ROOTBLDPATH)/%, $(addsuffix $(2),$(notdir $(1)))) |
|
67 |
endef |
|
68 |
||
69 |
# calls a tool multiple times with grouped arguments |
|
70 |
# $(1) tool to call with any non-variable arguments |
|
71 |
# $(2) list of further variable arguments to group in 150 element calls |
|
72 |
define groupcallin50 |
|
73 |
$(if $2,$1 $(foreach L,$(wordlist 1,50,$2),$(L)),) |
|
248
760086c28ab8
Hiding gccxml zip output to stop logfile corruption
Iain Williamson <iain.williamson@nokia.com>
parents:
225
diff
changeset
|
74 |
$(if $2,$(call groupcallin50,$1,$(wordlist 51,$(words $2),$2)),@true) |
3 | 75 |
endef |
76 |
||
77 |
# echos content to a file in groups performing optional search/replace based on passed args |
|
78 |
# $(1) template line with optional __VERBATIM__, __PATH__, __FILENAME__ replacements |
|
79 |
# $(2) list of pathed filenames to be batch processed and that can be used for template replacements |
|
80 |
# $(3) output file |
|
81 |
define groupreplacein50infile |
|
82 |
$(if $2,@echo -e $(foreach L,$(wordlist 1,50,$2),"$(subst __VERBATIM__,$(L),$(subst __PATH__,$(dir $(L)),$(subst __FILENAME__,$(notdir $(L)),$1)))\\n") >>$3,) |
|
83 |
$(if $2,$(call groupreplacein50infile,$1,$(wordlist 51,$(words $2),$2),$3),@true) |
|
84 |
endef |
|
85 |
||
86 |
# targets |
|
87 |
INCLUDESFILE:=$(ROOTRELEASEPATH)/includeheaders.txt |
|
88 |
MMPXMLFILE:=$(ROOTBLDPATH)/$(notdir $(PROJECT_META)).xml |
|
89 |
SRCXMLFILES:=$(call mapsource2output,$(SOURCE),.xml) |
|
90 |
RFIFILES:=$(call mapresource2output,$(RESOURCEFILES),.rfi) |
|
91 |
DEPFILES:=$(call mapsource2output,$(SOURCE),.xml.d) |
|
92 |
TEMPGXPARCHIVE:=$(VARIANTBLDPATH)/$(TARGET)$(BASE_TYPE).gxp |
|
93 |
GXPARCHIVE:=$(VARIANTRELEASEPATH)/$(TARGET)$(BASE_TYPE).gxp |
|
94 |
||
5 | 95 |
CLEANTARGETS:=$(CLEANTARGETS) $(MMPXMLFILE) $(SRCXMLFILES) $(DEPFILES) $(TEMPGXPARCHIVE) |
3 | 96 |
RELEASABLES:=$(RELEASABLES) $(GXPARCHIVE) |
97 |
||
98 |
# Deduce whether we should be performing a build with standard CPP characteristics |
|
99 |
# This operates differently per-OS release, although OE TARGETTYPEs always build with standard CPP traits |
|
100 |
ifeq ($(OPEN_ENVIRONMENT),1) |
|
101 |
STDCPP_BUILD:=1 |
|
102 |
endif |
|
103 |
||
104 |
ifeq ($(SUPPORTS_STDCPP_NEWLIB),1) |
|
105 |
ifeq ($(NOSTDCPP),1) |
|
106 |
STDCPP_BUILD:= |
|
107 |
else |
|
108 |
ifeq ($(STDCPP),1) |
|
109 |
STDCPP_BUILD:=1 |
|
110 |
endif |
|
111 |
endif |
|
112 |
endif |
|
113 |
||
114 |
ifeq ($(STDCPP_BUILD),1) |
|
115 |
CDEFS:=$(CDEFS) $(STDCPP_DEF) |
|
116 |
SYSTEMINCLUDE:=$(SYSTEMINCLUDE) $(STDCPP_INCLUDE) |
|
117 |
endif |
|
118 |
||
119 |
CDEFS:=$(CDEFS) $(TARGET_DEFS) |
|
120 |
SYSTEMINCLUDE:=$(SYSTEMINCLUDE) $(TARGET_INCLUDES) |
|
121 |
||
122 |
# include paths |
|
123 |
UINCLUDE:=$(patsubst %,$(OPT.USERINCLUDE)%,$(USERINCLUDE)) |
|
124 |
SINCLUDE:=$(patsubst %,$(OPT.SYSINCLUDE)%,$(SYSTEMINCLUDE)) |
|
125 |
PINCLUDE:=$(OPT.PREINCLUDE)$(PRODUCT_INCLUDE) |
|
126 |
INCLUDES:=$(UINCLUDE) $(OPT.SPLITINCLUDE) $(SINCLUDE) $(PINCLUDE) |
|
127 |
||
128 |
DEFINES:=$(call makemacrodef,$(OPT.DEFINE),$(CDEFS) $(TARGET_MACRO)) |
|
129 |
||
130 |
||
131 |
# .mmp XML description file |
|
132 |
ifneq ($(PROCESSED_$(call sanitise,$(MMPXMLFILE))),1) |
|
133 |
||
134 |
ifeq ($(LINKAS),) |
|
135 |
LINKASBASE:=$(TARGET).$(if $(REQUESTEDTARGETEXT),$(REQUESTEDTARGETEXT),$(TARGETTYPE)) |
|
136 |
else |
|
137 |
LINKASBASE:=$(LINKAS) |
|
138 |
endif |
|
139 |
||
140 |
LINKASVERSIONED:=$(basename $(LINKASBASE)){$(VERSIONHEX)}$(suffix $(LINKASBASE)) |
|
141 |
||
142 |
ADDED_CAPABILITIES:=$(subst $(CHAR_SPACE),+,$(filter-out -%,$(CAPABILITY))) |
|
143 |
SUBTRACTED_CAPABILITIES:=$(subst $(CHAR_SPACE),,$(filter -%,$(CAPABILITY))) |
|
144 |
FINAL_CAPABILITIES:=$(if $(ADDED_CAPABILITIES),$(ADDED_CAPABILITIES)$(SUBTRACTED_CAPABILITIES),none) |
|
145 |
||
146 |
ifeq ($(UID2),00000000) |
|
147 |
UID2:=$(if $(UID2_ZERO_OVERRIDE),$(UID2_ZERO_OVERRIDE),00000000) |
|
148 |
endif |
|
149 |
||
150 |
define gccxmlmeta2xml |
|
151 |
# note: we jump through some rather awkward hoops here in an attempt to not cause issues for the Bash shell |
|
152 |
# with gargantuan concatenated "echo" statements. This includes not being wrapped by start/endrule and |
|
153 |
# using grouping functions where appropriate. |
|
154 |
$(1): |
|
155 |
$(call startrule,gccxmlmeta2xml) \ |
|
156 |
echo creating $(1) quietly \ |
|
157 |
$(call endrule,gccxmlmeta2xml) |
|
158 |
@echo -e \ |
|
159 |
"<?xml version=\"1.0\"?>\n" \ |
|
160 |
"<mmpInfo>\n" \ |
|
161 |
"\t<mmp path=\"$(PROJECT_META)\"/>\n" \ |
|
162 |
"\t<target name=\"$(TARGET).$(if $(REQUESTEDTARGETEXT),$(REQUESTEDTARGETEXT),$(TARGETTYPE))\" type=\"$(TARGETTYPE)\"$(if $(TARGETPATH), path=\"$(TARGETPATH)\",)/>\n" \ |
|
163 |
"\t<cwd path=\"$(dir $(COMPONENT_META))\"/>\n" \ |
|
164 |
"\t<abi type=\"ARM4\"/>\n" \ |
|
165 |
"\t<linkAs name=\"$(LINKASVERSIONED)\"/>\n" \ |
|
166 |
"\t<linkAsBase name=\"$(LINKASBASE)\"/>\n" \ |
|
167 |
"\t<uids$(if $(UID1), u0=\"0x$(UID1)\",)$(if $(UID2), u1=\"0x$(UID2)\",)$(if $(UID3), u2=\"0x$(UID3)\",)/>\n" \ |
|
168 |
"\t<version major=\"$(basename $(VERSION))\" minor=\"$(subst .,,$(suffix $(VERSION)))\"/>\n" \ |
|
169 |
"\t<capability id=\"$(FINAL_CAPABILITIES)\"/>\n" \ |
|
170 |
"\t<defFile path=\"\" type=\"GCC\"/>\n" \ |
|
171 |
"\t<defFile path=\"$(DEFFILE)\" type=\"EABI\"/>\n" \ |
|
172 |
"\t<libs>\n" \ |
|
173 |
"\t\t<lib name=\"$(FIRSTLIB)\" type=\"First\"/>" \ |
|
174 |
> $(1) |
|
175 |
$(call groupreplacein50infile,\t\t<lib name=\"__VERBATIM__\"/>,$(subst .dso,.lib,$(LIBRARY)),$(1)) |
|
176 |
$(call groupreplacein50infile,\t\t<lib name=\"__VERBATIM__\"/>,$(STATICLIBRARY),$(1)) |
|
177 |
@echo -e \ |
|
178 |
"\t</libs>\n" \ |
|
179 |
"\t<resources>" \ |
|
180 |
>> $(1) |
|
181 |
$(call groupreplacein50infile,\t\t<resource name=\"__FILENAME__\"/>,$(RFIFILES),$(1)) |
|
182 |
@echo -e \ |
|
183 |
"\t</resources>" \ |
|
184 |
>> $(1) |
|
185 |
$(call groupreplacein50infile,\t<sourceFile name=\"__FILENAME__\" path=\"__PATH__\"/>,$(SOURCE),$(1)) |
|
186 |
$(call groupreplacein50infile,\t<export name=\"__VERBATIM__\"/>,$(EXPORTHEADERS),$(1)) |
|
187 |
@echo -e \ |
|
188 |
"</mmpInfo>\n" \ |
|
189 |
>> $(1) |
|
190 |
endef |
|
191 |
||
192 |
$(eval $(call gccxmlmeta2xml,$(MMPXMLFILE))) |
|
193 |
$(eval PROCESSED_$(call sanitise,$(MMPXMLFILE)):=1) |
|
194 |
endif |
|
195 |
||
196 |
||
197 |
# process straight source files into .xml files, generating .d dependency files and updating includeheaders.txt |
|
198 |
# note: includeheaders.txt is neither tracked as a formal dependency, nor deleted during a clean. This mirrors |
|
199 |
# the situation with ABLD where the GCCXML build continually updates the file as it finds it. |
|
200 |
define gccxmlprocesssource |
|
201 |
||
202 |
$(eval DEPENDFILENAME:=$(call mapsource2output,$(1),.xml.d)) |
|
223
25b4c60594cd
Correct dependency file inclusion in GCCXML build.
Jon Chatten
parents:
5
diff
changeset
|
203 |
$(eval DEPENDFILE:=$(wildcard $(DEPENDFILENAME))) |
3 | 204 |
|
205 |
$(call mapsource2output,$(1),.xml): $(1) $(if $(DEPENDFILE),,RESOURCE BITMAP EXPORT) |
|
206 |
$(call startrule,gccxmlprocesssource) \ |
|
207 |
$(CC) $(CFLAGS) $(OPTION_GCCXML) \ |
|
208 |
$(if $(filter $(CIAFILEEXTENSIONS),$(1)),$(call makemacrodef,$(OPT.DEFINE),__CIA__),) \ |
|
209 |
$(DEFINES) \ |
|
210 |
$(OPT.USERINCLUDE)$(patsubst %/,%,$(dir $(1))) \ |
|
211 |
$(INCLUDES) \ |
|
212 |
-fxml="$$@" -MD "$$@.d" -MT "$$@" $(OPT.OUT) nul "$(1)" && \ |
|
213 |
$(GNUSED) '/^.*\.xml:.*$$$$/d;/^ [a-zA-Z].*$$$$/d;s/^ //;s/ \\\$$$$//;s/\/\//\//g;/^s*$$$$/d' < $$@.d | $(GNUAWK) '{sub(/ /,"\n")};1' >> $(INCLUDESFILE) \ |
|
214 |
$(call endrule,gccxmlprocesssource) |
|
215 |
||
216 |
CLEANTARGETS:=$$(CLEANTARGETS) $(DEPENDFILENAME) |
|
223
25b4c60594cd
Correct dependency file inclusion in GCCXML build.
Jon Chatten
parents:
5
diff
changeset
|
217 |
ifneq ($(DEPENDFILE),) |
25b4c60594cd
Correct dependency file inclusion in GCCXML build.
Jon Chatten
parents:
5
diff
changeset
|
218 |
ifeq ($(NO_DEPEND_INCLUDE),) |
25b4c60594cd
Correct dependency file inclusion in GCCXML build.
Jon Chatten
parents:
5
diff
changeset
|
219 |
ifeq ($(filter %CLEAN,$(call uppercase,$(MAKECMDGOALS))),) |
25b4c60594cd
Correct dependency file inclusion in GCCXML build.
Jon Chatten
parents:
5
diff
changeset
|
220 |
-include $(DEPENDFILE) |
25b4c60594cd
Correct dependency file inclusion in GCCXML build.
Jon Chatten
parents:
5
diff
changeset
|
221 |
endif |
3 | 222 |
endif |
223 |
endif |
|
224 |
||
225 |
endef |
|
226 |
$(foreach SRCFILE,$(SOURCE),$(eval $(call gccxmlprocesssource,$(SRCFILE)))) |
|
227 |
||
228 |
||
229 |
# package output |
|
230 |
# this is done in a slightly indirect way in order to work around the fact that the ABLD GCCXML build doesn't always pick |
|
231 |
# a unique name for .gxp files for some components with multiple .mmp files i.e. it deletes/generates the same name |
|
232 |
# .gxp file over, and over, again. What follows ensures that the build tree .gxp file is always unique, and that |
|
233 |
# we just publish that last one that is built. This mirrors what ABLD achieves, and avoids "overriding" warnings in |
|
234 |
# makefile processing. |
|
235 |
# note: the main call here needs to reside outside of start/endrule in order to avoid command line length issues. |
|
236 |
define gccxmlpackage |
|
237 |
$(TEMPGXPARCHIVE): $(MMPXMLFILE) $(SRCXMLFILES) $(DEFFILE) |
|
248
760086c28ab8
Hiding gccxml zip output to stop logfile corruption
Iain Williamson <iain.williamson@nokia.com>
parents:
225
diff
changeset
|
238 |
$$(call groupcallin50,@$(ZIP) -j $$@ > /dev/null 2>&1,$$^ $(RFIFILES)) ; |
3 | 239 |
$(call startrule,gccxmlpackage) \ |
240 |
$(GNURM) -f $(GXPARCHIVE) && \ |
|
241 |
$(GNUCP) $$@ $(GXPARCHIVE) \ |
|
242 |
$(if $(SAVESPACE),; $(GNURM) -rf $(VARIANTBLDPATH); true,) \ |
|
243 |
$(call endrule,gccxmlpackage) |
|
244 |
||
245 |
$(GXPARCHIVE): $(TEMPGXPARCHIVE) |
|
246 |
endef |
|
247 |
$(eval $(gccxmlpackage)) |
|
248 |
||
249 |
# Global targets |
|
250 |
.PHONY:: $(ALLTARGET) |
|
251 |
$(ALLTARGET):: $(RELEASABLES) |
|
252 |
TARGET:: $(RELEASABLES) |
|
253 |
||
254 |
# clean up |
|
5 | 255 |
$(call raptor_clean,$(CLEANTARGETS)) |
3 | 256 |
$(call makepath, $(CREATABLEPATHS)) |
257 |