Environment-Variables.html 8.6 KB

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