summaryrefslogtreecommitdiff
path: root/gcc/doc/cppenv.texi
blob: 123df5c464c9a2cfdc9b0ae1bb85c3772732078b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
@c Copyright (C) 1999-2020 Free Software Foundation, Inc.
@c This is part of the CPP and GCC manuals.
@c For copying conditions, see the file gcc.texi.

@c ---------------------------------------------------------------------
@c Environment variables affecting the preprocessor
@c ---------------------------------------------------------------------

@c If this file is included with the flag ``cppmanual'' set, it is
@c formatted for inclusion in the CPP manual; otherwise the main GCC manual.

@vtable @env
@item CPATH
@itemx C_INCLUDE_PATH
@itemx CPLUS_INCLUDE_PATH
@itemx OBJC_INCLUDE_PATH
@c Commented out until ObjC++ is part of GCC:
@c @itemx OBJCPLUS_INCLUDE_PATH
Each variable's value is a list of directories separated by a special
character, much like @env{PATH}, in which to look for header files.
The special character, @code{PATH_SEPARATOR}, is target-dependent and
determined at GCC build time.  For Microsoft Windows-based targets it is a
semicolon, and for almost all other targets it is a colon.

@env{CPATH} specifies a list of directories to be searched as if
specified with @option{-I}, but after any paths given with @option{-I}
options on the command line.  This environment variable is used
regardless of which language is being preprocessed.

The remaining environment variables apply only when preprocessing the
particular language indicated.  Each specifies a list of directories
to be searched as if specified with @option{-isystem}, but after any
paths given with @option{-isystem} options on the command line.

In all these variables, an empty element instructs the compiler to
search its current working directory.  Empty elements can appear at the
beginning or end of a path.  For instance, if the value of
@env{CPATH} is @code{:/special/include}, that has the same
effect as @samp{@w{-I. -I/special/include}}.

@c man end
@ifset cppmanual
See also @ref{Search Path}.
@end ifset
@c man begin ENVIRONMENT

@item DEPENDENCIES_OUTPUT
@cindex dependencies for make as output
If this variable is set, its value specifies how to output
dependencies for Make based on the non-system header files processed
by the compiler.  System header files are ignored in the dependency
output.

The value of @env{DEPENDENCIES_OUTPUT} can be just a file name, in
which case the Make rules are written to that file, guessing the target
name from the source file name.  Or the value can have the form
@samp{@var{file} @var{target}}, in which case the rules are written to
file @var{file} using @var{target} as the target name.

In other words, this environment variable is equivalent to combining
the options @option{-MM} and @option{-MF}
@ifset cppmanual
(@pxref{Invocation}),
@end ifset
@ifclear cppmanual
(@pxref{Preprocessor Options}),
@end ifclear
with an optional @option{-MT} switch too.

@item SUNPRO_DEPENDENCIES
@cindex dependencies for make as output
This variable is the same as @env{DEPENDENCIES_OUTPUT} (see above),
except that system header files are not ignored, so it implies
@option{-M} rather than @option{-MM}.  However, the dependence on the
main input file is omitted.
@ifset cppmanual
@xref{Invocation}.
@end ifset
@ifclear cppmanual
@xref{Preprocessor Options}.
@end ifclear

@item SOURCE_DATE_EPOCH
If this variable is set, its value specifies a UNIX timestamp to be
used in replacement of the current date and time in the @code{__DATE__}
and @code{__TIME__} macros, so that the embedded timestamps become
reproducible.

The value of @env{SOURCE_DATE_EPOCH} must be a UNIX timestamp,
defined as the number of seconds (excluding leap seconds) since
01 Jan 1970 00:00:00 represented in ASCII; identical to the output of
@samp{@command{date +%s}} on GNU/Linux and other systems that support the
@code{%s} extension in the @code{date} command.

The value should be a known timestamp such as the last modification
time of the source or package and it should be set by the build
process.

@end vtable