blob: 894a34aebaf8ead82b0c53ae1ec222893930c0be [file] [log] [blame]
<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>