1 2 3 4 5 6 7 8 9 10 11 12
13 /*!
14 * ======== google.targets.ITarget ========
15 * Interface to Google's GCC compatible compilers (e.g. Bionic)
16 */
17 @TargetHeader("xdc/bld/stddefs.xdt")
18 metaonly interface ITarget inherits xdc.bld.ITarget3 {
19
20 override readonly config string stdInclude = "google/targets/std.h";
21 override config string dllExt = ".so";
22
23 /*!
24 * ======== GCCVERS ========
25 * Version number of the GCC compiler; e.g., "3.2".
26 *
27 * This string can be supplied by the user, otherwise it is obtained
28 * by running "gcc -dumpversion".
29 */
30 config string GCCVERS = null;
31
32 /*!
33 * ======== BINVERS ========
34 * Version number of binutils used with the compiler; e.g., "2.19".
35 *
36 * This string can be supplied by the user, otherwise it is obtained
37 * by running "ld -v".
38 */
39 config string BINVERS = null;
40
41 /*!
42 * ======== version ========
43 * The Compatibility Key associated with this target.
44 *
45 * The first two components of this target's Compatibility Key are '1,0'.
46 * The rest of the Key represents the compiler version. The third
47 * component combines the major and the minor version number in the format
48 * Major.Minor. The fourth component is the patch number.
49 *
50 * @a(Example)
51 * If this target's `rootDir` points to the compiler version 3.4.6, the
52 * Compatibility Key is [1,0,3.4,6].
53 *
54 */
55 override metaonly config String version;
56
57 /*!
58 * ======== GCCTARG ========
59 * The name of the platform executing programs produced by this target
60 *
61 * This string can be supplied by the user, otherwise is is obtained
62 * from the compiler and follows the GNU standard format
63 * (<cpu>-<manufacturer>-<os> or <cpu>-<manufacturer>-<kernel>-<os>);
64 * e.g., "sparc-sun-solaris2.6" or "i586-pc-linux-gnu".
65 *
66 * When building a GCC compiler, there are three different execution
67 * platforms to consider: the platform used to "build" the compiler, the
68 * "host" platform that runs the compiler, and the "target" platform
69 * that runs the executables produced by the compiler. All three
70 * platforms are identified using a
71 * {@link http://sources.redhat.com/autobook/autobook/autobook_17.html configuration name}
72 * defined by GNU Autotools. `GCCTARG` is the name of the "target"
73 * platform.
74 */
75 config string GCCTARG = null;
76
77 /*!
78 * ======== LONGNAME ========
79 * The "long name" of the gcc compiler
80 *
81 * This name is used (in conjunction with rootDir) to find the compiler
82 * and linker for this target. The format of `LONGNAME` is always
83 * "/bin/<machine>-gcc". For majority of the targets, the default value
84 * for `LONGNAME` does not ever need to be changed. But, there are
85 * targets where the different but compatible compilers may have
86 * different `LONGNAME` parameters. For such targets and compilers,
87 * `LONGNAME` can be set in `config.bld`.
88 *
89 * @a(Example)
90 * If a version 2010q1 of the CodeSourcery GNU toolchain for Arm is
91 * installed in C:/CodeSourcery/arm-2010q1, the following settings in
92 * `config.bld` configure `google.targets.arm.Bionic` target to use that
93 * toolchain:
94 * @p(code)
95 * var Bionic = xdc.module("google.targets.arm.Bionic");
96 * Bionic.rootDir = "C:/CodeSourcery/arm-2010q1";
97 * Bionic.LONGNAME = "bin/arm-none-linux-gnueabi-gcc";
98 * Bionic.libcDir = "C:/android-rowboat/bionic";
99 * Bionic.fsDir = "C:/android-rowboat/out/target/product/ti814xevm/obj";
100 * @p
101 *
102 */
103 config string LONGNAME = "/bin/gcc";
104
105 /*!
106 * ======== libcDir ========
107 * The libc of the gcc compiler
108 *
109 * This name is used to find the libc libraries.
110 *
111 * @a(Example)
112 * If the libc files are installed in C:/android-rowboat/bionic, the
113 * following settings in `config.bld` configure the
114 * `google.targets.arm.Binoic` target to use that libc installation:
115 * @p(code)
116 * var Bionic = xdc.module("google.targets.arm.Bionic");
117 * Bionic.rootDir = "C:/CodeSourcery/arm-2010q1";
118 * Bionic.LONGNAME = "bin/arm-none-linux-gnueabi-gcc";
119 * Bionic.libcDir = "C:/android-rowboat/bionic";
120 * Bionic.fsDir = "C:/android-rowboat/out/target/product/ti814xevm/obj";
121 * @p
122 *
123 */
124 config string libcDir;
125
126 /*!
127 * ======== fsDir ========
128 * The bionic file system
129 *
130 * This name is used to find the file system libraries.
131 *
132 * @a(Example)
133 * If the file system is installed in
134 * C:/android-rowboat/out/target/product/ti814xevm/obj, the
135 * following settings in `config.bld` configure the
136 * `google.targets.arm.Binoic` target to use that file system:
137 * @p(code)
138 * var Bionic = xdc.module("google.targets.arm.Bionic");
139 * Bionic.rootDir = "C:/CodeSourcery/arm-2010q1";
140 * Bionic.LONGNAME = "bin/arm-none-linux-gnueabi-gcc";
141 * Bionic.fsDir = "C:/android-rowboat/out/target/product/ti814xevm/obj";
142 * @p
143 *
144 */
145 config string fsDir;
146
147 /*!
148 * ======== CYGWIN ========
149 * Is the target's compiler a cygwin executable
150 *
151 * Since file names produced by cygwin-based tools differ from the
152 * names understood by other Windows executables, it is important
153 * to avoid using the names output by cygwin tools as input to
154 * non-cygwin programs. This property tells the target whether
155 * or not it's possible to use the output from `gcc -MD -MF`, for
156 * example.
157 */
158 readonly config Bool CYGWIN = false;
159
160 /*!
161 * ======== noStdLinkScript ========
162 * Don't use the standard linker script
163 *
164 * If `true`, add a `-T` flag before the generated `package/cfg/*.xdl`
165 * file passed to the linker. This flag suppresses use of the
166 * standard linker script implicit in the GCC flow, which effectively
167 * says the generated `.xdl` file assumes total control for all
168 * `MEMORY` and `SECTION` directives.
169 *
170 */
171 config Bool noStdLinkScript = false;
172
173 174 175
176 override config xdc.bld.ITarget.OptionSet profiles[string] = [
177 ["debug", {
178 compileOpts: {
179 copts: "-g",
180 defs: "-D_DEBUG_=1",
181 },
182 linkOpts: "-g",
183 }],
184
185 ["release", {
186 compileOpts: {
187 copts: "-O2 -ffunction-sections -fdata-sections",
188 },
189 linkOpts: "-Wl,--gc-sections",
190 }]
191 ];
192
193 /*!
194 * ======== versionMap ========
195 * Map of GCC compiler version numbers to compatibility keys.
196 *
197 * This map translates version string information from the compiler
198 * into a compatibility key. The compatibilty key is used to
199 * validate consistency among a collection of packages used in
200 * a configuration.
201 *
202 * The compiler version string is "gcc<ver>", where <ver> is
203 * GCCVERS.
204 *
205 * If a compiler version is not found in this map the default is
206 * "1,0,<ver>", where <ver> is the compiler version number. Thus,
207 * the user only needs to extend this table when a significant
208 * incompatibility occurs or when two versions of the compiler should
209 * be treated as 100% compatible.
210 */
211 override config string versionMap[string] = [
212 ["gcc3.2", "1,0,3.2,0"],
213 ];
214
215 /*!
216 * ======== remoteHost ========
217 * Remote host used to run compiler, linker, and archiver tools
218 *
219 * If `remoteHost` is `null` (or `undefined`), the configured compiler
220 * is run locally; otherwise, `remoteHost` is taken to be the host name
221 * of the machine that that should be used to run the specified compiler.
222 *
223 * All target commands are prefixed with a command that uses `rsh` to run
224 * the commands on the specified host. Thus, in order to use this
225 * setting, the remote machine must be support `rsh` and the user must
226 * have permission to run commands from the local machine on the remote
227 * host named `remoteHost`. This usually involves adding a line to the
228 * user's `~/.rhosts` file on the remote machine of the form:
229 * @p(code)
230 * local-machine-name user-name
231 * @p
232 * where `local-machine-name` is the name of the local machine and
233 * `user-name` is the user's login name on the local machine.
234 */
235 config string remoteHost;
236
237 /*!
238 * ======== ar ========
239 * The command used to create an archive
240 */
241 override readonly config xdc.bld.ITarget2.Command ar = {
242 cmd: "$(rootDir)/$(GCCTARG)/bin/ar",
243 opts: "cr"
244 };
245
246 /*!
247 * ======== lnk ========
248 * The command used to link executables.
249 */
250 override readonly config xdc.bld.ITarget2.Command lnk = {
251 cmd: "$(rootDir)/$(LONGNAME)",
252 opts: ""
253 };
254
255 /*!
256 * ======== cc ========
257 * The command used to compile C/C++ source files into object files
258 */
259 override readonly config xdc.bld.ITarget2.Command cc = {
260 cmd: "$(rootDir)/$(LONGNAME) -c -MD -MF $@.dep",
261 opts: ""
262 };
263
264 /*!
265 * ======== asm ========
266 * The command used to assembles assembly source files into object files
267 */
268 override readonly config xdc.bld.ITarget2.Command asm = {
269 cmd: "$(rootDir)/$(LONGNAME) -c -x assembler",
270 opts: ""
271 };
272
273 /*!
274 * ======== includeOpts ========
275 * Additional user configurable target-specific include path options
276 */
277 override config string includeOpts = "";
278 }
279 280 281 282
283