Files
2024-02-19 00:21:47 -05:00

263 lines
14 KiB
HTML

<HTML>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- Created on March, 17 2001 by texi2html 1.64 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de>
Send bugs and suggestions to <texi2html@mathematik.uni-kl.de>
-->
<HEAD>
<TITLE>Using and Porting the GNU Compiler Collection (GCC): Fragments</TITLE>
<META NAME="description" CONTENT="Using and Porting the GNU Compiler Collection (GCC): Fragments">
<META NAME="keywords" CONTENT="Using and Porting the GNU Compiler Collection (GCC): Fragments">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META NAME="Generator" CONTENT="texi2html 1.64">
</HEAD>
<BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<A NAME="SEC252"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_18.html#SEC251" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_18.html#SEC251"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_19.html#SEC253" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_19.html#SEC253"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_2.html#SEC2" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_2.html#SEC2"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[ &gt;&gt; ]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> 19. Makefile Fragments </H1>
<!--docid::SEC252::-->
<P>
When you configure GCC using the <TT>`configure'</TT> script
(see section <A HREF="gcc_3.html#SEC46" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_3.html#SEC46">3. Installing GNU CC</A>), it will construct the file <TT>`Makefile'</TT> from
the template file <TT>`Makefile.in'</TT>. When it does this, it will
incorporate makefile fragment files from the <TT>`config'</TT> directory,
named <TT>`t-<VAR>target</VAR>'</TT> and <TT>`x-<VAR>host</VAR>'</TT>. If these files do
not exist, it means nothing needs to be added for a given target or
host.
</P><P>
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_19.html#SEC253" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_19.html#SEC253">19.1 The Target Makefile Fragment</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Writing the <TT>`t-<VAR>target</VAR>'</TT> file.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_19.html#SEC254" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_19.html#SEC254">19.2 The Host Makefile Fragment</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Writing the <TT>`x-<VAR>host</VAR>'</TT> file.</TD></TR>
</TABLE></BLOCKQUOTE>
<P>
<A NAME="Target Fragment"></A>
<HR SIZE="6">
<A NAME="SEC253"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_19.html#SEC252" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_19.html#SEC252"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_19.html#SEC254" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_19.html#SEC254"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_19.html#SEC252" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_19.html#SEC252"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_19.html#SEC252" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_19.html#SEC252"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[ &gt;&gt; ]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 19.1 The Target Makefile Fragment </H2>
<!--docid::SEC253::-->
<P>
The target makefile fragment, <TT>`t-<VAR>target</VAR>'</TT>, defines special
target dependent variables and targets used in the <TT>`Makefile'</TT>:
</P><P>
<DL COMPACT>
<A NAME="IDX1849"></A>
<DT><CODE>LIBGCC1</CODE>
<DD>The rule to use to build <TT>`libgcc1.a'</TT>.
If your target does not need to use the functions in <TT>`libgcc1.a'</TT>,
set this to empty.
See section <A HREF="gcc_13.html#SEC147" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_13.html#SEC147">13. Interfacing to GCC Output</A>.
<P>
<A NAME="IDX1850"></A>
<DT><CODE>CROSS_LIBGCC1</CODE>
<DD>The rule to use to build <TT>`libgcc1.a'</TT> when building a cross
compiler. If your target does not need to use the functions in
<TT>`libgcc1.a'</TT>, set this to empty. See section <A HREF="gcc_3.html#SEC54" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_3.html#SEC54">3.4.4 <TT>`libgcc.a'</TT> and Cross-Compilers</A>.
<P>
<A NAME="IDX1851"></A>
<DT><CODE>LIBGCC2_CFLAGS</CODE>
<DD>Compiler flags to use when compiling <TT>`libgcc2.c'</TT>.
<P>
<A NAME="IDX1852"></A>
<DT><CODE>LIB2FUNCS_EXTRA</CODE>
<DD>A list of source file names to be compiled or assembled and inserted
into <TT>`libgcc.a'</TT>.
<P>
<A NAME="IDX1853"></A>
<DT><CODE>CRTSTUFF_T_CFLAGS</CODE>
<DD>Special flags used when compiling <TT>`crtstuff.c'</TT>.
See section <A HREF="gcc_17.html#SEC237" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC237">17.16.5 How Initialization Functions Are Handled</A>.
<P>
<A NAME="IDX1854"></A>
<DT><CODE>CRTSTUFF_T_CFLAGS_S</CODE>
<DD>Special flags used when compiling <TT>`crtstuff.c'</TT> for shared
linking. Used if you use <TT>`crtbeginS.o'</TT> and <TT>`crtendS.o'</TT>
in <CODE>EXTRA-PARTS</CODE>.
See section <A HREF="gcc_17.html#SEC237" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC237">17.16.5 How Initialization Functions Are Handled</A>.
<P>
<A NAME="IDX1855"></A>
<DT><CODE>MULTILIB_OPTIONS</CODE>
<DD>For some targets, invoking GCC in different ways produces objects
that can not be linked together. For example, for some targets GCC
produces both big and little endian code. For these targets, you must
arrange for multiple versions of <TT>`libgcc.a'</TT> to be compiled, one for
each set of incompatible options. When GCC invokes the linker, it
arranges to link in the right version of <TT>`libgcc.a'</TT>, based on
the command line options used.
<P>
The <CODE>MULTILIB_OPTIONS</CODE> macro lists the set of options for which
special versions of <TT>`libgcc.a'</TT> must be built. Write options that
are mutually incompatible side by side, separated by a slash. Write
options that may be used together separated by a space. The build
procedure will build all combinations of compatible options.
</P><P>
For example, if you set <CODE>MULTILIB_OPTIONS</CODE> to <SAMP>`m68000/m68020
msoft-float'</SAMP>, <TT>`Makefile'</TT> will build special versions of
<TT>`libgcc.a'</TT> using the following sets of options: <SAMP>`-m68000'</SAMP>,
<SAMP>`-m68020'</SAMP>, <SAMP>`-msoft-float'</SAMP>, <SAMP>`-m68000 -msoft-float'</SAMP>, and
<SAMP>`-m68020 -msoft-float'</SAMP>.
</P><P>
<A NAME="IDX1856"></A>
<DT><CODE>MULTILIB_DIRNAMES</CODE>
<DD>If <CODE>MULTILIB_OPTIONS</CODE> is used, this variable specifies the
directory names that should be used to hold the various libraries.
Write one element in <CODE>MULTILIB_DIRNAMES</CODE> for each element in
<CODE>MULTILIB_OPTIONS</CODE>. If <CODE>MULTILIB_DIRNAMES</CODE> is not used, the
default value will be <CODE>MULTILIB_OPTIONS</CODE>, with all slashes treated
as spaces.
<P>
For example, if <CODE>MULTILIB_OPTIONS</CODE> is set to <SAMP>`m68000/m68020
msoft-float'</SAMP>, then the default value of <CODE>MULTILIB_DIRNAMES</CODE> is
<SAMP>`m68000 m68020 msoft-float'</SAMP>. You may specify a different value if
you desire a different set of directory names.
</P><P>
<A NAME="IDX1857"></A>
<DT><CODE>MULTILIB_MATCHES</CODE>
<DD>Sometimes the same option may be written in two different ways. If an
option is listed in <CODE>MULTILIB_OPTIONS</CODE>, GCC needs to know about
any synonyms. In that case, set <CODE>MULTILIB_MATCHES</CODE> to a list of
items of the form <SAMP>`option=option'</SAMP> to describe all relevant
synonyms. For example, <SAMP>`m68000=mc68000 m68020=mc68020'</SAMP>.
<P>
<A NAME="IDX1858"></A>
<DT><CODE>MULTILIB_EXCEPTIONS</CODE>
<DD>Sometimes when there are multiple sets of <CODE>MULTILIB_OPTIONS</CODE> being
specified, there are combinations that should not be built. In that
case, set <CODE>MULTILIB_EXCEPTIONS</CODE> to be all of the switch exceptions
in shell case syntax that should not be built.
<P>
For example, in the PowerPC embedded ABI support, it was not desirable
to build libraries that compiled with the <SAMP>`-mcall-aixdesc'</SAMP> option
and either of the <SAMP>`-mcall-aixdesc'</SAMP> or <SAMP>`-mlittle'</SAMP> options at
the same time, and therefore <CODE>MULTILIB_EXCEPTIONS</CODE> is set to
<CODE>*mrelocatable/*mcall-aixdesc* *mlittle/*mcall-aixdesc*</CODE>.
</P><P>
<A NAME="IDX1859"></A>
<DT><CODE>MULTILIB_EXTRA_OPTS</CODE>
<DD>Sometimes it is desirable that when building multiple versions of
<TT>`libgcc.a'</TT> certain options should always be passed on to the
compiler. In that case, set <CODE>MULTILIB_EXTRA_OPTS</CODE> to be the list
of options to be used for all builds.
</DL>
<P>
<A NAME="Host Fragment"></A>
<HR SIZE="6">
<A NAME="SEC254"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_19.html#SEC253" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_19.html#SEC253"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_20.html#SEC255" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_20.html#SEC255"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_19.html#SEC252" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_19.html#SEC252"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_19.html#SEC252" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_19.html#SEC252"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[ &gt;&gt; ]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 19.2 The Host Makefile Fragment </H2>
<!--docid::SEC254::-->
<P>
The host makefile fragment, <TT>`x-<VAR>host</VAR>'</TT>, defines special host
dependent variables and targets used in the <TT>`Makefile'</TT>:
</P><P>
<DL COMPACT>
<A NAME="IDX1860"></A>
<DT><CODE>CC</CODE>
<DD>The compiler to use when building the first stage.
<P>
<A NAME="IDX1861"></A>
<DT><CODE>CLIB</CODE>
<DD>Additional host libraries to link with.
<P>
<A NAME="IDX1862"></A>
<DT><CODE>OLDCC</CODE>
<DD>The compiler to use when building <TT>`libgcc1.a'</TT> for a native
compilation.
<P>
<A NAME="IDX1863"></A>
<DT><CODE>OLDAR</CODE>
<DD>The version of <CODE>ar</CODE> to use when building <TT>`libgcc1.a'</TT> for a native
compilation.
<P>
<A NAME="IDX1864"></A>
<DT><CODE>INSTALL</CODE>
<DD>The install program to use.
</DL>
<P>
<A NAME="Funding"></A>
<HR SIZE="6">
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_19.html#SEC252" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_19.html#SEC252"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[ &gt;&gt; ]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<BR>
<FONT SIZE="-1">
This document was generated
by <I>GCC Administrator</I> on <I>March, 17 2001</I>
using <A HREF="tppmsgs/msgs0.htm#1" tppabs="http://www.mathematik.uni-kl.de/~obachman/Texi2html"><I>texi2html</I></A>
</BODY>
</HTML>