Environment-Variables.html 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1987-2023 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. A copy of
  7. the license is included in the
  8. section entitled "GNU Free Documentation License".
  9. This manual contains no Invariant Sections. The Front-Cover Texts are
  10. (a) (see below), and the Back-Cover Texts are (b) (see below).
  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.7, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <title>Environment Variables (The C Preprocessor)</title>
  21. <meta name="description" content="Environment Variables (The C Preprocessor)">
  22. <meta name="keywords" content="Environment Variables (The C Preprocessor)">
  23. <meta name="resource-type" content="document">
  24. <meta name="distribution" content="global">
  25. <meta name="Generator" content="makeinfo">
  26. <link href="index.html" rel="start" title="Top">
  27. <link href="Index-of-Directives.html" rel="index" title="Index of Directives">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="index.html" rel="up" title="Top">
  30. <link href="GNU-Free-Documentation-License.html" rel="next" title="GNU Free Documentation License">
  31. <link href="Invocation.html" rel="prev" title="Invocation">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.indentedblock {margin-right: 0em}
  36. div.display {margin-left: 3.2em}
  37. div.example {margin-left: 3.2em}
  38. div.lisp {margin-left: 3.2em}
  39. kbd {font-style: oblique}
  40. pre.display {font-family: inherit}
  41. pre.format {font-family: inherit}
  42. pre.menu-comment {font-family: serif}
  43. pre.menu-preformatted {font-family: serif}
  44. span.nolinebreak {white-space: nowrap}
  45. span.roman {font-family: initial; font-weight: normal}
  46. span.sansserif {font-family: sans-serif; font-weight: normal}
  47. ul.no-bullet {list-style: none}
  48. -->
  49. </style>
  50. </head>
  51. <body lang="en">
  52. <span id="Environment-Variables"></span><div class="header">
  53. <p>
  54. Next: <a href="GNU-Free-Documentation-License.html" accesskey="n" rel="next">GNU Free Documentation License</a>, Previous: <a href="Invocation.html" accesskey="p" rel="prev">Invocation</a>, Up: <a href="index.html" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index-of-Directives.html" title="Index" rel="index">Index</a>]</p>
  55. </div>
  56. <hr>
  57. <span id="Environment-Variables-1"></span><h2 class="chapter">13 Environment Variables</h2>
  58. <span id="index-environment-variables"></span>
  59. <p>This section describes the environment variables that affect how CPP
  60. operates. You can use them to specify directories or prefixes to use
  61. when searching for include files, or to control dependency output.
  62. </p>
  63. <p>Note that you can also specify places to search using options such as
  64. <samp>-I</samp>, and control dependency output with options like
  65. <samp>-M</samp> (see <a href="Invocation.html">Invocation</a>). These take precedence over
  66. environment variables, which in turn take precedence over the
  67. configuration of GCC.
  68. </p>
  69. <dl compact="compact">
  70. <dt><code>CPATH</code>
  71. <span id="index-CPATH"></span>
  72. </dt>
  73. <dt><code>C_INCLUDE_PATH</code>
  74. <span id="index-C_005fINCLUDE_005fPATH"></span>
  75. </dt>
  76. <dt><code>CPLUS_INCLUDE_PATH</code>
  77. <span id="index-CPLUS_005fINCLUDE_005fPATH"></span>
  78. </dt>
  79. <dt><code>OBJC_INCLUDE_PATH</code>
  80. <span id="index-OBJC_005fINCLUDE_005fPATH"></span>
  81. </dt>
  82. <dd><p>Each variable&rsquo;s value is a list of directories separated by a special
  83. character, much like <code>PATH</code>, in which to look for header files.
  84. The special character, <code>PATH_SEPARATOR</code>, is target-dependent and
  85. determined at GCC build time. For Microsoft Windows-based targets it is a
  86. semicolon, and for almost all other targets it is a colon.
  87. </p>
  88. <p><code>CPATH</code> specifies a list of directories to be searched as if
  89. specified with <samp>-I</samp>, but after any paths given with <samp>-I</samp>
  90. options on the command line. This environment variable is used
  91. regardless of which language is being preprocessed.
  92. </p>
  93. <p>The remaining environment variables apply only when preprocessing the
  94. particular language indicated. Each specifies a list of directories
  95. to be searched as if specified with <samp>-isystem</samp>, but after any
  96. paths given with <samp>-isystem</samp> options on the command line.
  97. </p>
  98. <p>In all these variables, an empty element instructs the compiler to
  99. search its current working directory. Empty elements can appear at the
  100. beginning or end of a path. For instance, if the value of
  101. <code>CPATH</code> is <code>:/special/include</code>, that has the same
  102. effect as &lsquo;<samp><span class="nolinebreak">-I.</span>&nbsp;<span class="nolinebreak">-I/special/include</span><!-- /@w --></samp>&rsquo;.
  103. </p>
  104. <p>See also <a href="Search-Path.html">Search Path</a>.
  105. </p>
  106. <span id="index-dependencies-for-make-as-output"></span>
  107. </dd>
  108. <dt><code>DEPENDENCIES_OUTPUT</code>
  109. <span id="index-DEPENDENCIES_005fOUTPUT"></span>
  110. </dt>
  111. <dd><p>If this variable is set, its value specifies how to output
  112. dependencies for Make based on the non-system header files processed
  113. by the compiler. System header files are ignored in the dependency
  114. output.
  115. </p>
  116. <p>The value of <code>DEPENDENCIES_OUTPUT</code> can be just a file name, in
  117. which case the Make rules are written to that file, guessing the target
  118. name from the source file name. Or the value can have the form
  119. &lsquo;<samp><var>file</var> <var>target</var></samp>&rsquo;, in which case the rules are written to
  120. file <var>file</var> using <var>target</var> as the target name.
  121. </p>
  122. <p>In other words, this environment variable is equivalent to combining
  123. the options <samp>-MM</samp> and <samp>-MF</samp>
  124. (see <a href="Invocation.html">Invocation</a>),
  125. with an optional <samp>-MT</samp> switch too.
  126. </p>
  127. <span id="index-dependencies-for-make-as-output-1"></span>
  128. </dd>
  129. <dt><code>SUNPRO_DEPENDENCIES</code>
  130. <span id="index-SUNPRO_005fDEPENDENCIES"></span>
  131. </dt>
  132. <dd><p>This variable is the same as <code>DEPENDENCIES_OUTPUT</code> (see above),
  133. except that system header files are not ignored, so it implies
  134. <samp>-M</samp> rather than <samp>-MM</samp>. However, the dependence on the
  135. main input file is omitted.
  136. See <a href="Invocation.html">Invocation</a>.
  137. </p>
  138. </dd>
  139. <dt><code>SOURCE_DATE_EPOCH</code>
  140. <span id="index-SOURCE_005fDATE_005fEPOCH"></span>
  141. </dt>
  142. <dd><p>If this variable is set, its value specifies a UNIX timestamp to be
  143. used in replacement of the current date and time in the <code>__DATE__</code>
  144. and <code>__TIME__</code> macros, so that the embedded timestamps become
  145. reproducible.
  146. </p>
  147. <p>The value of <code>SOURCE_DATE_EPOCH</code> must be a UNIX timestamp,
  148. defined as the number of seconds (excluding leap seconds) since
  149. 01 Jan 1970 00:00:00 represented in ASCII; identical to the output of
  150. <code>date +%s</code> on GNU/Linux and other systems that support the
  151. <code>%s</code> extension in the <code>date</code> command.
  152. </p>
  153. <p>The value should be a known timestamp such as the last modification
  154. time of the source or package and it should be set by the build
  155. process.
  156. </p>
  157. </dd>
  158. </dl>
  159. <hr>
  160. <div class="header">
  161. <p>
  162. Next: <a href="GNU-Free-Documentation-License.html" accesskey="n" rel="next">GNU Free Documentation License</a>, Previous: <a href="Invocation.html" accesskey="p" rel="prev">Invocation</a>, Up: <a href="index.html" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index-of-Directives.html" title="Index" rel="index">Index</a>]</p>
  163. </div>
  164. </body>
  165. </html>