]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/doc/makefile.texi
re PR bootstrap/25670 (build fail with 'make all-gcc')
[thirdparty/gcc.git] / gcc / doc / makefile.texi
CommitLineData
0ea5865c 1@c Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
73a8ed7e
JM
2@c This is part of the GCC manual.
3@c For copying conditions, see the file gcc.texi.
4
5@node Makefile
0a553c7e 6@subsection Makefile Targets
73a8ed7e
JM
7@cindex makefile targets
8@cindex targets, makefile
9
cc11cc9b
PB
10These targets are available from the @samp{gcc} directory:
11
73a8ed7e
JM
12@table @code
13@item all
14This is the default target. Depending on what your build/host/target
15configuration is, it coordinates all the things that need to be built.
16
17@item doc
ce5c1cf3
KC
18Produce info-formatted documentation and man pages. Essentially it
19calls @samp{make man} and @samp{make info}.
20
21@item dvi
22Produce DVI-formatted documentation.
23
9d65c5cb
MS
24@item html
25Produce HTML-formatted documentation.
26
ce5c1cf3
KC
27@item man
28Generate man pages.
29
30@item info
31Generate info-formatted pages.
73a8ed7e
JM
32
33@item mostlyclean
34Delete the files made while building the compiler.
35
36@item clean
7ba4ca63 37That, and all the other files built by @samp{make all}.
73a8ed7e
JM
38
39@item distclean
7ba4ca63 40That, and all the files created by @command{configure}.
73a8ed7e 41
73a8ed7e
JM
42@item maintainer-clean
43Distclean plus any file that can be generated from other files. Note
44that additional tools may be required beyond what is normally needed to
45build gcc.
46
ce5c1cf3
KC
47@item srcextra
48Generates files in the source directory that do not exist in CVS but
da543234
JM
49should go into a release tarball. One example is @file{gcc/java/parse.c}
50which is generated from the CVS source file @file{gcc/java/parse.y}.
ce5c1cf3
KC
51
52@item srcinfo
53@itemx srcman
54Copies the info-formatted and manpage documentation into the source
55directory usually for the purpose of generating a release tarball.
56
73a8ed7e
JM
57@item install
58Installs gcc.
59
60@item uninstall
61Deletes installed files.
62
63@item check
64Run the testsuite. This creates a @file{testsuite} subdirectory that
65has various @file{.sum} and @file{.log} files containing the results of
7ba4ca63 66the testing. You can run subsets with, for example, @samp{make check-gcc}.
73a8ed7e
JM
67You can specify specific tests by setting RUNTESTFLAGS to be the name
68of the @file{.exp} file, optionally followed by (for some tests) an equals
69and a file wildcard, like:
70
478c9e72 71@smallexample
73a8ed7e 72make check-gcc RUNTESTFLAGS="execute.exp=19980413-*"
478c9e72 73@end smallexample
73a8ed7e
JM
74
75Note that running the testsuite may require additional tools be
76installed, such as TCL or dejagnu.
cc11cc9b 77@end table
73a8ed7e 78
cc11cc9b
PB
79The toplevel tree from which you start GCC compilation is not
80the GCC directory, but rather a complex Makefile that coordinates
81the various steps of the build, including bootstrapping the compiler
82and using the new compiler to build target libraries.
83
84When GCC is configured for a native configuration, the default action
85for @command{make} is to do a full three-stage bootstrap. This means
86that GCC is built three times---once with the native compiler, once with
87the native-built compiler it just built, and once with the compiler it
88built the second time. In theory, the last two should produce the same
89results, which @samp{make compare} can check. Each stage is configured
90separately and compiled into a separate directory, to minimize problems
91due to ABI incompatibilities between the native compiler and GCC.
92
93If you do a change, rebuilding will also start from the first stage
94and ``bubble'' up the change through the three stages. Each stage
95is taken from its build directory (if it had been built previously),
96rebuilt, and copied to its subdirectory. This will allow you to, for
97example, continue a bootstrap after fixing a bug which causes the
98stage2 build to crash. It does not provide as good coverage of the
99compiler as bootstrapping from scratch, but it ensures that the new
100code is syntactically correct (e.g. that you did not use GCC extensions
101by mistake), and avoids spurious bootstrap comparison
102failures@footnote{Except if the compiler was buggy and miscompiled
103 some of the files that were not modified. In this case, it's best
104 to use @command{make restrap}.}.
105
106Other targets available from the top level include:
73a8ed7e 107
cc11cc9b 108@table @code
73a8ed7e
JM
109@item bootstrap-lean
110Like @code{bootstrap}, except that the various stages are removed once
111they're no longer needed. This saves disk space.
112
cc11cc9b
PB
113@item bootstrap2
114@itemx bootstrap2-lean
115Performs only the first two stages of bootstrap. Unlike a three-stage
116bootstrap, this does not perform a comparison to test that the compiler
117is running properly. Note that the disk space required by a ``lean''
118bootstrap is approximately independent of the number of stages.
73a8ed7e 119
cc11cc9b
PB
120@item stage@var{N}-bubble (@var{N} = 1@dots{}4)
121Rebuild all the stages up to @var{N}, with the appropriate flags,
122``bubbling'' the changes as described above.
73a8ed7e 123
cc11cc9b
PB
124@item all-stage@var{N} (@var{N} = 1@dots{}4)
125Assuming that stage @var{N} has already been built, rebuild it with the
126appropriate flags. This is rarely needed.
73a8ed7e 127
cc11cc9b
PB
128@item cleanstrap
129Remove everything (@samp{make clean}) and rebuilds (@samp{make bootstrap}).
73a8ed7e
JM
130
131@item compare
132Compares the results of stages 2 and 3. This ensures that the compiler
133is running properly, since it should produce the same object files
134regardless of how it itself was compiled.
135
026fe6c8
PE
136@item profiledbootstrap
137Builds a compiler with profiling feedback information. For more
138information, see
139@ref{Building,,Building with profile feedback,gccinstall,Installing GCC}.
cc11cc9b
PB
140
141@item restrap
142Restart a bootstrap, so that everything that was not built with
143the system compiler is rebuilt.
144
145@item stage@var{N}-start (@var{N} = 1@dots{}4)
146For each package that is bootstrapped, rename directories so that,
147for example, @file{gcc} points to the stage@var{N} GCC, compiled
148with the stage@var{N-1} GCC@footnote{Customarily, the system compiler
149 is also termed the @file{stage0} GCC.}.
150
151You will invoke this target if you need to test or debug the
152stage@var{N} GCC. If you only need to execute GCC (but you need
153not run @samp{make} either to rebuild it or to run test suites),
154you should be able to work directly in the @file{stage@var{N}-gcc}
155directory. This makes it easier to debug multiple stages in
156parallel.
157
158@item stage
159For each package that is bootstrapped, relocate its build directory
160to indicate its stage. For example, if the @file{gcc} directory
161points to the stage2 GCC, after invoking this target it will be
162renamed to @file{stage2-gcc}.
026fe6c8 163
73a8ed7e 164@end table
cc11cc9b
PB
165
166If you wish to use non-default GCC flags when compiling the stage2 and
167stage3 compilers, set @code{BOOT_CFLAGS} on the command line when doing
168@samp{make}.
169
170Usually, the first stage only builds the languages that the compiler
171is written in: typically, C and maybe Ada. If you are debugging a
172miscompilation of a different stage2 front-end (for example, of the
173Fortran front-end), you may want to have front-ends for other languages
174in the first stage as well. To do so, set @code{STAGE1_LANGUAGES}
175on the command line when doing @samp{make}.
176
177For example, in the aforementioned scenario of debugging a Fortran
178front-end miscompilation caused by the stage1 compiler, you may need a
179command like
180
181@example
182make stage2-bubble STAGE1_LANGUAGES=c,fortran
183@end example
184
185Alternatively, you can use per-language targets to build and test
186languages that are not enabled by default in stage1. For example,
187@command{make f951} will build a Fortran compiler even in the stage1
188build directory.
189