1CC(1)                     BSD General Commands Manual                    CC(1)
2

NAME

4     cc — front-end to the C compiler
5

SYNOPSIS

7     cc [-cEgkLMPOStvXx] [-fPIC] [-fpic] [-moption] [-nostartfiles]
8        [-nostdinc] [-nostdlib] [-pg] [-pthread] [-static] [-B prefix]
9        [-D macro[=value]] [-d option] [-I directory] [-include path]
10        [-isystem path] [-o outfile] [-Wl flags] [file ...]
11

DESCRIPTION

13     The cc utility provides a front-end to the “portable C compiler”.  Multi‐
14     ple files may be given on the command line.  Unrecognized options are all
15     sent directly to ld(1).
16
17     Filenames that end with .c are passed via cpp(1)ccom(1)as(1)
18     ld(1).
19
20     Filenames that end with .i are passed via ccom(1)as(1)ld(1).
21
22     Filenames that end with .s are passed via as(1)ld(1).
23
24     Filenames that end with .S are passed via cpp(1)as(1)ld(1).
25
26     Filenames that end with .o are passed directly to ld(1).
27
28     The options are as follows:
29
30     -B prefix
31             Define alternate prefix path for cpp(1), ccom(1), as(1), or ld(1)
32             executables.
33
34     -C      Passed to the cpp(1) preprocessor to not discard comments.
35
36     -c      Only compile or assemble and then stop.  Do not link.  The
37             resulting object output is saved as a filename with a “.o” suffix
38             unless -o option is used.  Note: cannot be combined with -o if
39             multiple files are given.
40
41     -D macro[=value]
42             Passed to the cpp(1) preprocessor to define macro.
43
44     -d option
45             Passed to the as(1) assembler.
46
47     -E      Stop after preprocessing with cpp(1).  Do not compile, assemble,
48             or link.  Output is sent to standard output unless the -o option
49             is used.
50
51     -fPIC   Generate PIC code.
52
53     -fpic   Tells C compiler to generate PIC code and tells assembler that
54             PIC code has been generated.
55
56     -g      Send -g flag to ccom(1) to create debug output.  This unsets the
57             -O option.
58
59     -I path
60             Passed to the cpp(1) preprocessor to add header search directory
61             to override system defaults.
62
63     -include file
64             Tells the cpp(1) preprocessor to include the file during prepro‐
65             cessing.
66
67     -isystem path
68             Defines path as a system header directory for the cpp(1) pre‐
69             processor.
70
71     -k      Generate PIC code.  See -fpic option.
72
73     -L      TODO
74
75     -M      Pass -M flag to cpp(1) to generate dependencies for make(1).
76
77     -moptions
78             Target-dependent option.
79
80             ARM      -mlittle-endian -mbig-endian -mfpe=fpa -mfpe=vpf -msoft-
81                      float -march=armv1 -march=armv2 -march=armv2a
82                      -march=armv3 -march=armv4 -march=armv4t -march=armv4tej
83                      -march=armv5 -march=armv6 -march=armv6t2 -march=armv6kz
84                      -march=armv6k -march=armv7
85
86             HPPA
87
88             i386
89
90             MIPS     -mlittle-endian -mbig-endian -mhard-float -msoft-float
91
92             PDP-10
93
94             PowerPC
95
96             Sparc64
97
98             VAX
99
100     -nostartfiles
101             Do not link with the system startup files (crt0.c, etc.)
102
103     -nostdinc
104             Do not use the system include paths (/usr/include, etc.)
105
106     -nostdlib
107             Do not link with the system C library (libc).
108
109     -O      Enable optimizations.  Currently passes -xdeljumps and -xtemps to
110             ccom(1).  Note: this is unset if the -g option is used.
111
112     -o outfile
113             Save result to outfile.
114
115     -P      TODO
116
117     -pg     Enable profiling on the generated executable.
118
119     -pthread
120             Defines _PTHREADS preprocessor directive for cpp(1).  Uses
121             -lpthread for the ld(1) linker.
122
123     -S      Stop after compilation by ccom(1).  Do not assemble and do not
124             link.  The resulting assembler-language output is saved as a
125             filename with a “.s” suffix unless the -o option is used.  Note:
126             cannot be combined with -o if multiple files are given.
127
128     -static
129             Do not use dynamic linkage.  By default, it will link using the
130             dynamic linker options and/or shared objects for the platform.
131
132     -shared
133             Create a shared object of the result.  Tells the linker not to
134             generate an executable.
135
136     -t      Passes -t to cpp(1) for traditional C preprocessor syntax.
137
138     -U macro
139             Passes to the cpp(1) preprocessor to remove the initial macro
140             definition.
141
142     -v      Outputs the version of cc and shows what commands will be run
143             with their command line arguments.
144
145     -Wl flags
146             Options for the linker.
147
148     -X      Don't remove temporary files on exit.
149
150     -x      May be used to give separate optimization flags to ccom, see -O
151             for options.
152
153     -x c    Gcc compatibility option; specify that the language in use is c.
154
155   Predefined Macros
156     A few macros are predefined by cc when sent to cpp(1).
157
158     __PCC__  Set to the major version of pcc(1).  These macros can be used to
159     select code based on pcc(1) compatibility.  See the -v option.
160
161     __PCC_MINOR__  Set to the minor version.
162
163     __PCC_MINORMINOR__  Set to the minor-minor version — the number after the
164     minor version.
165
166     _PTHREADS  Defined when -pthread switch is used.
167
168     Also system- and/or machine-dependent macros may also be predefined; for
169     example: __NetBSD__, __ELF__, and __i386__.
170

SEE ALSO

172     as(1), ccom(1), cpp(1), ld(1)
173

HISTORY

175     The cc command comes from the original Portable C Compiler by S. C. John‐
176     son, written in the late 70's.
177
178     This product includes software developed or owned by Caldera Interna‐
179     tional, Inc.
180
181BSD                           September 14, 2007                           BSD
Impressum