Lines Matching +full:directory +full:- +full:based

1 .. SPDX-License-Identifier: CC-BY-SA-2.0-UK
7 You can use the SDK toolchain directly with Makefile and Autotools-based
10 Autotools-Based Projects
13 Once you have a suitable :ref:`sdk-manual/intro:the cross-development toolchain`
15 Autotools-based <https://en.wikipedia.org/wiki/GNU_Build_System>`__
20 .. image:: figures/sdk-autotools-flow.png
23 Follow these steps to create a simple Autotools-based "Hello World"
33 1. *Create a Working Directory and Populate It:* Create a clean
34 directory for your project and then make that directory your working
41 After setting up the directory, populate it with files needed for the flow.
55 - ``hello.c``::
64 - ``configure.ac``::
72 - ``Makefile.am``::
77 2. *Source the Cross-Toolchain Environment Setup File:* As described
78 earlier in the manual, installing the cross-toolchain creates a
79 cross-toolchain environment setup script in the directory that the
82 the string "environment-setup" and contains the machine architecture,
83 which is followed by the string "poky-linux". For this example, the
84 command sources a script from the default SDK installation directory
85 that uses the 32-bit Intel x86 Architecture and the &DISTRO; Yocto
88 $ source /opt/poky/&DISTRO;/environment-setup-i586-poky-linux
103 runs, that indicate missing files, you can use the "-i" option,
107 4. *Cross-Compile the Project:* This command compiles the project using
108 the cross-compiler. The
115 For an Autotools-based
116 project, you can use the cross-toolchain by just passing the
119 directory in which you installed the cross-toolchain. For example,
120 the host option for an ARM-based target that uses the GNU EABI is
121 ``armv5te-poky-linux-gnueabi``. You will notice that the name of the
122 script is ``environment-setup-armv5te-poky-linux-gnueabi``. Thus, the
124 the appropriate cross-toolchain tools::
126 $ ./configure --host=armv5te-poky-linux-gnueabi --with-libtool-sysroot=sysroot_dir
129 install the project into the destination directory::
137 cross-toolchain environment setup script and how they are used or
139 :ref:`sdk-manual/working-projects:makefile-based projects` section.
144 architecture that the installed cross-toolchain supports.
157 Makefile-Based Projects
160 Simple Makefile-based projects use and interact with the cross-toolchain
161 environment variables established when you run the cross-toolchain
166 example that lets you see how you can use cross-toolchain environment
169 .. image:: figures/sdk-makefile-flow.png
175 - *Case 1 - No Variables Set in the Makefile Map to Equivalent
178 retain their values based on the environment setup script.
180 - *Case 2 - Variables Are Set in the Makefile that Map to Equivalent
187 - *Case 3 - Variables Are Set Using the Command Line that Map to
191 command-line content is used.
195 Regardless of how you set your variables, if you use the "-e" option
198 $ make -e target
215 SDK setup script for a 64-bit build host and an i586-tuned target
216 architecture for a ``core-image-sato`` image using the current &DISTRO;
220 $ source /opt/poky/&DISTRO;/environment-setup-i586-poky-linux
222 i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/&DISTRO;/sysroots/i586-poky-linux
227 1. *Create a Working Directory and Populate It:* Create a clean
228 directory for your project and then make that directory your working
236 setting up the directory, populate it with files needed for the flow.
243 - ``main.c``::
253 - ``module.h``::
258 - ``module.c``::
267 2. *Source the Cross-Toolchain Environment Setup File:* As described
268 earlier in the manual, installing the cross-toolchain creates a
269 cross-toolchain environment setup script in the directory that the
272 the string "environment-setup" and contains the machine architecture,
273 which is followed by the string "poky-linux". For this example, the
274 command sources a script from the default SDK installation directory
275 that uses the 32-bit Intel x86 Architecture and the &DISTRO_NAME; Yocto
278 $ source /opt/poky/&DISTRO;/environment-setup-i586-poky-linux
286 # CC=i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux
289 ${CC} main.o module.o -o target_bin
291 ${CC} -I . -c main.c
293 module.h ${CC} -I . -c module.c
295 rm -rf *.o
304 …i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux -I . -c main…
305 …i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux -I . -c modu…
306 …i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux main.o modul…
318 rm -rf *.o
324 gcc -I . -c main.c
325 gcc -I . -c module.c
326 gcc main.o module.o -o target_bin
329 cross-toolchain compiler is not used. Rather, the default compiler is
334 re-insert the comment character so that running ``make`` uses the
336 command-line argument to set :term:`CC` to "gcc"::
339 rm -rf *.o
345 …i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux -I . -c mai…
346 …i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux -I . -c mod…
347 …i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux main.o modu…
349 rm -rf *.o
352 gcc -I . -c main.c
353 gcc -I . -c module.c
354 gcc main.o module.o -o target_bin
356 In the previous case, the command-line argument overrides the SDK
360 then use the "-e" option on the ``make`` command line::
363 rm -rf *.o
369 gcc -I . -c main.c
370 gcc -I . -c module.c
371 gcc main.o module.o -o target_bin
373 rm -rf *.o
375 $ make -e
376 …i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux -I . -c mai…
377 …i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux -I . -c mod…
378 …i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux main.o modu…
380 In the previous case, the "-e" option forces ``make`` to
392 If you used the cross-toolchain compiler to build