1CC(1) General Commands Manual CC(1)
2
3
4
6 cc - C compiler (2BSD)
7
9 cc [ option ] ... file ...
10
12 Cc is the UNIX C compiler. Cc accepts several types of arguments:
13
14 Arguments whose names end with `.c' are taken to be C source programs;
15 they are compiled, and each object program is left on the file whose
16 name is that of the source with `.o' substituted for `.c'. The `.o'
17 file is normally deleted, however, if a single C program is compiled
18 and loaded all at one go.
19
20 In the same way, arguments whose names end with `.s' are taken to be
21 assembly source programs and are assembled, producing a `.o' file.
22
23 The following options are interpreted by cc. See ld(1) for load-time
24 options.
25
26 -c Suppress the loading phase of the compilation, and force an
27 object file to be produced even if only one program is com‐
28 piled.
29
30 -w Suppress warning diagnostics.
31
32 -p Arrange for the compiler to produce code which counts the num‐
33 ber of times each routine is called. If loading takes place,
34 replace the standard startup routine by one which automatically
35 calls monitor(3) at the start and arranges to write out a
36 mon.out file at normal termination of execution of the object
37 program. An execution profile can then be generated by use of
38 prof(1).
39
40 -O Invoke an object-code improver.
41
42 -S Compile the named C programs, and leave the assembler-language
43 output on corresponding files suffixed `.s'.
44
45 -M Run only the macro preprocessor on the named C programs,
46 requesting it to generate Makefile dependencies and send the
47 result to the standard output.
48
49 -E Run only the macro preprocessor on the named C programs, and
50 send the result to the standard output.
51
52 -C prevent the macro preprocessor from eliding comments.
53
54 -o output
55 Name the final output file output. If this option is used the
56 file `a.out' will be left undisturbed.
57
58 -Dname=def
59 -Dname Define the name to the preprocessor, as if by `#define'. If no
60 definition is given, the name is defined as "1".
61
62 -Uname Remove any initial definition of name.
63
64 -Idir `#include' files whose names do not begin with `/' are always
65 sought first in the directory of the file argument, then in
66 directories named in -I options, then in directories on a stan‐
67 dard list.
68
69 -Ldir Library archives are sought first in directories named in -L
70 options, then in directories on a standard list.
71
72 -Bstring
73 Find substitute compiler passes in the files named string with
74 the suffixes cpp, c0, c1 and c2. If string is empty, use a
75 standard backup version.
76
77 -t[p012]
78 Find only the designated compiler passes in the files whose
79 names are constructed by a -B option. In the absence of a -B
80 option, the string is taken to be `/usr/c/'.
81
82 Other arguments are taken to be either loader option arguments, or C-
83 compatible object programs, typically produced by an earlier cc run, or
84 perhaps libraries of C-compatible routines. These programs, together
85 with the results of any compilations specified, are loaded (in the
86 order given) to produce an executable program with name a.out.
87
89 file.c input file
90 file.o object file
91 a.out loaded output
92 /tmp/ctm? temporary
93 /lib/cpp preprocessor
94 /lib/c[01] compiler
95 /lib/c2 optional optimizer
96 /lib/crt0.o runtime startoff
97 /lib/mcrt0.o startoff for profiling
98 /lib/libc.a standard library, see intro(3)
99 /usr/lib/libc_p.aprofiling library, see intro(3)
100 /usr/include standard directory for `#include' files
101 mon.out file produced for analysis by prof(1)
102
104 B. W. Kernighan and D. M. Ritchie, The C Programming Language, Pren‐
105 tice-Hall, 1978
106 B. W. Kernighan, Programming in C—a tutorial
107 D. M. Ritchie, C Reference Manual
108 monitor(3), prof(1), adb(1), ld(1), as(1)
109
111 The diagnostics produced by C itself are intended to be self-explana‐
112 tory. Occasional messages may be produced by the assembler or loader.
113
115 The compiler currently ignores advice to put char, unsigned char, long,
116 float, or double variables in registers.
117
118
119
1203rd Berkeley Distribution June 7, 1985 CC(1)