You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

309 lines
12KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <title>Makefile (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Makefile (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Makefile (GNU Compiler Collection (GCC) Internals)">
  23. <meta name="resource-type" content="document">
  24. <meta name="distribution" content="global">
  25. <meta name="Generator" content="makeinfo">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="gcc-Directory.html#gcc-Directory" rel="up" title="gcc Directory">
  30. <link href="Library-Files.html#Library-Files" rel="next" title="Library Files">
  31. <link href="Build.html#Build" rel="prev" title="Build">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.indentedblock {margin-right: 0em}
  36. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  37. blockquote.smallquotation {font-size: smaller}
  38. div.display {margin-left: 3.2em}
  39. div.example {margin-left: 3.2em}
  40. div.lisp {margin-left: 3.2em}
  41. div.smalldisplay {margin-left: 3.2em}
  42. div.smallexample {margin-left: 3.2em}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style: oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nolinebreak {white-space: nowrap}
  54. span.roman {font-family: initial; font-weight: normal}
  55. span.sansserif {font-family: sans-serif; font-weight: normal}
  56. ul.no-bullet {list-style: none}
  57. -->
  58. </style>
  59. </head>
  60. <body lang="en">
  61. <a name="Makefile"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Library-Files.html#Library-Files" accesskey="n" rel="next">Library Files</a>, Previous: <a href="Build.html#Build" accesskey="p" rel="prev">Build</a>, Up: <a href="gcc-Directory.html#gcc-Directory" accesskey="u" rel="up">gcc Directory</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  65. </div>
  66. <hr>
  67. <a name="Makefile-Targets"></a>
  68. <h4 class="subsection">6.3.4 Makefile Targets</h4>
  69. <a name="index-makefile-targets"></a>
  70. <a name="index-targets_002c-makefile"></a>
  71. <p>These targets are available from the &lsquo;<samp>gcc</samp>&rsquo; directory:
  72. </p>
  73. <dl compact="compact">
  74. <dt><code>all</code></dt>
  75. <dd><p>This is the default target. Depending on what your build/host/target
  76. configuration is, it coordinates all the things that need to be built.
  77. </p>
  78. </dd>
  79. <dt><code>doc</code></dt>
  80. <dd><p>Produce info-formatted documentation and man pages. Essentially it
  81. calls &lsquo;<samp>make man</samp>&rsquo; and &lsquo;<samp>make info</samp>&rsquo;.
  82. </p>
  83. </dd>
  84. <dt><code>dvi</code></dt>
  85. <dd><p>Produce DVI-formatted documentation.
  86. </p>
  87. </dd>
  88. <dt><code>pdf</code></dt>
  89. <dd><p>Produce PDF-formatted documentation.
  90. </p>
  91. </dd>
  92. <dt><code>html</code></dt>
  93. <dd><p>Produce HTML-formatted documentation.
  94. </p>
  95. </dd>
  96. <dt><code>man</code></dt>
  97. <dd><p>Generate man pages.
  98. </p>
  99. </dd>
  100. <dt><code>info</code></dt>
  101. <dd><p>Generate info-formatted pages.
  102. </p>
  103. </dd>
  104. <dt><code>mostlyclean</code></dt>
  105. <dd><p>Delete the files made while building the compiler.
  106. </p>
  107. </dd>
  108. <dt><code>clean</code></dt>
  109. <dd><p>That, and all the other files built by &lsquo;<samp>make all</samp>&rsquo;.
  110. </p>
  111. </dd>
  112. <dt><code>distclean</code></dt>
  113. <dd><p>That, and all the files created by <code>configure</code>.
  114. </p>
  115. </dd>
  116. <dt><code>maintainer-clean</code></dt>
  117. <dd><p>Distclean plus any file that can be generated from other files. Note
  118. that additional tools may be required beyond what is normally needed to
  119. build GCC.
  120. </p>
  121. </dd>
  122. <dt><code>srcextra</code></dt>
  123. <dd><p>Generates files in the source directory that are not version-controlled but
  124. should go into a release tarball.
  125. </p>
  126. </dd>
  127. <dt><code>srcinfo</code></dt>
  128. <dt><code>srcman</code></dt>
  129. <dd><p>Copies the info-formatted and manpage documentation into the source
  130. directory usually for the purpose of generating a release tarball.
  131. </p>
  132. </dd>
  133. <dt><code>install</code></dt>
  134. <dd><p>Installs GCC.
  135. </p>
  136. </dd>
  137. <dt><code>uninstall</code></dt>
  138. <dd><p>Deletes installed files, though this is not supported.
  139. </p>
  140. </dd>
  141. <dt><code>check</code></dt>
  142. <dd><p>Run the testsuite. This creates a <samp>testsuite</samp> subdirectory that
  143. has various <samp>.sum</samp> and <samp>.log</samp> files containing the results of
  144. the testing. You can run subsets with, for example, &lsquo;<samp>make check-gcc</samp>&rsquo;.
  145. You can specify specific tests by setting <code>RUNTESTFLAGS</code> to be the name
  146. of the <samp>.exp</samp> file, optionally followed by (for some tests) an equals
  147. and a file wildcard, like:
  148. </p>
  149. <div class="smallexample">
  150. <pre class="smallexample">make check-gcc RUNTESTFLAGS=&quot;execute.exp=19980413-*&quot;
  151. </pre></div>
  152. <p>Note that running the testsuite may require additional tools be
  153. installed, such as Tcl or DejaGnu.
  154. </p></dd>
  155. </dl>
  156. <p>The toplevel tree from which you start GCC compilation is not
  157. the GCC directory, but rather a complex Makefile that coordinates
  158. the various steps of the build, including bootstrapping the compiler
  159. and using the new compiler to build target libraries.
  160. </p>
  161. <p>When GCC is configured for a native configuration, the default action
  162. for <code>make</code> is to do a full three-stage bootstrap. This means
  163. that GCC is built three times&mdash;once with the native compiler, once with
  164. the native-built compiler it just built, and once with the compiler it
  165. built the second time. In theory, the last two should produce the same
  166. results, which &lsquo;<samp>make compare</samp>&rsquo; can check. Each stage is configured
  167. separately and compiled into a separate directory, to minimize problems
  168. due to ABI incompatibilities between the native compiler and GCC.
  169. </p>
  170. <p>If you do a change, rebuilding will also start from the first stage
  171. and &ldquo;bubble&rdquo; up the change through the three stages. Each stage
  172. is taken from its build directory (if it had been built previously),
  173. rebuilt, and copied to its subdirectory. This will allow you to, for
  174. example, continue a bootstrap after fixing a bug which causes the
  175. stage2 build to crash. It does not provide as good coverage of the
  176. compiler as bootstrapping from scratch, but it ensures that the new
  177. code is syntactically correct (e.g., that you did not use GCC extensions
  178. by mistake), and avoids spurious bootstrap comparison
  179. failures<a name="DOCF1" href="#FOOT1"><sup>1</sup></a>.
  180. </p>
  181. <p>Other targets available from the top level include:
  182. </p>
  183. <dl compact="compact">
  184. <dt><code>bootstrap-lean</code></dt>
  185. <dd><p>Like <code>bootstrap</code>, except that the various stages are removed once
  186. they&rsquo;re no longer needed. This saves disk space.
  187. </p>
  188. </dd>
  189. <dt><code>bootstrap2</code></dt>
  190. <dt><code>bootstrap2-lean</code></dt>
  191. <dd><p>Performs only the first two stages of bootstrap. Unlike a three-stage
  192. bootstrap, this does not perform a comparison to test that the compiler
  193. is running properly. Note that the disk space required by a &ldquo;lean&rdquo;
  194. bootstrap is approximately independent of the number of stages.
  195. </p>
  196. </dd>
  197. <dt><code>stage<var>N</var>-bubble (<var>N</var> = 1&hellip;4, profile, feedback)</code></dt>
  198. <dd><p>Rebuild all the stages up to <var>N</var>, with the appropriate flags,
  199. &ldquo;bubbling&rdquo; the changes as described above.
  200. </p>
  201. </dd>
  202. <dt><code>all-stage<var>N</var> (<var>N</var> = 1&hellip;4, profile, feedback)</code></dt>
  203. <dd><p>Assuming that stage <var>N</var> has already been built, rebuild it with the
  204. appropriate flags. This is rarely needed.
  205. </p>
  206. </dd>
  207. <dt><code>cleanstrap</code></dt>
  208. <dd><p>Remove everything (&lsquo;<samp>make clean</samp>&rsquo;) and rebuilds (&lsquo;<samp>make bootstrap</samp>&rsquo;).
  209. </p>
  210. </dd>
  211. <dt><code>compare</code></dt>
  212. <dd><p>Compares the results of stages 2 and 3. This ensures that the compiler
  213. is running properly, since it should produce the same object files
  214. regardless of how it itself was compiled.
  215. </p>
  216. </dd>
  217. <dt><code>profiledbootstrap</code></dt>
  218. <dd><p>Builds a compiler with profiling feedback information. In this case,
  219. the second and third stages are named &lsquo;<samp>profile</samp>&rsquo; and &lsquo;<samp>feedback</samp>&rsquo;,
  220. respectively. For more information, see the installation instructions.
  221. </p>
  222. </dd>
  223. <dt><code>restrap</code></dt>
  224. <dd><p>Restart a bootstrap, so that everything that was not built with
  225. the system compiler is rebuilt.
  226. </p>
  227. </dd>
  228. <dt><code>stage<var>N</var>-start (<var>N</var> = 1&hellip;4, profile, feedback)</code></dt>
  229. <dd><p>For each package that is bootstrapped, rename directories so that,
  230. for example, <samp>gcc</samp> points to the stage<var>N</var> GCC, compiled
  231. with the stage<var>N-1</var> GCC<a name="DOCF2" href="#FOOT2"><sup>2</sup></a>.
  232. </p>
  233. <p>You will invoke this target if you need to test or debug the
  234. stage<var>N</var> GCC. If you only need to execute GCC (but you need
  235. not run &lsquo;<samp>make</samp>&rsquo; either to rebuild it or to run test suites),
  236. you should be able to work directly in the <samp>stage<var>N</var>-gcc</samp>
  237. directory. This makes it easier to debug multiple stages in
  238. parallel.
  239. </p>
  240. </dd>
  241. <dt><code>stage</code></dt>
  242. <dd><p>For each package that is bootstrapped, relocate its build directory
  243. to indicate its stage. For example, if the <samp>gcc</samp> directory
  244. points to the stage2 GCC, after invoking this target it will be
  245. renamed to <samp>stage2-gcc</samp>.
  246. </p>
  247. </dd>
  248. </dl>
  249. <p>If you wish to use non-default GCC flags when compiling the stage2 and
  250. stage3 compilers, set <code>BOOT_CFLAGS</code> on the command line when doing
  251. &lsquo;<samp>make</samp>&rsquo;.
  252. </p>
  253. <p>Usually, the first stage only builds the languages that the compiler
  254. is written in: typically, C and maybe Ada. If you are debugging a
  255. miscompilation of a different stage2 front-end (for example, of the
  256. Fortran front-end), you may want to have front-ends for other languages
  257. in the first stage as well. To do so, set <code>STAGE1_LANGUAGES</code>
  258. on the command line when doing &lsquo;<samp>make</samp>&rsquo;.
  259. </p>
  260. <p>For example, in the aforementioned scenario of debugging a Fortran
  261. front-end miscompilation caused by the stage1 compiler, you may need a
  262. command like
  263. </p>
  264. <div class="example">
  265. <pre class="example">make stage2-bubble STAGE1_LANGUAGES=c,fortran
  266. </pre></div>
  267. <p>Alternatively, you can use per-language targets to build and test
  268. languages that are not enabled by default in stage1. For example,
  269. <code>make f951</code> will build a Fortran compiler even in the stage1
  270. build directory.
  271. </p>
  272. <div class="footnote">
  273. <hr>
  274. <h4 class="footnotes-heading">Footnotes</h4>
  275. <h3><a name="FOOT1" href="#DOCF1">(1)</a></h3>
  276. <p>Except if the compiler was buggy and miscompiled
  277. some of the files that were not modified. In this case, it&rsquo;s best
  278. to use <code>make restrap</code>.</p>
  279. <h3><a name="FOOT2" href="#DOCF2">(2)</a></h3>
  280. <p>Customarily, the system compiler
  281. is also termed the <samp>stage0</samp> GCC.</p>
  282. </div>
  283. <hr>
  284. <div class="header">
  285. <p>
  286. Next: <a href="Library-Files.html#Library-Files" accesskey="n" rel="next">Library Files</a>, Previous: <a href="Build.html#Build" accesskey="p" rel="prev">Build</a>, Up: <a href="gcc-Directory.html#gcc-Directory" accesskey="u" rel="up">gcc Directory</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  287. </div>
  288. </body>
  289. </html>