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

<sect1 id="ch-cross-tools-flags">
  <title>Build Flags</title>
  <?dbhtml filename="flags.html"?>

  <para>We will need to setup target specific flags for the compiler
  and linkers. You can choose the appropriate BUILD32 and BUILD64
  from the table at the bottom of the page.</para>

<screen><userinput>export BUILD32="[BUILD32 entries]"
export BUILD64="[BUILD64 entries]"
export GCCTARGET="[GCCTARGET entries]"</userinput></screen>

  <para>You will need to set your host target triplet for 32 bit:</para>

<screen><userinput>export LFS_TARGET32="sparcv9-unknown-linux-gnu"</userinput></screen>

  <para>Let's perform a sanity check to prevent build issues. If our LFS_HOST matches our
  target, we will get some failures during our cross-compile:</para>

<screen><userinput>if [ "${LFS_HOST}" = "${LFS_TARGET32}" ]; then \
  echo "Host and Target can't be the same." ; fi</userinput></screen>

  <para>If the above test gave you "Host and Target can't be the same", you will need to change your LFS_HOST to a
  a different target triplet:</para>

<screen><userinput>export LFS_HOST="`echo ${MACHTYPE} | sed -e 's/unknown/cross/g' -e 's/-pc-/-cross-/g'`"</userinput></screen>

  <para>Lets add the build flags to <filename>~/.bashrc</filename> to
  prevent issues if we stop and come back later.</para>

<screen><userinput>echo export BUILD32=\""${BUILD32}\"" &gt;&gt; ~/.bashrc
echo export BUILD64=\""${BUILD64}\"" &gt;&gt; ~/.bashrc
echo export GCCTARGET=\""${GCCTARGET}\"" &gt;&gt; ~/.bashrc
echo export LFS_TARGET32=\""${LFS_TARGET32}\"" &gt;&gt; ~/.bashrc
echo export LFS_HOST=\""${LFS_HOST}\"" &gt;&gt; ~/.bashrc</userinput></screen>

  <para>The following table gives the entires for different Sparc 64 capable
  processors. Pick the processor that matches your system.</para>

  <table>
    <title>List of architectures, target triplets, and recommended book</title>
    <tgroup cols="2" align="center">
      <colspec colname="Processor"/>
      <colspec colname="Build32"/>
      <colspec colname="Build64"/>
      <colspec colname="GCC"/>
      <thead>
        <row>
          <entry>Processor</entry>
          <entry>BUILD32</entry>
          <entry>BUILD64</entry>
          <entry>GCCTARGET</entry>
        </row>
      </thead>
      <tbody>
        <row>
          <entry>Ultrasparc and Ultrasparc2</entry>
          <entry>-m32 -mcpu=ultrasparc -mtune=ultrasparc</entry>
          <entry>-m64 -mcpu=ultrasparc -mtune=ultrasparc</entry>
          <entry>-mcpu=ultrasparc -mtune=ultrasparc</entry>
        </row>
        <row>
          <entry>Ultrasparc3</entry>
          <entry>-m32 -mcpu=ultrasparc3 -mtune=ultrasparc3</entry>
          <entry>-m64 -mcpu=ultrasparc3 -mtune=ultrasparc3</entry>
          <entry>-mcpu=ultrasparc3 -mtune=ultrasparc3</entry>
        </row>
      </tbody>
    </tgroup>
  </table>

</sect1>

