From 90eadbcb1d1b571bd7c6212c2a04a7d89f26ec79 Mon Sep 17 00:00:00 2001 From: Scott Rifenbark Date: Thu, 7 Jun 2018 09:26:41 -0700 Subject: [PATCH] sdk-manual: Updates to the "Makefile-Based Projects" section. I wrote the section to include a flow diagram using "make" and provided a working example highlighting how to override environment variables. (From yocto-docs rev: c147d1ee1f6f33a5222eb1ccf466d1854c67815c) Signed-off-by: Scott Rifenbark Signed-off-by: Richard Purdie --- .../sdk-manual/sdk-working-projects.xml | 145 +++++++++++++----- 1 file changed, 104 insertions(+), 41 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 @@ Makefile-Based Projects - For Makefile-based projects, the cross-toolchain environment - variables established by running the cross-toolchain environment - setup script are subject to general make - rules. + Simple Makefile-based projects use and interact with the + cross-toolchain environment variables established when you run + the cross-toolchain environment setup script. + The environment variables are subject to general + make rules. - To illustrate this, consider the following four cross-toolchain + This section presents a simple Makefile development flow and + provides an example that lets you see how you can use + cross-toolchain environment variables to replace or override + variables used in your Makefile. + + + + + The main point of this section is to explain the following three + cases regarding variable behavior: + + + Case 1 - No Variables Set in the + Makefile that Map to Equivalent + Environment Variables Set in the SDK Setup Script: + Because matching variables are not specifically set in the + Makefile, the variables retain their + values based on the environment setup script. + + + Case 2 - Variables Are Set in the Makefile that + Map to Equivalent Environment Variables from the SDK + Setup Script: + Specifically setting matching variables in the + Makefile during the build results in + the environment settings of the variables being + overwritten. + In this case, the variables you set in the + Makefile are used. + + + Case 3 - Variables Are Set Using the Command Line + that Map to Equivalent Environment Variables from the + SDK Setup Script: + Executing the Makefile from the + command line results in the environment settings of the + variables being overwritten. + In this case, the command-line content is used. + + The one exception to this is if you use the following + command-line option: + + $ make -e target + + Using the "-e" option with make + causes the environment variables to be used during + the build. + + + + + + + The remainder of this section presents a simple Makefile example + that demonstrates these variable behaviors. + + + + In a new shell environment variables are not established for the + SDK until you run the setup script. + For example, the following commands show null values for four + variables that are set when you run the SDK environment setup + script for a 64-bit build host and an i586-tuned target + architecture for a core-image-sato image + using the current &DISTRO; Yocto Project release: + + $ echo ${CC} + + $ echo ${LD} + + $ echo ${CFLAGS} + + $ echo ${CXXFLAGS} + + Running the setup script and then echoing the variables shows the + values established for the SDK: + + $ source /opt/poky/2.5/environment-setup-i586-poky-linux + $ echo ${CC} + i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux + $ echo ${LD} + i586-poky-linux-ld --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux + $ echo ${CFLAGS} + -O2 -pipe -g -feliminate-unused-debug-types + $ echo ${CXXFLAGS} + -O2 -pipe -g -feliminate-unused-debug-types + + + + + NEED REST OF THE EXAMPLE. + WORKING ON GETTING IT TO WORK PROPERLY. + + +