makefile.texi revision 169689
1132718Skan@c Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. 290075Sobrien@c This is part of the GCC manual. 390075Sobrien@c For copying conditions, see the file gcc.texi. 490075Sobrien 590075Sobrien@node Makefile 690075Sobrien@subsection Makefile Targets 790075Sobrien@cindex makefile targets 890075Sobrien@cindex targets, makefile 990075Sobrien 10169689SkanThese targets are available from the @samp{gcc} directory: 11169689Skan 1290075Sobrien@table @code 1390075Sobrien@item all 1490075SobrienThis is the default target. Depending on what your build/host/target 1590075Sobrienconfiguration is, it coordinates all the things that need to be built. 1690075Sobrien 1790075Sobrien@item doc 18132718SkanProduce info-formatted documentation and man pages. Essentially it 19132718Skancalls @samp{make man} and @samp{make info}. 2090075Sobrien 21132718Skan@item dvi 22132718SkanProduce DVI-formatted documentation. 23132718Skan 24169689Skan@item pdf 25169689SkanProduce PDF-formatted documentation. 26169689Skan 27169689Skan@item html 28169689SkanProduce HTML-formatted documentation. 29169689Skan 30132718Skan@item man 31132718SkanGenerate man pages. 32132718Skan 33132718Skan@item info 34132718SkanGenerate info-formatted pages. 35132718Skan 3690075Sobrien@item mostlyclean 3790075SobrienDelete the files made while building the compiler. 3890075Sobrien 3990075Sobrien@item clean 40117395SkanThat, and all the other files built by @samp{make all}. 4190075Sobrien 4290075Sobrien@item distclean 43117395SkanThat, and all the files created by @command{configure}. 4490075Sobrien 4590075Sobrien@item maintainer-clean 4690075SobrienDistclean plus any file that can be generated from other files. Note 4790075Sobrienthat additional tools may be required beyond what is normally needed to 4890075Sobrienbuild gcc. 4990075Sobrien 50132718Skan@item srcextra 51132718SkanGenerates files in the source directory that do not exist in CVS but 52169689Skanshould go into a release tarball. One example is @file{gcc/java/parse.c} 53169689Skanwhich is generated from the CVS source file @file{gcc/java/parse.y}. 54132718Skan 55132718Skan@item srcinfo 56132718Skan@itemx srcman 57132718SkanCopies the info-formatted and manpage documentation into the source 58132718Skandirectory usually for the purpose of generating a release tarball. 59132718Skan 6090075Sobrien@item install 6190075SobrienInstalls gcc. 6290075Sobrien 6390075Sobrien@item uninstall 6490075SobrienDeletes installed files. 6590075Sobrien 6690075Sobrien@item check 6790075SobrienRun the testsuite. This creates a @file{testsuite} subdirectory that 6890075Sobrienhas various @file{.sum} and @file{.log} files containing the results of 69117395Skanthe testing. You can run subsets with, for example, @samp{make check-gcc}. 7090075SobrienYou can specify specific tests by setting RUNTESTFLAGS to be the name 7190075Sobrienof the @file{.exp} file, optionally followed by (for some tests) an equals 7290075Sobrienand a file wildcard, like: 7390075Sobrien 74103445Skan@smallexample 7590075Sobrienmake check-gcc RUNTESTFLAGS="execute.exp=19980413-*" 76103445Skan@end smallexample 7790075Sobrien 7890075SobrienNote that running the testsuite may require additional tools be 7990075Sobrieninstalled, such as TCL or dejagnu. 80169689Skan@end table 8190075Sobrien 82169689SkanThe toplevel tree from which you start GCC compilation is not 83169689Skanthe GCC directory, but rather a complex Makefile that coordinates 84169689Skanthe various steps of the build, including bootstrapping the compiler 85169689Skanand using the new compiler to build target libraries. 8690075Sobrien 87169689SkanWhen GCC is configured for a native configuration, the default action 88169689Skanfor @command{make} is to do a full three-stage bootstrap. This means 89169689Skanthat GCC is built three times---once with the native compiler, once with 90169689Skanthe native-built compiler it just built, and once with the compiler it 91169689Skanbuilt the second time. In theory, the last two should produce the same 92169689Skanresults, which @samp{make compare} can check. Each stage is configured 93169689Skanseparately and compiled into a separate directory, to minimize problems 94169689Skandue to ABI incompatibilities between the native compiler and GCC. 95169689Skan 96169689SkanIf you do a change, rebuilding will also start from the first stage 97169689Skanand ``bubble'' up the change through the three stages. Each stage 98169689Skanis taken from its build directory (if it had been built previously), 99169689Skanrebuilt, and copied to its subdirectory. This will allow you to, for 100169689Skanexample, continue a bootstrap after fixing a bug which causes the 101169689Skanstage2 build to crash. It does not provide as good coverage of the 102169689Skancompiler as bootstrapping from scratch, but it ensures that the new 103169689Skancode is syntactically correct (e.g. that you did not use GCC extensions 104169689Skanby mistake), and avoids spurious bootstrap comparison 105169689Skanfailures@footnote{Except if the compiler was buggy and miscompiled 106169689Skan some of the files that were not modified. In this case, it's best 107169689Skan to use @command{make restrap}.}. 108169689Skan 109169689SkanOther targets available from the top level include: 110169689Skan 111169689Skan@table @code 11290075Sobrien@item bootstrap-lean 11390075SobrienLike @code{bootstrap}, except that the various stages are removed once 11490075Sobrienthey're no longer needed. This saves disk space. 11590075Sobrien 116169689Skan@item bootstrap2 117169689Skan@itemx bootstrap2-lean 118169689SkanPerforms only the first two stages of bootstrap. Unlike a three-stage 119169689Skanbootstrap, this does not perform a comparison to test that the compiler 120169689Skanis running properly. Note that the disk space required by a ``lean'' 121169689Skanbootstrap is approximately independent of the number of stages. 12290075Sobrien 123169689Skan@item stage@var{N}-bubble (@var{N} = 1@dots{}4) 124169689SkanRebuild all the stages up to @var{N}, with the appropriate flags, 125169689Skan``bubbling'' the changes as described above. 12690075Sobrien 127169689Skan@item all-stage@var{N} (@var{N} = 1@dots{}4) 128169689SkanAssuming that stage @var{N} has already been built, rebuild it with the 129169689Skanappropriate flags. This is rarely needed. 130169689Skan 13190075Sobrien@item cleanstrap 132169689SkanRemove everything (@samp{make clean}) and rebuilds (@samp{make bootstrap}). 13390075Sobrien 13490075Sobrien@item compare 13590075SobrienCompares the results of stages 2 and 3. This ensures that the compiler 13690075Sobrienis running properly, since it should produce the same object files 13790075Sobrienregardless of how it itself was compiled. 13890075Sobrien 139132718Skan@item profiledbootstrap 140132718SkanBuilds a compiler with profiling feedback information. For more 141132718Skaninformation, see 142132718Skan@ref{Building,,Building with profile feedback,gccinstall,Installing GCC}. 143132718Skan 144169689Skan@item restrap 145169689SkanRestart a bootstrap, so that everything that was not built with 146169689Skanthe system compiler is rebuilt. 147169689Skan 148169689Skan@item stage@var{N}-start (@var{N} = 1@dots{}4) 149169689SkanFor each package that is bootstrapped, rename directories so that, 150169689Skanfor example, @file{gcc} points to the stage@var{N} GCC, compiled 151169689Skanwith the stage@var{N-1} GCC@footnote{Customarily, the system compiler 152169689Skan is also termed the @file{stage0} GCC.}. 153169689Skan 154169689SkanYou will invoke this target if you need to test or debug the 155169689Skanstage@var{N} GCC. If you only need to execute GCC (but you need 156169689Skannot run @samp{make} either to rebuild it or to run test suites), 157169689Skanyou should be able to work directly in the @file{stage@var{N}-gcc} 158169689Skandirectory. This makes it easier to debug multiple stages in 159169689Skanparallel. 160169689Skan 161169689Skan@item stage 162169689SkanFor each package that is bootstrapped, relocate its build directory 163169689Skanto indicate its stage. For example, if the @file{gcc} directory 164169689Skanpoints to the stage2 GCC, after invoking this target it will be 165169689Skanrenamed to @file{stage2-gcc}. 166169689Skan 16790075Sobrien@end table 168169689Skan 169169689SkanIf you wish to use non-default GCC flags when compiling the stage2 and 170169689Skanstage3 compilers, set @code{BOOT_CFLAGS} on the command line when doing 171169689Skan@samp{make}. 172169689Skan 173169689SkanUsually, the first stage only builds the languages that the compiler 174169689Skanis written in: typically, C and maybe Ada. If you are debugging a 175169689Skanmiscompilation of a different stage2 front-end (for example, of the 176169689SkanFortran front-end), you may want to have front-ends for other languages 177169689Skanin the first stage as well. To do so, set @code{STAGE1_LANGUAGES} 178169689Skanon the command line when doing @samp{make}. 179169689Skan 180169689SkanFor example, in the aforementioned scenario of debugging a Fortran 181169689Skanfront-end miscompilation caused by the stage1 compiler, you may need a 182169689Skancommand like 183169689Skan 184169689Skan@example 185169689Skanmake stage2-bubble STAGE1_LANGUAGES=c,fortran 186169689Skan@end example 187169689Skan 188169689SkanAlternatively, you can use per-language targets to build and test 189169689Skanlanguages that are not enabled by default in stage1. For example, 190169689Skan@command{make f951} will build a Fortran compiler even in the stage1 191169689Skanbuild directory. 192169689Skan 193