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