BSD 4_2 development
[unix-history] / usr / man / man1 / cc.1
CommitLineData
faa1e6a0
C
1.TH CC 1 "9 February 1982"
2.UC 4
3.SH NAME
4cc \- C compiler
5.SH SYNOPSIS
6.B cc
7[ option ] ... file ...
8.SH DESCRIPTION
9.I Cc
10is the UNIX C compiler.
11.I Cc
12accepts several types of arguments:
13.PP
14Arguments whose names end with `.c' are taken to be
15C source programs; they are compiled, and
16each object program is left on the file
17whose name is that of the source with `.o' substituted
18for `.c'.
19The `.o' file is normally deleted, however, if a single
20C program is compiled and loaded all at one go.
21.PP
22In the same way,
23arguments whose names end with `.s' are taken to be assembly source programs
24and are assembled, producing a `.o' file.
25.PP
26The following options are interpreted by
27.IR cc .
28See
29.IR ld (1)
30for load-time options.
31.TP 8
32.B \-c
33Suppress the loading phase of the compilation, and force
34an object file to be produced even if only one program is compiled.
35.TP
36.B \-g
37Have the compiler produce additional symbol table information
38for
39.IR dbx (1).
40Also pass the
41.B \-lg
42flag to
43.IR ld (1).
44.TP
45.B \-go
46Have the compiler produce additional symbol table information
47for the obsolete debugger
48.IR sdb (1).
49Also pass the
50.B \-lg
51flag to
52.IR ld (1).
53.TP
54.B \-w
55Suppress warning diagnostics.
56.TP
57.B \-p
58Arrange for the compiler to produce code
59which counts the number of times each routine is called.
60If loading takes place, replace the standard startup
61routine by one which automatically calls
62.IR monitor (3)
63at the start and arranges to write out a
64.I mon.out
65file at normal termination of execution of the object program.
66An execution profile can then be generated by
67use of
68.IR prof (1).
69.TP
70.B \-pg
71Causes the compiler to produce counting code in the manner of
72.B \-p,
73but invokes a run-time recording mechanism that keeps more
74extensive statistics and produces a
75.I gmon.out
76file at normal termination.
77Also, a profiling library is searched, in lieu of the standard C library.
78An execution profile can then be generated by use of
79.IR gprof (1).
80.TP
81.SM
82.B \-O
83Invoke an
84object-code improver.
85.TP
86.SM
87.B \-R
88Passed on to
89.I as,
90making initialized variables shared and read-only.
91.TP
92.SM
93.B \-S
94Compile the named C programs, and leave the
95assembler-language output on corresponding files suffixed `.s'.
96.TP
97.SM
98.B \-E
99Run only the macro preprocessor
100on the named C programs, and send the result to the
101standard output.
102.TP
103.SM
104.B \-C
105prevent the macro preprocessor from eliding comments.
106.TP
107.BI \-o " output"
108Name the final output file
109.IR output .
110If this option is used the file `a.out' will be left undisturbed.
111.TP
112.SM
113.BI \-D name=def
114.br
115.ns
116.TP
117.SM
118.BI \-D \*Sname
119Define the
120.I name
121to the preprocessor,
122as if by
123`#define'.
124If no definition is given, the name is defined as "1".
125.TP
126.SM
127.BI \-U \*Sname
128Remove any initial definition of
129.IR name .
130.TP
131.SM
132.BI \-I \*Sdir
133`#include' files
134whose names do not begin with `/' are always
135sought first in the directory
136of the
137.I file
138argument,
139then in directories named in
140.B \-I
141options,
142then in directories on a standard list.
143.TP
144.SM
145.BI \-B \*Sstring
146Find substitute compiler passes in the files named
147.I string
148with the suffixes cpp, ccom and c2.
149If
150.I string
151is empty, use a standard backup version.
152.TP
153.BR \-t [ p012 ]
154Find only the designated compiler passes in the
155files whose names are constructed by a
156.B \-B
157option.
158In the absence of a
159.B \-B
160option, the
161.I string
162is taken to be `/usr/c/'.
163.PP
164Other arguments
165are taken
166to be either loader option arguments, or C-compatible
167object programs, typically produced by an earlier
168.I cc
169run,
170or perhaps libraries of C-compatible routines.
171These programs, together with the results of any
172compilations specified, are loaded (in the order
173given) to produce an executable program with name
174.B a.out.
175.SH FILES
176.ta \w'/usr/c/occom 'u
177file.c input file
178.br
179file.o object file
180.br
181a.out loaded output
182.br
183/tmp/ctm? temporary
184.br
185/lib/cpp preprocessor
186.br
187/lib/ccom compiler
188.br
189/usr/c/occom backup compiler
190.br
191/usr/c/ocpp backup preprocessor
192.br
193/lib/c2 optional optimizer
194.br
195/lib/crt0.o runtime startoff
196.br
197/lib/mcrt0.o startoff for profiling
198.br
199/usr/lib/gcrt0.o startoff for gprof-profiling
200.br
201/lib/libc.a standard library, see
202.IR intro (3)
203.br
204/usr/lib/libc_p.a profiling library, see
205.IR intro (3)
206.br
207/usr/include standard directory for `#include' files
208.br
209mon.out file produced for analysis by
210.IR prof (1)
211.br
212gmon.out file produced for analysis by
213.IR gprof (1)
214.SH "SEE ALSO"
215B. W. Kernighan and D. M. Ritchie,
216.I The C Programming Language,
217Prentice-Hall,
2181978
219.br
220B. W. Kernighan,
221.I
222Programming in C\(ema tutorial
223.br
224D. M. Ritchie,
225.I
226C Reference Manual
227.br
228monitor(3), prof(1), gprof(1), adb(1), ld(1), dbx(1), as(1)
229.SH DIAGNOSTICS
230The diagnostics produced by C itself are intended to be
231self-explanatory.
232Occasional messages may be produced by the assembler
233or loader.
234.SH BUGS
235The compiler currently ignores advice to put
236\fBchar\fR, \fBunsigned char\fR,
237\fBshort\fR or \fBunsigned short\fR variables in registers. It previously
238produced poor, and in some cases incorrect, code for such declarations.