diff options
author | Scott Rifenbark <scott.m.rifenbark@intel.com> | 2015-04-14 06:49:55 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-04-15 15:57:18 +0100 |
commit | d654160eb2ea03aabd77b4bbc7a202d4179bcca3 (patch) | |
tree | 4cd272bb3639c87a18b0b72f49e0a56e80447a89 /documentation | |
parent | 941910f47faf3863646ef8b7c95e5fb855355d5c (diff) | |
download | poky-d654160eb2ea03aabd77b4bbc7a202d4179bcca3.tar.gz |
adt-manual: Updated the Makefile-based project section.
Fixes [YOCTO #7133]
Added more examples of how variables work in Makefile projects.
(From yocto-docs rev: e8aa42f3609de3dfe94c022d957b855a4f7ef032)
Signed-off-by: Scott Rifenbark <scott.m.rifenbark@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation')
-rw-r--r-- | documentation/adt-manual/adt-command.xml | 66 |
1 files changed, 45 insertions, 21 deletions
diff --git a/documentation/adt-manual/adt-command.xml b/documentation/adt-manual/adt-command.xml index d6fa8ee4d4..5df6a6f621 100644 --- a/documentation/adt-manual/adt-command.xml +++ b/documentation/adt-manual/adt-command.xml | |||
@@ -210,31 +210,55 @@ | |||
210 | <title>Makefile-Based Projects</title> | 210 | <title>Makefile-Based Projects</title> |
211 | 211 | ||
212 | <para> | 212 | <para> |
213 | For Makefile-based projects, the cross-toolchain environment | 213 | For Makefile-based projects, the cross-toolchain environment variables |
214 | variables established by running the cross-toolchain environment | 214 | established by running the cross-toolchain environment setup script |
215 | setup script override any settings you might have in your | 215 | are subject to general <filename>make</filename> rules. |
216 | <filename>Makefile</filename>. | 216 | </para> |
217 | For example, if you had settings such as the following in your | 217 | |
218 | <filename>Makefile</filename>, the environment variables defined | 218 | <para> |
219 | by the script would override them: | 219 | To illustrate this, consider the following four cross-toolchain |
220 | environment variables: | ||
220 | <literallayout class='monospaced'> | 221 | <literallayout class='monospaced'> |
221 | <ulink url='&YOCTO_DOCS_REF_URL;#var-CC'>CC</ulink>=arm-poky-linux-gnueabi-gcc | 222 | <ulink url='&YOCTO_DOCS_REF_URL;#var-CC'>CC</ulink>=i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/1.8/sysroots/i586-poky-linux |
222 | <ulink url='&YOCTO_DOCS_REF_URL;#var-LD'>LD</ulink>=arm-poky-linux-gnueabi-ld | 223 | <ulink url='&YOCTO_DOCS_REF_URL;#var-LD'>LD</ulink>=i586-poky-linux-ld --sysroot=/opt/poky/1.8/sysroots/i586-poky-linux |
223 | <ulink url='&YOCTO_DOCS_REF_URL;#var-CFLAGS'>CFLAGS</ulink>=”${CFLAGS} --sysroot=<sysroot-dir>” | 224 | <ulink url='&YOCTO_DOCS_REF_URL;#var-CFLAGS'>CFLAGS</ulink>=-O2 -pipe -g -feliminate-unused-debug-types |
224 | <ulink url='&YOCTO_DOCS_REF_URL;#var-CXXFLAGS'>CXXFLAGS</ulink>=”${CXXFLAGS} --sysroot=<sysroot-dir>” | 225 | <ulink url='&YOCTO_DOCS_REF_URL;#var-CXXFLAGS'>CXXFLAGS</ulink>=-O2 -pipe -g -feliminate-unused-debug-types |
225 | </literallayout> | 226 | </literallayout> |
226 | Consequently, you should not set variables like | 227 | Now, consider the following three cases: |
227 | <ulink url='&YOCTO_DOCS_REF_URL;#var-CC'><filename>CC</filename></ulink> | 228 | <itemizedlist> |
228 | and | 229 | <listitem><para><emphasis>Case 1 - No Variables Set in the <filename>Makefile</filename>:</emphasis> |
229 | <ulink url='&YOCTO_DOCS_REF_URL;#var-LD'><filename>LD</filename></ulink> | 230 | Because these variables are not specifically set in the |
230 | in your <filename>Makefile</filename>. | 231 | <filename>Makefile</filename>, the variables retain their |
231 | For the list of variables set up by the cross-toolchain environment | 232 | values based on the environment. |
232 | setup script, see the | 233 | </para></listitem> |
233 | "<link linkend='setting-up-the-cross-development-environment'>Setting Up the Cross-Development Environment</link>" | 234 | <listitem><para><emphasis>Case 2 - Variables Set in the <filename>Makefile</filename>:</emphasis> |
234 | section. | 235 | Specifically setting variables in the |
236 | <filename>Makefile</filename> during the build results in the | ||
237 | environment settings of the variables being overwritten. | ||
238 | </para></listitem> | ||
239 | <listitem><para><emphasis>Case 3 - Variables Set when the <filename>Makefile</filename> is Executed from the Command Line:</emphasis> | ||
240 | Executing the <filename>Makefile</filename> from the command | ||
241 | line results in the variables being overwritten with | ||
242 | command-line content regardless of what is being set in the | ||
243 | <filename>Makefile</filename>. | ||
244 | In this case, environment variables are not considered unless | ||
245 | you use the "-e" flag during the build: | ||
246 | <literallayout class='monospaced'> | ||
247 | $ make -e <replaceable>file</replaceable> | ||
248 | </literallayout> | ||
249 | If you use this flag, then the environment values of the | ||
250 | variables override any variables specifically set in the | ||
251 | <filename>Makefile</filename>. | ||
252 | </para></listitem> | ||
253 | </itemizedlist> | ||
254 | <note> | ||
255 | For the list of variables set up by the cross-toolchain environment | ||
256 | setup script, see the | ||
257 | "<link linkend='setting-up-the-cross-development-environment'>Setting Up the Cross-Development Environment</link>" | ||
258 | section. | ||
259 | </note> | ||
235 | </para> | 260 | </para> |
236 | </section> | 261 | </section> |
237 | |||
238 | </chapter> | 262 | </chapter> |
239 | <!-- | 263 | <!-- |
240 | vim: expandtab tw=80 ts=4 | 264 | vim: expandtab tw=80 ts=4 |