9c.1 (3491B)
1 .TH 9C 1 2 .SH NAME 3 9c, 9l, 9ar \- C compiler, assembler, linker, archiver 4 .SH SYNOPSIS 5 .B 9c 6 [ 7 .B -I 8 .I path 9 ] 10 [ 11 .B -D 12 .I name 13 ] 14 .I file 15 \&... 16 .PP 17 .B 9l 18 [ 19 .I -o 20 .I target 21 ] 22 .I object 23 \&... 24 [ 25 .I library 26 \&... 27 ] 28 [ 29 .BI -L path 30 \&... 31 ] 32 [ 33 .BI -l name 34 \&... 35 ] 36 .PP 37 .B 9ar 38 .I key 39 [ 40 .I posname 41 ] 42 .I afile 43 [ 44 .I file 45 \&... 46 ] 47 .SH DESCRIPTION 48 These programs are shell scripts that invoke the appropriate standard tools 49 for the current operating system and architecture. 50 One can use them to write portable recipes for mkfiles. 51 .PP 52 .I 9c 53 compiles the named C 54 .I files 55 into object files for the current system. 56 The system C compiler is invoked with warnings enabled. 57 The 58 .B -I 59 option adds 60 .I path 61 to the include path, 62 and the 63 .B -D 64 option defines 65 .I name 66 in the C preprocessor. 67 .I 9c 68 always 69 defines the symbol 70 .B PLAN9PORT 71 defined in the C preprocessor and adds 72 .B $PLAN9/include 73 to the include path. 74 .PP 75 .I 9c 76 also defines 77 .B __sun__ 78 on SunOS systems. 79 .PP 80 .I 9l 81 links the named object files and libraries to create the target executable. 82 Each 83 .B -l 84 option specifies that a library named 85 .BI lib name .a 86 be found and linked. 87 The 88 .B -L 89 option adds directories to the library search path. 90 .I 9l 91 invokes the system linker with 92 .B $PLAN9/lib 93 already on the library search path. 94 .PP 95 .I 9l 96 searches the named objects and libraries for symbols of the form 97 .BI __p9l_autolib_ name \fR, 98 which it takes as indication that it should link 99 .BI $PLAN9/lib/lib name .a 100 as well. 101 It also examines such libraries to find their own dependencies. 102 A single 103 .B -l 104 option at the beginning of the command line disables this behavior. 105 The symbol 106 .BI __p9l_autolib_ name 107 is added to an object file by the macro 108 .B AUTOLIB( name )\fR, 109 defined in 110 .B <u.h>. 111 Header files associated with libraries contain 112 .B AUTOLIB 113 annotations; ordinary programs need not use them. 114 Due to shortcomings in the implementation, a source file may not 115 contain the same 116 .B AUTOLIB 117 statement multiple times. 118 .PP 119 .I 9ar 120 maintains object file archives called libraries. 121 The exact set of valid command keys varies from system to system, 122 but 123 .I 9ar 124 always provides the following key characters: 125 .TP 126 .B d 127 Delete 128 .I files 129 from the archive file. 130 .TP 131 .B r 132 Replace 133 .I files 134 in the archive file, or add them if missing. 135 .TP 136 .B t 137 List a table of contents of the archive. 138 If names are given, only those files are listed. 139 .TP 140 .B x 141 Extract the named files. 142 If no names are given, all files in the archive are 143 extracted. 144 In neither case does 145 .B x 146 alter the archive file. 147 .TP 148 .B v 149 Verbose. 150 Give a file-by-file 151 description of the making of a 152 new archive file from the old archive and the constituent files. 153 With 154 .BR t , 155 give a long listing of all information about the files, 156 somewhat like a listing by 157 .MR ls (1) , 158 showing 159 .br 160 .ns 161 .IP 162 .B 163 mode uid/gid size date name 164 .TP 165 .B c 166 Create. 167 Normally 168 .I 9ar 169 will create a new archive when 170 .I afile 171 does not exist, and give a warning. 172 Option 173 .B c 174 discards any old contents and suppresses the warning. 175 .PD 176 .PP 177 When a 178 .BR d , 179 .BR r , 180 or 181 .BR m 182 .I key 183 is specified, 184 .I 9ar 185 inserts a table of contents, required by the linker, at 186 the front of the library. 187 The table of contents is 188 rebuilt whenever the archive is modified. 189 .SH EXAMPLES 190 .TP 191 .L 192 9c file1.c file2.c file3.c 193 Compile three C source files. 194 .TP 195 .L 196 9ar rvc lib.a file[12].o 197 Archive the first two object files into a library. 198 .TP 199 .L 200 9l -o prog file3.o file4.o lib.a 201 Link the final two object files and any necessary objects from the library 202 into an executable. 203 .SH SOURCE 204 .B \*9/bin