summaryrefslogtreecommitdiffstats
path: root/documentation/sdk-manual
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/sdk-manual')
-rw-r--r--documentation/sdk-manual/sdk-working-projects.xml129
1 files changed, 96 insertions, 33 deletions
diff --git a/documentation/sdk-manual/sdk-working-projects.xml b/documentation/sdk-manual/sdk-working-projects.xml
index 44b010db6d..d1249b83a9 100644
--- a/documentation/sdk-manual/sdk-working-projects.xml
+++ b/documentation/sdk-manual/sdk-working-projects.xml
@@ -233,56 +233,118 @@
233 <title>Makefile-Based Projects</title> 233 <title>Makefile-Based Projects</title>
234 234
235 <para> 235 <para>
236 For Makefile-based projects, the cross-toolchain environment 236 Simple Makefile-based projects use and interact with the
237 variables established by running the cross-toolchain environment 237 cross-toolchain environment variables established when you run
238 setup script are subject to general <filename>make</filename> 238 the cross-toolchain environment setup script.
239 rules. 239 The environment variables are subject to general
240 <filename>make</filename> rules.
240 </para> 241 </para>
241 242
242 <para> 243 <para>
243 To illustrate this, consider the following four cross-toolchain 244 This section presents a simple Makefile development flow and
244 environment variables: 245 provides an example that lets you see how you can use
245 <literallayout class='monospaced'> 246 cross-toolchain environment variables to replace or override
246 <ulink url='&YOCTO_DOCS_REF_URL;#var-CC'>CC</ulink>="i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/&DISTRO;/sysroots/i586-poky-linux" 247 variables used in your Makefile.
247 <ulink url='&YOCTO_DOCS_REF_URL;#var-LD'>LD</ulink>="i586-poky-linux-ld --sysroot=/opt/poky/&DISTRO;/sysroots/i586-poky-linux" 248 <imagedata fileref="figures/sdk-makefile-flow.png" width="6in" height="7in" align="center" />
248 <ulink url='&YOCTO_DOCS_REF_URL;#var-CFLAGS'>CFLAGS</ulink>="-O2 -pipe -g -feliminate-unused-debug-types" 249 </para>
249 <ulink url='&YOCTO_DOCS_REF_URL;#var-CXXFLAGS'>CXXFLAGS</ulink>="-O2 -pipe -g -feliminate-unused-debug-types" 250
250 </literallayout> 251 <para>
251 Now, consider the following three cases: 252 The main point of this section is to explain the following three
253 cases regarding variable behavior:
252 <itemizedlist> 254 <itemizedlist>
253 <listitem><para> 255 <listitem><para>
254 <emphasis>Case 1 - No Variables Set in the 256 <emphasis>Case 1 - No Variables Set in the
255 <filename>Makefile</filename>:</emphasis> 257 <filename>Makefile</filename> that Map to Equivalent
256 Because these variables are not specifically set in the 258 Environment Variables Set in the SDK Setup Script:</emphasis>
259 Because matching variables are not specifically set in the
257 <filename>Makefile</filename>, the variables retain their 260 <filename>Makefile</filename>, the variables retain their
258 values based on the environment. 261 values based on the environment setup script.
259 </para></listitem> 262 </para></listitem>
260 <listitem><para> 263 <listitem><para>
261 <emphasis>Case 2 - Variables Set in the 264 <emphasis>Case 2 - Variables Are Set in the Makefile that
262 <filename>Makefile</filename>:</emphasis> 265 Map to Equivalent Environment Variables from the SDK
263 Specifically setting variables in the 266 Setup Script:</emphasis>
267 Specifically setting matching variables in the
264 <filename>Makefile</filename> during the build results in 268 <filename>Makefile</filename> during the build results in
265 the environment settings of the variables being 269 the environment settings of the variables being
266 overwritten. 270 overwritten.
271 In this case, the variables you set in the
272 <filename>Makefile</filename> are used.
267 </para></listitem> 273 </para></listitem>
268 <listitem><para> 274 <listitem><para>
269 <emphasis>Case 3 - Variables Set when the 275 <emphasis>Case 3 - Variables Are Set Using the Command Line
270 <filename>Makefile</filename> is Executed from the 276 that Map to Equivalent Environment Variables from the
271 Command Line:</emphasis> 277 SDK Setup Script:</emphasis>
272 Executing the <filename>Makefile</filename> from the 278 Executing the <filename>Makefile</filename> from the
273 command-line results in the variables being overwritten 279 command line results in the environment settings of the
274 with command-line content regardless of what is being set 280 variables being overwritten.
275 in the <filename>Makefile</filename>. 281 In this case, the command-line content is used.
276 In this case, environment variables are not considered 282 <note>
277 unless you use the "-e" flag during the build: 283 The one exception to this is if you use the following
278 <literallayout class='monospaced'> 284 command-line option:
279 $ make -e <replaceable>file</replaceable> 285 <literallayout class='monospaced'>
280 </literallayout> 286 $ make -e <replaceable>target</replaceable>
281 If you use this flag, then the environment values of the 287 </literallayout>
282 variables override any variables specifically set in the 288 Using the "-e" option with <filename>make</filename>
283 <filename>Makefile</filename>. 289 causes the environment variables to be used during
290 the build.
291 </note>
284 </para></listitem> 292 </para></listitem>
285 </itemizedlist> 293 </itemizedlist>
294 </para>
295
296 <para>
297 The remainder of this section presents a simple Makefile example
298 that demonstrates these variable behaviors.
299 </para>
300
301 <para>
302 In a new shell environment variables are not established for the
303 SDK until you run the setup script.
304 For example, the following commands show null values for four
305 variables that are set when you run the SDK environment setup
306 script for a 64-bit build host and an i586-tuned target
307 architecture for a <filename>core-image-sato</filename> image
308 using the current &DISTRO; Yocto Project release:
309 <literallayout class='monospaced'>
310 $ echo ${CC}
311
312 $ echo ${LD}
313
314 $ echo ${CFLAGS}
315
316 $ echo ${CXXFLAGS}
317 </literallayout>
318 Running the setup script and then echoing the variables shows the
319 values established for the SDK:
320 <literallayout class='monospaced'>
321 $ source /opt/poky/2.5/environment-setup-i586-poky-linux
322 $ echo ${CC}
323 i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux
324 $ echo ${LD}
325 i586-poky-linux-ld --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux
326 $ echo ${CFLAGS}
327 -O2 -pipe -g -feliminate-unused-debug-types
328 $ echo ${CXXFLAGS}
329 -O2 -pipe -g -feliminate-unused-debug-types
330 </literallayout>
331 </para>
332
333 <para role='writernotes'>
334 NEED REST OF THE EXAMPLE.
335 WORKING ON GETTING IT TO WORK PROPERLY.
336 </para>
337
338<!--
339To illustrate this, consider the following four cross-toolchain
340 environment variables:
341 <literallayout class='monospaced'>
342 <ulink url='&YOCTO_DOCS_REF_URL;#var-CC'>CC</ulink>="i586-poky-linux-gcc -m32 -march=i586 &DASH;&DASH;sysroot=/opt/poky/&DISTRO;/sysroots/i586-poky-linux"
343 <ulink url='&YOCTO_DOCS_REF_URL;#var-LD'>LD</ulink>="i586-poky-linux-ld &DASH;&DASH;sysroot=/opt/poky/&DISTRO;/sysroots/i586-poky-linux"
344 <ulink url='&YOCTO_DOCS_REF_URL;#var-CFLAGS'>CFLAGS</ulink>="-O2 -pipe -g -feliminate-unused-debug-types"
345 <ulink url='&YOCTO_DOCS_REF_URL;#var-CXXFLAGS'>CXXFLAGS</ulink>="-O2 -pipe -g -feliminate-unused-debug-types"
346 </literallayout>
347 Now, consider the following three cases:
286 <note> 348 <note>
287 For information on the variables set up by the cross-toolchain 349 For information on the variables set up by the cross-toolchain
288 environment setup script, see the 350 environment setup script, see the
@@ -290,6 +352,7 @@
290 section. 352 section.
291 </note> 353 </note>
292 </para> 354 </para>
355-->
293 </section> 356 </section>
294</chapter> 357</chapter>
295<!-- 358<!--