Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
9C(1)			    General Commands Manual			 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.

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

       9l links	the named object files and libraries to	create the target exe-
       cutable.	  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 li-
       brary 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; or-
       dinary  programs	 need not use them.  Due to shortcomings in the	imple-
       mentation, 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  pro-
       vides 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 ar-
	      chive 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 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  con-
	      tents 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 con-
       tents 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
       /bin

									 9C(1)

NAME | SYNOPSIS | DESCRIPTION | EXAMPLES | SOURCE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=9c&sektion=1&manpath=FreeBSD+13.0-RELEASE+and+Ports>

home | help