aboutsummaryrefslogtreecommitdiff
path: root/man/man1/9c.html
blob: 894a34aebaf8ead82b0c53ae1ec222893930c0be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<head>
<title>9c(1) - Plan 9 from User Space</title>
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
</head>
<body bgcolor=#ffffff>
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr height=10><td>
<tr><td width=20><td>
<tr><td width=20><td><b>9C(1)</b><td align=right><b>9C(1)</b>
<tr><td width=20><td colspan=2>
    <br>
<p><font size=+1><b>NAME     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    9c, 9a, 9l, 9ar &ndash; C compiler, assembler, linker, archiver<br>
    
</table>
<p><font size=+1><b>SYNOPSIS     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    <tt><font size=+1>9c</font></tt> [ <tt><font size=+1>&#8722;I</font></tt> <i>path</i> ] [ <tt><font size=+1>&#8722;D</font></tt> <i>name</i> ] <i>file</i> ... 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <tt><font size=+1>9a</font></tt> <i>file</i> ... 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <tt><font size=+1>9l</font></tt> [ <i>-o target</i> ] <i>object</i> ... [ <i>library</i> ... ] [ <tt><font size=+1>&#8722;L</font></tt><i>path</i> ... ] [ <tt><font size=+1>&#8722;l</font></tt><i>name</i>
    ... ] 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <tt><font size=+1>9ar</font></tt> <i>key</i> [ <i>posname</i> ] <i>afile</i> [ <i>file</i> ... ]<br>
    
</table>
<p><font size=+1><b>DESCRIPTION     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    These programs are shell scripts that invoke the appropriate standard
    tools for the current operating system and architecture. One can
    use them to write portable recipes for mkfiles. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>9c</i> compiles the named C <i>files</i> into object files for the current
    system. The system C compiler is invoked with warnings enabled.
    The <tt><font size=+1>&#8722;I</font></tt> option adds <i>path</i> to the include path, and the <tt><font size=+1>&#8722;D</font></tt> option
    defines <i>name</i> in the C preprocessor. <i>9c</i> always defines the symbol
    <tt><font size=+1>PLAN9PORT</font></tt> defined in the C preprocessor and adds
    <tt><font size=+1>$PLAN9/include</font></tt> to the include path. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>9c</i> also defines <tt><font size=+1>__sun__</font></tt> on SunOS systems and <tt><font size=+1>__Linux26__</font></tt> on Linux
    systems with 2.6-series kernels. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>9a</i> assembles the named files into object files for the current
    system. Unlike some system assemblers, it does <i>not</i> promise to
    run the C preprocessor on the source files. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>9l</i> links the named object files and libraries to create the target
    executable. Each <tt><font size=+1>&#8722;l</font></tt> option specifies that a library named <tt><font size=+1>lib</font></tt><i>name</i><tt><font size=+1>.a</font></tt>
    be found and linked. The <tt><font size=+1>&#8722;L</font></tt> option adds directories to the library
    search path. <i>9l</i> invokes the system linker with <tt><font size=+1>$PLAN9/lib</font></tt> already
    on the library search path. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>9l</i> searches the named objects and libraries for symbols of the
    form <tt><font size=+1>__p9l_autolib_</font></tt><i>name</i>, which it takes as indication that it
    should link <tt><font size=+1>$PLAN9/lib/lib</font></tt><i>name</i><tt><font size=+1>.a</font></tt> as well. It also examines such
    libraries to find their own dependencies. A single <tt><font size=+1>&#8722;l</font></tt> option at
    the beginning of the command line disables this
    behavior. The symbol <tt><font size=+1>__p9l_autolib_</font></tt><i>name</i> is added to an object
    file by the macro <tt><font size=+1>AUTOLIB( name )</font></tt>, defined in <tt><font size=+1>&lt;u.h&gt;.</font></tt> Header files
    associated with libraries contain <tt><font size=+1>AUTOLIB</font></tt> annotations; ordinary
    programs need not use them. Due to shortcomings in the implementation,
    a source file may not contain the
    same <tt><font size=+1>AUTOLIB</font></tt> statement multiple times. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>9ar</i> maintains object file archives called libraries. The exact
    set of valid command keys varies from system to system, but <i>9ar</i>
    always provides the following key characters:<br>
    <tt><font size=+1>d</font></tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Delete <i>files</i> from the archive file.<br>
    <tt><font size=+1>r</font></tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Replace <i>files</i> in the archive file, or add them if missing.<br>
    <tt><font size=+1>t</font></tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;List a table of contents of the archive. If names are given,
    only those files are listed.<br>
    <tt><font size=+1>x</font></tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Extract the named files. If no names are given, all files in
    the archive are extracted. In neither case does <tt><font size=+1>x</font></tt> alter the archive
    file.<br>
    <tt><font size=+1>v</font></tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Verbose. Give a file-by-file description of the making of a new
    archive file from the old archive and the constituent files. With
    <tt><font size=+1>t</font></tt>, give a long listing of all information about the files, somewhat
    like a listing by <a href="../man1/ls.html"><i>ls</i>(1)</a>, showing<br>
    
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        
        <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

            <tt><font size=+1>mode uid/gid size date name<br>
            </font></tt>
        </table>
        
    </table>
    <tt><font size=+1>c</font></tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create. Normally <i>9ar</i> will create a new archive when <i>afile</i> does
    not exist, and give a warning. Option <tt><font size=+1>c</font></tt> discards any old contents
    and suppresses the warning. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    When a <tt><font size=+1>d</font></tt>, <tt><font size=+1>r</font></tt>, or <tt><font size=+1>m</font></tt> <i>key</i> is specified, <i>9ar</i> inserts a table of contents,
    required by the linker, at the front of the library. The table
    of contents is rebuilt whenever the archive is modified.<br>
    
</table>
<p><font size=+1><b>EXAMPLES     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    <tt><font size=+1>9c file1.c file2.c file3.c<br>
    </font></tt>
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        Compile three C source files.<br>
        
    </table>
    <tt><font size=+1>9a file4.s<br>
    </font></tt>
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        Assemble one assembler source file.<br>
        
    </table>
    <tt><font size=+1>9ar rvc lib.a file[12].o<br>
    </font></tt>
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        Archive the first two object files into a library.<br>
        
    </table>
    <tt><font size=+1>9l &#8722;o prog file3.o file4.o lib.a<br>
    </font></tt>
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        Link the final two object files and any necessary objects from
        the library into an executable.<br>
        
    </table>
    
</table>
<p><font size=+1><b>SOURCE     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    <tt><font size=+1>/usr/local/plan9/bin<br>
    </font></tt>
</table>

<td width=20>
<tr height=20><td>
</table>
<!-- TRAILER -->
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr height=15><td width=10><td><td width=10>
<tr><td><td>
<center>
<a href="../../"><img src="../../dist/spaceglenda100.png" alt="Space Glenda" border=1></a>
</center>
</table>
<!-- TRAILER -->
</body></html>