📄 makefile.texi
字号:
@c Copyright (C) 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.@c This is part of the GCC manual.@c For copying conditions, see the file gcc.texi.@node Makefile@subsection Makefile Targets@cindex makefile targets@cindex targets, makefileThese targets are available from the @samp{gcc} directory:@table @code@item allThis is the default target. Depending on what your build/host/targetconfiguration is, it coordinates all the things that need to be built.@item docProduce info-formatted documentation and man pages. Essentially itcalls @samp{make man} and @samp{make info}.@item dviProduce DVI-formatted documentation.@item pdfProduce PDF-formatted documentation.@item htmlProduce HTML-formatted documentation.@item manGenerate man pages.@item infoGenerate info-formatted pages.@item mostlycleanDelete the files made while building the compiler.@item cleanThat, and all the other files built by @samp{make all}.@item distcleanThat, and all the files created by @command{configure}.@item maintainer-cleanDistclean plus any file that can be generated from other files. Notethat additional tools may be required beyond what is normally needed tobuild gcc.@item srcextraGenerates files in the source directory that do not exist in CVS butshould go into a release tarball. One example is @file{gcc/java/parse.c}which is generated from the CVS source file @file{gcc/java/parse.y}.@item srcinfo@itemx srcmanCopies the info-formatted and manpage documentation into the sourcedirectory usually for the purpose of generating a release tarball.@item installInstalls gcc.@item uninstallDeletes installed files.@item checkRun the testsuite. This creates a @file{testsuite} subdirectory thathas various @file{.sum} and @file{.log} files containing the results ofthe testing. You can run subsets with, for example, @samp{make check-gcc}.You can specify specific tests by setting RUNTESTFLAGS to be the nameof the @file{.exp} file, optionally followed by (for some tests) an equalsand a file wildcard, like:@smallexamplemake check-gcc RUNTESTFLAGS="execute.exp=19980413-*"@end smallexampleNote that running the testsuite may require additional tools beinstalled, such as TCL or dejagnu.@end tableThe toplevel tree from which you start GCC compilation is notthe GCC directory, but rather a complex Makefile that coordinatesthe various steps of the build, including bootstrapping the compilerand using the new compiler to build target libraries.When GCC is configured for a native configuration, the default actionfor @command{make} is to do a full three-stage bootstrap. This meansthat GCC is built three times---once with the native compiler, once withthe native-built compiler it just built, and once with the compiler itbuilt the second time. In theory, the last two should produce the sameresults, which @samp{make compare} can check. Each stage is configuredseparately and compiled into a separate directory, to minimize problemsdue to ABI incompatibilities between the native compiler and GCC.If you do a change, rebuilding will also start from the first stageand ``bubble'' up the change through the three stages. Each stageis taken from its build directory (if it had been built previously),rebuilt, and copied to its subdirectory. This will allow you to, forexample, continue a bootstrap after fixing a bug which causes thestage2 build to crash. It does not provide as good coverage of thecompiler as bootstrapping from scratch, but it ensures that the newcode is syntactically correct (e.g., that you did not use GCC extensionsby mistake), and avoids spurious bootstrap comparisonfailures@footnote{Except if the compiler was buggy and miscompiled some of the files that were not modified. In this case, it's best to use @command{make restrap}.}.Other targets available from the top level include:@table @code@item bootstrap-leanLike @code{bootstrap}, except that the various stages are removed oncethey're no longer needed. This saves disk space.@item bootstrap2@itemx bootstrap2-leanPerforms only the first two stages of bootstrap. Unlike a three-stagebootstrap, this does not perform a comparison to test that the compileris running properly. Note that the disk space required by a ``lean''bootstrap is approximately independent of the number of stages.@item stage@var{N}-bubble (@var{N} = 1@dots{}4)Rebuild all the stages up to @var{N}, with the appropriate flags,``bubbling'' the changes as described above.@item all-stage@var{N} (@var{N} = 1@dots{}4)Assuming that stage @var{N} has already been built, rebuild it with theappropriate flags. This is rarely needed.@item cleanstrapRemove everything (@samp{make clean}) and rebuilds (@samp{make bootstrap}).@item compareCompares the results of stages 2 and 3. This ensures that the compileris running properly, since it should produce the same object filesregardless of how it itself was compiled.@item profiledbootstrapBuilds a compiler with profiling feedback information. For moreinformation, see@ref{Building,,Building with profile feedback,gccinstall,Installing GCC}.@item restrapRestart a bootstrap, so that everything that was not built withthe system compiler is rebuilt.@item stage@var{N}-start (@var{N} = 1@dots{}4)For each package that is bootstrapped, rename directories so that,for example, @file{gcc} points to the stage@var{N} GCC, compiledwith the stage@var{N-1} GCC@footnote{Customarily, the system compiler is also termed the @file{stage0} GCC.}.You will invoke this target if you need to test or debug thestage@var{N} GCC@. If you only need to execute GCC (but you neednot run @samp{make} either to rebuild it or to run test suites),you should be able to work directly in the @file{stage@var{N}-gcc}directory. This makes it easier to debug multiple stages inparallel.@item stageFor each package that is bootstrapped, relocate its build directoryto indicate its stage. For example, if the @file{gcc} directorypoints to the stage2 GCC, after invoking this target it will berenamed to @file{stage2-gcc}.@end tableIf you wish to use non-default GCC flags when compiling the stage2 andstage3 compilers, set @code{BOOT_CFLAGS} on the command line when doing@samp{make}.Usually, the first stage only builds the languages that the compileris written in: typically, C and maybe Ada. If you are debugging amiscompilation of a different stage2 front-end (for example, of theFortran front-end), you may want to have front-ends for other languagesin the first stage as well. To do so, set @code{STAGE1_LANGUAGES}on the command line when doing @samp{make}.For example, in the aforementioned scenario of debugging a Fortranfront-end miscompilation caused by the stage1 compiler, you may need acommand like@examplemake stage2-bubble STAGE1_LANGUAGES=c,fortran@end exampleAlternatively, you can use per-language targets to build and testlanguages that are not enabled by default in stage1. For example,@command{make f951} will build a Fortran compiler even in the stage1build directory.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -