Blob


1 .TH 9C 1
2 .SH NAME
3 9c, 9a, 9l, 9ar \- C compiler, assembler, linker, archiver
4 .SH SYNOPSIS
5 .B 9c
6 .I file
7 \&...
8 .PP
9 .B 9a
10 .I file
11 \&...
12 .PP
13 .B 9l
14 [
15 .I -o
16 .I target
17 ]
18 .I object
19 \&...
20 [
21 .I library
22 \&...
23 ]
24 [
25 .BI -L path
26 \&...
27 ]
28 [
29 .BI -l library
30 \&...
31 ]
32 .PP
33 .B 9ar
34 .I key
35 [
36 .I posname
37 ]
38 .I afile
39 [
40 .I file
41 \&...
42 ]
43 .SH DESCRIPTION
44 These programs are shell scripts that invoke the appropriate standard tools
45 for the current operating system and architecture.
46 One can use them to write portable recipes for mkfiles.
47 .PP
48 .I 9c
49 compiles the named C
50 .I files
51 into object files for the current system.
52 The system C compiler is invoked with warnings enabled,
53 with the symbol
54 .B PLAN9PORT
55 is defined in the C preprocessor, and with
56 .B $PLAN9/include
57 on the include path.
58 .PP
59 .I 9c
60 also defines
61 .B __sun__
62 on SunOS systems and
63 .B __Linux26__
64 on Linux systems with 2.6-series kernels.
65 .PP
66 .I 9a
67 assembles the named files into object files for the current system.
68 Unlike some system assemblers, it does
69 .I not
70 promise to run the C preprocessor on the source files.
71 .PP
72 .I 9l
73 links the named object files and libraries to create the target executable.
74 Each
75 .B -l
76 option specifies that a library named
77 .BI lib library .a
78 be found and linked.
79 The
80 .B -L
81 option adds directories to the library search path.
82 .I 9l
83 invokes the system linker with
84 .B $PLAN9/lib
85 already on the library search path.
86 .PP
87 .I 9ar
88 maintains object file archives called libraries.
89 The exact set of valid command keys varies from system to system,
90 but
91 .I 9ar
92 always provides the following key characters:
93 .TP
94 .B d
95 Delete
96 .I files
97 from the archive file.
98 .TP
99 .B r
100 Replace
101 .I files
102 in the archive file, or add them if missing.
103 .TP
104 .B t
105 List a table of contents of the archive.
106 If names are given, only those files are listed.
107 .TP
108 .B x
109 Extract the named files.
110 If no names are given, all files in the archive are
111 extracted.
112 In neither case does
113 .B x
114 alter the archive file.
115 .TP
116 .B v
117 Verbose.
118 Give a file-by-file
119 description of the making of a
120 new archive file from the old archive and the constituent files.
121 With
122 .BR t ,
123 give a long listing of all information about the files,
124 somewhat like a listing by
125 .IR ls (1),
126 showing
127 .br
128 .ns
129 .IP
130 .B
131 mode uid/gid size date name
132 .TP
133 .B c
134 Create.
135 Normally
136 .I 9ar
137 will create a new archive when
138 .I afile
139 does not exist, and give a warning.
140 Option
141 .B c
142 discards any old contents and suppresses the warning.
143 .PD
144 .PP
145 When a
146 .BR d ,
147 .BR r ,
148 or
149 .BR m
150 .I key
151 is specified,
152 .I 9ar
153 inserts a table of contents, required by the linker, at
154 the front of the library.
155 The table of contents is
156 rebuilt whenever the archive is modified.
157 .SH EXAMPLE
158 .TP
159 .L
160 9c file1.c file2.c file3.c
161 Compile three C source files.
162 .TP
163 .L
164 9a file4.s
165 Assemble one assembler source file.
166 .TP
167 .L
168 9ar rvc lib.a file[12].o
169 Archive the first two object files into a library.
170 .L
171 9l -o prog file3.o file4.o lib.a
172 Link the final two object files and any necessary objects from the library
173 into an executable.
174 .SH SOURCE
175 .B /usr/local/plan9/bin