<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../../general.ent">
  %general-entities;
]>

<sect1 id="ch-cross-tools-variables">
  <?dbhtml filename="variables.html"?>

  <title>Build Variables</title>

  <bridgehead renderas="sect4">Setting Host and Target</bridgehead>

  <para os="a">During the building of the cross-compile tools you will need to
  set a few variables that will be dependent on your particular needs.
  You will need to set the target triplet for the target architecture, the CPU
  type, and CPU endianess. If you do not know what triplet or CPU type you want,
  you can use the table at the bottom of this page as a reference. Set
  the command using the method listed below:</para>

<screen os="b"><userinput>export CLFS_HOST=$(echo ${MACHTYPE} | sed "s/-[^-]*/-cross/")
export CLFS_TARGET=<replaceable>[target triplet]</replaceable>
export CLFS_CPU=<replaceable>[cpu type]</replaceable></userinput></screen>

  <para os="c">Now we will set the architecture and endianess of the CPU based
  on the target triplet provided above:</para>

<screen os="d"><userinput>export CLFS_ARCH=$(echo ${CLFS_TARGET} | sed -e 's/-.*//' -e 's/i.86/i386/')
export CLFS_ENDIAN=little</userinput></screen>

  <para os="g">Now we will add this to <filename>~/.bashrc</filename>, just in
  case you have to exit and restart building later:</para>

<screen os="h"><userinput>echo export CLFS_HOST=\""${CLFS_HOST}\"" &gt;&gt; ~/.bashrc
echo export CLFS_TARGET=\""${CLFS_TARGET}\"" &gt;&gt; ~/.bashrc
echo export CLFS_ARCH=\""${CLFS_ARCH}\"" &gt;&gt; ~/.bashrc
echo export CLFS_ENDIAN=\""${CLFS_ENDIAN}\"" &gt;&gt; ~/.bashrc
echo export CLFS_CPU=\""${CLFS_CPU}\"" &gt;&gt; ~/.bashrc</userinput></screen>

  <table os="i">
    <title>Processor Type and  Target Triplets</title>
    <?dbfo table-width="7.5in" ?>

    <tgroup cols="4">

      <colspec colnum="1" colwidth="2.5in"   colname="Processor"/>
      <colspec colnum="2" colwidth="2in" colname="Triplet"/>
      <colspec colnum="3" colwidth="0.5in" colname="CPU Type"/>
      <colspec colnum="4" colwidth="2.5in" colname="Note"/>

      <thead>
        <row>
          <entry>Processor</entry>
          <entry>Target Triplet</entry>
          <entry>CPU Type</entry>
          <entry>Note</entry>
        </row>
      </thead>

      <tbody>
        <row>
          <entry>486 Compatibles</entry>
          <entry>i486-pc-linux-musl</entry>
          <entry>i486</entry>
          <entry>Intel's i486</entry>
        </row>
        <row>
          <entry>Pentium, K6, 586 Compatibles</entry>
          <entry>i586-pc-linux-musl</entry>
          <entry>i586</entry>
          <entry>Intel Pentium without MMX</entry>
        </row>
        <row>
          <entry>Pentium II, Pentium III, Pentium 4</entry>
          <entry>i686-pc-linux-musl</entry>
          <entry>i686</entry>
          <entry>PentiumPro instruction set</entry>
        </row>
        <row>
          <entry>Athlon</entry>
          <entry>i686-pc-linux-musl</entry>
          <entry>athlon</entry>
          <entry>AMD 32 bit Athlon</entry>
        </row>
        <row>
          <entry>Opteron</entry>
          <entry>x86_64-unknown-linux-musl</entry>
          <entry>k8</entry>
          <entry>AMD K8 processors with x86-64</entry>
        </row>
      </tbody>

    </tgroup>

  </table>

</sect1>
