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