* add p cc
[mascara-docs.git] / compilers / pcc / pcc-1.0.0 / cc / cc / cc.1
blob23bb4dc00f1a41722fcec7cd2b91c63fd03be768
1 .\"     $Id: cc.1,v 1.16 2010/04/05 14:24:06 reed Exp $
2 .\"     $NetBSD$
3 .\"     $OpenBSD$
4 .\"
5 .\" Copyright (c) 2007 Jeremy C. Reed <reed@reedmedia.net>
6 .\"
7 .\" Permission to use, copy, modify, and/or distribute this software for any
8 .\" purpose with or without fee is hereby granted, provided that the above
9 .\" copyright notice and this permission notice appear in all copies.
10 .\"
11 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR AND CONTRIBUTORS DISCLAIM
12 .\" ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
13 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL AUTHOR AND
14 .\" CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
15 .\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
16 .\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
17 .\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
18 .\" THIS SOFTWARE.
19 .\"
20 .Dd September 14, 2007
21 .Dt CC 1
22 .Os
23 .Sh NAME
24 .Nm cc
25 .Nd front-end to the C compiler
26 .Sh SYNOPSIS
27 .Nm
28 .Op Fl cEgkLMPOStvXx
29 .Op Fl fPIC
30 .Op Fl fpic
31 .Op Fl m Ns Ar option
32 .Op Fl nostartfiles
33 .Op Fl nostdinc
34 .Op Fl nostdlib
35 .Op Fl pg
36 .Op Fl pthread
37 .Op Fl static
38 .Op Fl B Ar prefix
39 .Op Fl D Ar macro[=value]
40 .Op Fl d Ar option
41 .Op Fl I Ar directory
42 .Op Fl include Ar path
43 .Op Fl isystem Ar path
44 .Op Fl o Ar outfile
45 .Op Fl Wl Ar flags
46 .Op Ar
47 .Sh DESCRIPTION
48 The
49 .Nm
50 utility provides a front-end to the
51 .Dq portable C compiler .
52 Multiple files may be given on the command line.
53 Unrecognized options are all sent directly to
54 .Xr ld 1 .
55 .Pp
56 .\" Brief description of its syntax:
57 Filenames that end with
58 .Sy \&.c
59 are passed via
60 .Xr cpp 1
61 \(->
62 .Xr ccom 1
63 \(->
64 .Xr as 1
65 \(->
66 .Xr ld 1 .
67 .Pp
68 Filenames that end with
69 .Sy \&.i
70 are passed via
71 .Xr ccom 1
72 \(->
73 .Xr as 1
74 \(->
75 .Xr ld 1 .
76 .Pp
77 Filenames that end with
78 .Sy \&.s
79 are passed via
80 .Xr as 1
81 \(->
82 .Xr ld 1 .
83 .Pp
84 Filenames that end with
85 .Sy \&.S
86 are passed via
87 .Xr cpp 1
88 \(->
89 .Xr as 1
90 \(->
91 .Xr ld 1 .
92 .Pp
93 Filenames that end with
94 .Sy \&.o
95 are passed directly to
96 .Xr ld 1 .
97 .Pp
98 .\"
99 The options are as follows:
100 .Bl -tag -width Ds
101 .It Fl B Ar prefix
102 Define alternate prefix path for
103 .Xr cpp 1 ,
104 .Xr ccom 1 ,
105 .Xr as 1 ,
107 .Xr ld 1
108 executables.
109 .\" TODO: provide an example of -B
110 .It Fl C
111 Passed to the
112 .Xr cpp 1
113 preprocessor to not discard comments.
114 .It Fl c
115 Only compile or assemble and then stop.
116 Do not link.
117 The resulting object output is saved
118 as a filename with a
119 .Dq \&.o
120 suffix unless
121 .Fl o
122 option is used.
123 Note: cannot be combined with
124 .Fl o
125 if multiple files are given.
126 .It Fl D Ar macro[=value]
127 Passed to the
128 .Xr cpp 1
129 preprocessor to define
130 .Ar macro .
131 .It Fl d Ar option
132 Passed to the
133 .Xr as 1
134 assembler.
135 .\" TODO: what is as -dfoo for?
136 .It Fl E
137 Stop after preprocessing with
138 .Xr cpp 1 .
139 Do not compile, assemble, or link.
140 Output is sent to standard output unless the
141 .Fl o
142 option is used.
143 .It Fl fPIC
144 Generate PIC code.
145 .\" TODO: document about avoiding machine-specific maximum size?
146 .It Fl fpic
147 Tells C compiler to generate PIC code
148 and tells assembler that PIC code has been generated.
149 .\" TODO: document difference between PIC and pic
150 .\" other -f GCC compatibility flags are ignored for now
151 .It Fl g
152 Send
153 .Fl g
154 flag to
155 .Xr ccom 1
156 to create debug output.
157 This unsets the
158 .Fl O
159 option.
160 .It Fl I Ar path
161 Passed to the
162 .Xr cpp 1
163 preprocessor to add header search directory to override system defaults.
164 .It Fl include Ar file
165 Tells the
166 .Xr cpp 1
167 preprocessor to include the
168 .Ar file
169 during preprocessing.
170 .It Fl isystem Ar path
171 Defines
172 .Ar path
173 as a system header directory for the
174 .Xr cpp 1
175 preprocessor.
176 .It Fl k
177 Generate PIC code.
179 .Fl fpic
180 option.
181 .It Fl L
182 TODO
183 .It Fl M
184 Pass
185 .Fl M
186 flag to
187 .Xr cpp 1
188 to generate dependencies for
189 .Xr make 1 .
190 .It Fl m Ns options
191 Target-dependent option.
192 .Bl -tag -width PowerPC
193 .It ARM
194 \-mlittle-endian \-mbig-endian \-mfpe=fpa \-mfpe=vpf \-msoft-float \-march=armv1 \-march=armv2 \-march=armv2a \-march=armv3 \-march=armv4 \-march=armv4t \-march=armv4tej \-march=armv5 \-march=armv6 \-march=armv6t2 \-march=armv6kz \-march=armv6k \-march=armv7
195 .It HPPA
196 .It i386
197 .It MIPS
198 \-mlittle-endian \-mbig-endian \-mhard-float \-msoft-float
199 .It PDP-10
200 .It PowerPC
201 .It Sparc64
202 .It VAX
204 .It Fl nostartfiles
205 Do not link with the system startup files (crt0.c, etc.)
206 .It Fl nostdinc
207 Do not use the system include paths (/usr/include, etc.)
208 .It Fl nostdlib
209 Do not link with the system C library (libc).
210 .\" implies -nostartfiles ??
211 .It Fl O
212 Enable optimizations.
213 Currently passes
214 .Fl xdeljumps
216 .Fl xtemps
218 .Xr ccom 1 .
219 Note: this is unset if the
220 .Fl g
221 option is used.
222 .It Fl o Ar outfile
223 Save result to
224 .Ar outfile .
225 .It Fl P
226 TODO
227 .\" TODO: what is this?
228 .\" TODO: Looks like it does cpp only, but I couldn't get it to work for me.
229 .It Fl pg
230 Enable profiling on the generated executable.
231 .It Fl pthread
232 Defines
233 .Sy _PTHREADS
234 preprocessor directive for
235 .Xr cpp 1 .
236 Uses
237 .Sy \-lpthread
238 for the
239 .Xr ld 1
240 linker.
241 .It Fl S
242 Stop after compilation by
243 .Xr ccom 1 .
244 Do not assemble and do not link.
245 The resulting assembler-language output is saved
246 as a filename with a
247 .Dq \&.s
248 suffix unless the
249 .Fl o
250 option is used.
251 Note: cannot be combined with
252 .Fl o
253 if multiple files are given.
254 .It Fl static
255 Do not use dynamic linkage.
256 By default, it will link using the dynamic linker options
257 and/or shared objects for the platform.
258 .It Fl shared
259 Create a shared object of the result.  Tells the linker not to 
260 generate an executable.
261 .It Fl t
262 Passes
263 .Fl t
265 .Xr cpp 1
266 for traditional C preprocessor syntax.
267 .It Fl U Ar macro
268 Passes to the
269 .Xr cpp 1
270 preprocessor to remove the initial macro definition.
271 .It Fl v
272 Outputs the version of
274 and shows what commands will be run with their command line arguments.
275 .It Fl Wl Ar flags
276 Options for the linker.
277 .\" what is ignored? llist?
278 .It Fl X
279 Don't remove temporary files on exit.
280 .It Fl x
281 May be used to give separate optimization flags to ccom, see
282 .Fl O
283 for options.
284 .It Fl x Ar c
285 Gcc compatibility option; specify that the language in use is
286 .Ar c .
288 .Ss Predefined Macros
289 A few
290 macros are predefined by
292 when sent to
293 .Xr cpp 1 .
294 .Bl -diag
295 .\" TODO:
296 .\" .It __ASSEMBLER__
297 .\" Defined if suffix is .S -- why not with .s? what does this mean?
298 .It __PCC__
299 Set to the major version of
300 .Xr pcc 1 .
301 These macros can be used to select code based on
302 .Xr pcc 1
303 compatibility.
304 See the
305 .Fl v
306 option.
307 .It __PCC_MINOR__
308 Set to the minor version.
309 .It __PCC_MINORMINOR__
310 Set to the minor-minor version \(em the number after the minor version.
311 .It _PTHREADS
312 Defined when
313 .Fl pthread
314 switch is used.
317 Also system- and/or machine-dependent macros may also be predefined;
318 for example:
319 .Dv __NetBSD__ ,
320 .Dv __ELF__ ,
322 .Dv __i386__ .
323 .Sh SEE ALSO
324 .Xr as 1 ,
325 .Xr ccom 1 ,
326 .Xr cpp 1 ,
327 .Xr ld 1
328 .Sh HISTORY
331 command comes from the original Portable C Compiler by S. C. Johnson,
332 written in the late 70's.
334 This product includes software developed or owned by Caldera
335 International, Inc.