OSDN Git Service

21f83a742d3a0b3d36d7be8914d676ffd7ecbde3
[pf3gnuchains/gcc-fork.git] / gcc / doc / fragments.texi
1 @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
2 @c 1999, 2000, 2001 Free Software Foundation, Inc.
3 @c This is part of the GCC manual.
4 @c For copying conditions, see the file gcc.texi.
5
6 @node Fragments
7 @chapter Makefile Fragments
8 @cindex makefile fragment
9
10 When you configure GCC using the @file{configure} script
11 (@pxref{Installation}), it will construct the file @file{Makefile} from
12 the template file @file{Makefile.in}.  When it does this, it will
13 incorporate makefile fragment files from the @file{config} directory,
14 named @file{t-@var{target}} and @file{x-@var{host}}.  If these files do
15 not exist, it means nothing needs to be added for a given target or
16 host.
17
18 @menu
19 * Target Fragment:: Writing the @file{t-@var{target}} file.
20 * Host Fragment::   Writing the @file{x-@var{host}} file.
21 @end menu
22
23 @node Target Fragment
24 @section The Target Makefile Fragment
25 @cindex target makefile fragment
26 @cindex @file{t-@var{target}}
27
28 The target makefile fragment, @file{t-@var{target}}, defines special
29 target dependent variables and targets used in the @file{Makefile}:
30
31 @table @code
32 @findex LIBGCC2_CFLAGS
33 @item LIBGCC2_CFLAGS
34 Compiler flags to use when compiling @file{libgcc2.c}.
35
36 @findex LIB2FUNCS_EXTRA
37 @item LIB2FUNCS_EXTRA
38 A list of source file names to be compiled or assembled and inserted
39 into @file{libgcc.a}.
40
41 @findex Floating Point Emulation
42 @item Floating Point Emulation
43 To have GCC include software floating point libraries in @file{libgcc.a}
44 define @code{FPBIT} and @code{DPBIT} along with a few rules as follows:
45 @smallexample
46 # We want fine grained libraries, so use the new code
47 # to build the floating point emulation libraries.
48 FPBIT = fp-bit.c
49 DPBIT = dp-bit.c
50
51
52 fp-bit.c: $(srcdir)/config/fp-bit.c
53         echo '#define FLOAT' > fp-bit.c
54         cat $(srcdir)/config/fp-bit.c >> fp-bit.c
55
56 dp-bit.c: $(srcdir)/config/fp-bit.c
57         cat $(srcdir)/config/fp-bit.c > dp-bit.c
58 @end smallexample
59
60 You may need to provide additional #defines at the beginning of @file{fp-bit.c}
61 and @file{dp-bit.c} to control target endianness and other options.
62
63
64 @findex CRTSTUFF_T_CFLAGS
65 @item CRTSTUFF_T_CFLAGS
66 Special flags used when compiling @file{crtstuff.c}.
67 @xref{Initialization}.
68
69 @findex CRTSTUFF_T_CFLAGS_S
70 @item CRTSTUFF_T_CFLAGS_S
71 Special flags used when compiling @file{crtstuff.c} for shared
72 linking.  Used if you use @file{crtbeginS.o} and @file{crtendS.o}
73 in @code{EXTRA-PARTS}.
74 @xref{Initialization}.
75
76 @findex MULTILIB_OPTIONS
77 @item MULTILIB_OPTIONS
78 For some targets, invoking GCC in different ways produces objects
79 that can not be linked together.  For example, for some targets GCC
80 produces both big and little endian code.  For these targets, you must
81 arrange for multiple versions of @file{libgcc.a} to be compiled, one for
82 each set of incompatible options.  When GCC invokes the linker, it
83 arranges to link in the right version of @file{libgcc.a}, based on
84 the command line options used.
85
86 The @code{MULTILIB_OPTIONS} macro lists the set of options for which
87 special versions of @file{libgcc.a} must be built.  Write options that
88 are mutually incompatible side by side, separated by a slash.  Write
89 options that may be used together separated by a space.  The build
90 procedure will build all combinations of compatible options.
91
92 For example, if you set @code{MULTILIB_OPTIONS} to @samp{m68000/m68020
93 msoft-float}, @file{Makefile} will build special versions of
94 @file{libgcc.a} using the following sets of options:  @option{-m68000},
95 @option{-m68020}, @option{-msoft-float}, @samp{-m68000 -msoft-float}, and
96 @samp{-m68020 -msoft-float}.
97
98 @findex MULTILIB_DIRNAMES
99 @item MULTILIB_DIRNAMES
100 If @code{MULTILIB_OPTIONS} is used, this variable specifies the
101 directory names that should be used to hold the various libraries.
102 Write one element in @code{MULTILIB_DIRNAMES} for each element in
103 @code{MULTILIB_OPTIONS}.  If @code{MULTILIB_DIRNAMES} is not used, the
104 default value will be @code{MULTILIB_OPTIONS}, with all slashes treated
105 as spaces.
106
107 For example, if @code{MULTILIB_OPTIONS} is set to @samp{m68000/m68020
108 msoft-float}, then the default value of @code{MULTILIB_DIRNAMES} is
109 @samp{m68000 m68020 msoft-float}.  You may specify a different value if
110 you desire a different set of directory names.
111
112 @findex MULTILIB_MATCHES
113 @item MULTILIB_MATCHES
114 Sometimes the same option may be written in two different ways.  If an
115 option is listed in @code{MULTILIB_OPTIONS}, GCC needs to know about
116 any synonyms.  In that case, set @code{MULTILIB_MATCHES} to a list of
117 items of the form @samp{option=option} to describe all relevant
118 synonyms.  For example, @samp{m68000=mc68000 m68020=mc68020}.
119
120 @findex MULTILIB_EXCEPTIONS
121 @item MULTILIB_EXCEPTIONS
122 Sometimes when there are multiple sets of @code{MULTILIB_OPTIONS} being
123 specified, there are combinations that should not be built.  In that
124 case, set @code{MULTILIB_EXCEPTIONS} to be all of the switch exceptions
125 in shell case syntax that should not be built.
126
127 For example, in the PowerPC embedded ABI support, it is not desirable
128 to build libraries compiled with the @option{-mcall-aix} option
129 and either of the @option{-fleading-underscore} or @option{-mlittle} options
130 at the same time.  Therefore @code{MULTILIB_EXCEPTIONS} is set to
131 @smallexample
132 *mcall-aix/*fleading-underscore* *mlittle/*mcall-aix*
133 @end smallexample
134
135 @findex MULTILIB_EXTRA_OPTS
136 @item MULTILIB_EXTRA_OPTS
137 Sometimes it is desirable that when building multiple versions of
138 @file{libgcc.a} certain options should always be passed on to the
139 compiler.  In that case, set @code{MULTILIB_EXTRA_OPTS} to be the list
140 of options to be used for all builds.
141 @end table
142
143 @node Host Fragment
144 @section The Host Makefile Fragment
145 @cindex host makefile fragment
146 @cindex @file{x-@var{host}}
147
148 The host makefile fragment, @file{x-@var{host}}, defines special host
149 dependent variables and targets used in the @file{Makefile}:
150
151 @table @code
152 @findex CC
153 @item CC
154 The compiler to use when building the first stage.
155
156 @findex INSTALL
157 @item INSTALL
158 The install program to use.
159 @end table