9C(1)

NAME
9c, 9a, 9l, 9ar - C compiler, assembler, linker, archiver

SYNOPSIS
9c [ -I path ] [ -D name ] file ...

9a file ...

9l [ -o target ] object ... [ library ... ] [ -Lpath ... ] [ -lname ... ]

9ar key [ posname ] afile [ file ... ]

DESCRIPTION
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.

9c compiles the named C files into object files for the current system. The system C compiler is invoked with warnings enabled. The -I option adds path to the include path, and the -D option defines name in the C preprocessor. 9c always defines the symbol PLAN9PORT defined in the C preprocessor and adds $PLAN9/include to the include path.

9c also defines __sun__ on SunOS systems and __Linux26__ on Linux systems with 2.6-series kernels.

9a assembles the named files into object files for the current system. Unlike some system assemblers, it does not promise to run the C preprocessor on the source files.

9l links the named object files and libraries to create the target executable. Each -l option specifies that a library named libname.a be found and linked. The -L option adds directories to the library search path. 9l invokes the system linker with $PLAN9/lib already on the library search path.

9l searches the named objects and libraries for symbols of the form __p9l_autolib_name, which it takes as indication that it should link $PLAN9/lib/libname.a as well. It also examines such libraries to find their own dependencies. A single -l option at the beginning of the command line disables this behavior. The symbol __p9l_autolib_name is added to an object file by the macro AUTOLIB( name ), defined in <u.h>. Header files associated with libraries contain AUTOLIB annotations; ordinary programs need not use them. Due to shortcomings in the implementation, a source file may not contain the same AUTOLIB statement multiple times.

9ar maintains object file archives called libraries. The exact set of valid command keys varies from system to system, but 9ar always provides the following key characters:

d   Delete files from the archive file.

r   Replace files in the archive file, or add them if missing.

t   List a table of contents of the archive. If names are given, only those files are listed.

x   Extract the named files. If no names are given, all files in the archive are extracted. In neither case does x alter the archive file.

v   Verbose. Give a file-by-file description of the making of a new archive file from the old archive and the constituent files. With t, give a long listing of all information about the files, somewhat like a listing by ls(1), showing

        mode uid/gid size date name

c   Create. Normally 9ar will create a new archive when afile does not exist, and give a warning. Option c discards any old contents and suppresses the warning.

When a d, r, or m key is specified, 9ar 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.

EXAMPLES

9c file1.c file2.c file3.c
    Compile three C source files.

9a file4.s
    Assemble one assembler source file.

9ar rvc lib.a file[12].o
    Archive the first two object files into a library.

9l -o prog file3.o file4.o lib.a
    Link the final two object files and any necessary objects from the library into an executable.

SOURCE
/usr/local/plan9/bin