9C(1)

πŸ“¦ version 0_git20260208, in alpine 3.24, arch rolling, nixos 26.05, nixpkgs unstable

okay bestie, welcome to 9C(1) from the General Commands Manual β€” this is the 9c, 9l, 9ar page and it's giving portable-build-tool trio energy. grab a snack πŸ“ because we're doing compiler, linker, archiver, and yes, every single flag.

✨ NAME ✨

  • 9c, 9l, 9ar β€” C compiler, assembler, linker, archiver. literally the whole squad πŸ’…

πŸŽ€ SYNOPSIS πŸŽ€

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

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

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

πŸ’– DESCRIPTION πŸ’–

okay so these programs are shell scripts that invoke the appropriate standard tools for the current operating system and architecture. no cap. one can use them to write portable recipes for mkfiles. iconic behavior honestly πŸ¦‹

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

9c also defines __sun__ on SunOS systems. noted πŸ“

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

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.

🚨 implementation-shortcoming warning, bestie: due to shortcomings in the implementation, a source file may not contain the same AUTOLIB statement multiple times. don't do it, fr fr.

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. important!! πŸ™ˆ
  • 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. chef's kiss.

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. okay that's the tea β˜•

πŸ¦‹ EXAMPLES πŸ¦‹

9c file1.c file2.c file3.c

compile three C source files. easy.

9ar rvc lib.a file[12].o

archive the first two object files into a library. cute.

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. and that's the build, bestie πŸ’–

🌈 SOURCE 🌈

/bin


and that's the whole 9C(1) page from the General Commands Manual β€” source: /bin, page/version: 9C(1), and the footer doesn't show a date so I'm not making one up πŸ˜­πŸ’… mwah πŸ’–βœ¨