From 402b7ce9df5522b08b9d3d547407f137938a3ffe Mon Sep 17 00:00:00 2001 From: Scott Rifenbark Date: Thu, 7 Jun 2018 15:02:37 -0700 Subject: sdk-manual: Updated the "Makefile-Based Projects" section. Expanded this section to contain a figure of the flow and an example that showcases the ways to override and use SDK environment and Makefile variables. (From yocto-docs rev: 834c059c1df4e8328248ea86fa23ca9a397351fa) Signed-off-by: Scott Rifenbark Signed-off-by: Richard Purdie --- documentation/sdk-manual/sdk-working-projects.xml | 285 +++++++++++++++++----- 1 file changed, 230 insertions(+), 55 deletions(-) (limited to 'documentation/sdk-manual') diff --git a/documentation/sdk-manual/sdk-working-projects.xml b/documentation/sdk-manual/sdk-working-projects.xml index f8be5c1528..d8cc4229dc 100644 --- a/documentation/sdk-manual/sdk-working-projects.xml +++ b/documentation/sdk-manual/sdk-working-projects.xml @@ -222,8 +222,8 @@ 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. + cross-toolchain environment variables and Makefile variables + during development. @@ -233,7 +233,7 @@ Case 1 - No Variables Set in the - Makefile that Map to Equivalent + Makefile 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 @@ -255,21 +255,19 @@ 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. + command line results in the environment 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. - + + Regardless of how you set your variables, if you use + the "-e" option with make, the + variables from the SDK setup script take precedence: + + $ make -e target + + @@ -280,58 +278,235 @@ 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: + For example, the following commands show a null value for the + compiler variable (i.e. + CC). $ echo ${CC} - $ echo ${LD} - - $ echo ${CFLAGS} - - $ echo ${CXXFLAGS} + $ - Running the setup script and then echoing the variables shows the - values established for the SDK: + Running the SDK 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 and then echoing that variable + shows the value established through the script: - $ source /opt/poky/2.5/environment-setup-i586-poky-linux + $ source /opt/poky/&DISTRO;/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. - + + To illustrate variable use, work through this simple "Hello World!" + example: + + + Create a Working Directory and Populate It: + Create a clean directory for your project and then make + that directory your working location. + + $ mkdir $HOME/helloworld + $ cd $HOME/helloworld + + After setting up the directory, populate it with files + needed for the flow. + You need a main.c file from which you + call your function, a module.h file + to contain headers, and a module.c + that defines your function. + -