mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 00:59:48 +00:00
sdk-manual: Review edits to the "Autotools-Based Projects" section.
Autotools is simpler now as it uses "autoreconf" to one-step a bunch of the existing tools such as aclocal and autoconf. I updated the figure to reflect the simpler flow and also the steps that accompany the figure. (From yocto-docs rev: 380cb1bb89003229befb4715e875586c798d6735) Signed-off-by: Scott Rifenbark <srifenbark@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
b15903d61b
commit
0a764481ed
Binary file not shown.
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 49 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 49 KiB |
@@ -50,13 +50,22 @@
|
|||||||
$ mkdir $HOME/helloworld
|
$ mkdir $HOME/helloworld
|
||||||
$ cd $HOME/helloworld
|
$ cd $HOME/helloworld
|
||||||
</literallayout>
|
</literallayout>
|
||||||
After setting up the directory, populate it with three
|
After setting up the directory, populate it with files
|
||||||
simple files needed for the flow.
|
needed for the flow.
|
||||||
You need a project source file, a file to help with
|
You need a project source file, a file to help with
|
||||||
configuration, and a file to help create the Makefile:
|
configuration, and a file to help create the Makefile,
|
||||||
|
and a README file:
|
||||||
<filename>hello.c</filename>,
|
<filename>hello.c</filename>,
|
||||||
<filename>configure.ac</filename>, and
|
<filename>configure.ac</filename>,
|
||||||
<filename>Makefile.am</filename>, respectively:
|
<filename>Makefile.am</filename>, and
|
||||||
|
<filename>README</filename>, respectively.</para>
|
||||||
|
|
||||||
|
<para> Use the following command to create an empty README
|
||||||
|
file, which is required by GNU Coding Standards:
|
||||||
|
<literallayout class='monospaced'>
|
||||||
|
$ touch README
|
||||||
|
</literallayout>
|
||||||
|
Create the remaining three files as follows:
|
||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
<emphasis><filename>hello.c</filename>:</emphasis>
|
<emphasis><filename>hello.c</filename>:</emphasis>
|
||||||
@@ -108,41 +117,26 @@
|
|||||||
$ source /opt/poky/&DISTRO;/environment-setup-i586-poky-linux
|
$ source /opt/poky/&DISTRO;/environment-setup-i586-poky-linux
|
||||||
</literallayout>
|
</literallayout>
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
<listitem><para>
|
|
||||||
<emphasis>Generate the Local <filename>aclocal.m4</filename> Files:</emphasis>
|
|
||||||
The following command generates the local
|
|
||||||
<filename>aclocal.m4</filename> files, which are used
|
|
||||||
later with the <filename>autoconf</filename> command:
|
|
||||||
<literallayout class='monospaced'>
|
|
||||||
$ aclocal
|
|
||||||
</literallayout>
|
|
||||||
</para></listitem>
|
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
<emphasis>Create the <filename>configure</filename> Script:</emphasis>
|
<emphasis>Create the <filename>configure</filename> Script:</emphasis>
|
||||||
The following command creates the
|
Use the <filename>autoreconf</filename> command to
|
||||||
<filename>configure</filename> script:
|
generate the <filename>configure</filename> script.
|
||||||
<literallayout class='monospaced'>
|
<literallayout class='monospaced'>
|
||||||
$ autoconf
|
$ autoreconf
|
||||||
</literallayout>
|
|
||||||
</para></listitem>
|
|
||||||
<listitem><para>
|
|
||||||
<emphasis>Generate Files Needed by GNU Coding
|
|
||||||
Standards:</emphasis>
|
|
||||||
GNU coding standards require certain files in order
|
|
||||||
for the project to be compliant.
|
|
||||||
This command creates those files:
|
|
||||||
<literallayout class='monospaced'>
|
|
||||||
$ touch NEWS README AUTHORS ChangeLog
|
|
||||||
</literallayout>
|
|
||||||
</para></listitem>
|
|
||||||
<listitem><para>
|
|
||||||
<emphasis>Generate the <filename>Makefile.in</filename> File:</emphasis>
|
|
||||||
This command generates the
|
|
||||||
<filename>Makefile.in</filename>, which is used later
|
|
||||||
during cross-compilation:
|
|
||||||
<literallayout class='monospaced'>
|
|
||||||
$ automake -a
|
|
||||||
</literallayout>
|
</literallayout>
|
||||||
|
The <filename>autoreconf</filename> tool takes care
|
||||||
|
of running the other Autotools such as
|
||||||
|
<filename>aclocal</filename>,
|
||||||
|
<filename>autoconf</filename>, and
|
||||||
|
<filename>automake</filename>.
|
||||||
|
<note>
|
||||||
|
If you get errors from
|
||||||
|
<filename>configure.ac</filename>, which
|
||||||
|
<filename>autoreconf</filename> runs, that indicate
|
||||||
|
missing files, you can use the "-i" option, which
|
||||||
|
ensures missing auxiliary files are copied to the build
|
||||||
|
host.
|
||||||
|
</note>
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
<emphasis>Cross-Compile the Project:</emphasis>
|
<emphasis>Cross-Compile the Project:</emphasis>
|
||||||
@@ -159,33 +153,18 @@
|
|||||||
cross-toolchain by just passing the appropriate host
|
cross-toolchain by just passing the appropriate host
|
||||||
option to <filename>configure.sh</filename>.
|
option to <filename>configure.sh</filename>.
|
||||||
The host option you use is derived from the name of the
|
The host option you use is derived from the name of the
|
||||||
environment setup script found in the directory in which you
|
environment setup script found in the directory in which
|
||||||
installed the cross-toolchain.
|
you installed the cross-toolchain.
|
||||||
For example, the host option for an ARM-based target that uses
|
For example, the host option for an ARM-based target that
|
||||||
the GNU EABI is
|
uses the GNU EABI is
|
||||||
<filename>armv5te-poky-linux-gnueabi</filename>.
|
<filename>armv5te-poky-linux-gnueabi</filename>.
|
||||||
You will notice that the name of the script is
|
You will notice that the name of the script is
|
||||||
<filename>environment-setup-armv5te-poky-linux-gnueabi</filename>.
|
<filename>environment-setup-armv5te-poky-linux-gnueabi</filename>.
|
||||||
Thus, the following command works to update your project
|
Thus, the following command works to update your project
|
||||||
and rebuild it using the appropriate cross-toolchain tools:
|
and rebuild it using the appropriate cross-toolchain tools:
|
||||||
<literallayout class='monospaced'>
|
<literallayout class='monospaced'>
|
||||||
$ ./configure --host=armv5te-poky-linux-gnueabi \
|
$ ./configure --host=armv5te-poky-linux-gnueabi --with-libtool-sysroot=<replaceable>sysroot_dir</replaceable>
|
||||||
--with-libtool-sysroot=<replaceable>sysroot_dir</replaceable>
|
|
||||||
</literallayout>
|
</literallayout>
|
||||||
<note>
|
|
||||||
If the <filename>configure</filename> script results in
|
|
||||||
problems recognizing the
|
|
||||||
<filename>--with-libtool-sysroot=</filename><replaceable>sysroot-dir</replaceable>
|
|
||||||
option, regenerate the script to enable the support by
|
|
||||||
doing the following and then run the script again:
|
|
||||||
<literallayout class='monospaced'>
|
|
||||||
$ libtoolize --automake
|
|
||||||
$ aclocal -I ${OECORE_TARGET_SYSROOT}/usr/share/aclocal [-I <replaceable>dir_containing_your_project-specific_m4_macros</replaceable>]
|
|
||||||
$ autoconf
|
|
||||||
$ autoheader
|
|
||||||
$ automake -a
|
|
||||||
</literallayout>
|
|
||||||
</note>
|
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
<emphasis>Make and Install the Project:</emphasis>
|
<emphasis>Make and Install the Project:</emphasis>
|
||||||
@@ -215,12 +194,12 @@
|
|||||||
</para></listitem>
|
</para></listitem>
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
<emphasis>Execute Your Project:</emphasis>
|
<emphasis>Execute Your Project:</emphasis>
|
||||||
To execute the project in the shell, simply enter
|
To execute the project, you would need to run it on your
|
||||||
the name.
|
target hardware.
|
||||||
You could also copy the binary to the actual target
|
If your target hardware happens to be your build host,
|
||||||
hardware and run the project there as well:
|
you could run the project as follows:
|
||||||
<literallayout class='monospaced'>
|
<literallayout class='monospaced'>
|
||||||
$ ./hello
|
$ ./tmp/usr/local/bin/hello
|
||||||
</literallayout>
|
</literallayout>
|
||||||
As expected, the project displays the "Hello World!"
|
As expected, the project displays the "Hello World!"
|
||||||
message.
|
message.
|
||||||
|
|||||||
Reference in New Issue
Block a user