Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ mk(8) — UNIX System III

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

install(1M)

make(1)

MK(8)  —  UNIX 3.0

NAME

mk − how to remake the system and commands

DESCRIPTION

All source for UNIX is in a source tree distributed in the directory /usr/src.  This includes source for the operating system, libraries, commands, miscellaneous files necessary to the running system, and procedures to create everything from this source. 

The top level consists of the directories cmd, lib, uts, head, and stand as well as commands to remake each of these “directories”.  These commands are named :mk, which remakes everything, and :mkdir where dir is the directory to be recreated.  Each recreation command will make all or part of the piec; over which it has control.  :mk will run each of these commands and thus recreate the whole system. 

The lib directory contains libraries used when loading user programs.  The largest and most important of these is the C library.  All libraries are in sub-directories and are created by a makefile or runcom.  A runcom is a Shell command procedure used specifically to remake a piece of the system.  :mklib will rebuild the libraries that are given as arguments.  The argument \∗ will cause it to remake all libraries. 

The head directory contains the header files, usually found in /usr/include on the running system.  :mkhead will install those header files that are given as arguments.  The argument \∗ will cause it to install all header files. 

The uts directory contains the source for the UNIX operating system.  :mkuts (no arguments) invokes a series of makefiles that will recreate the operating system. 

The stand directory contains stand-alone commands and boot programs.  :mkstand will rebuild and install these programs. 

The cmd directory contains files and directories.  :mkcmd transforms source into a command based upon its suffix (.l, .y, .c, .s, .sh), or its makefile (see make(1)) or runcom. A directory is assumed to have a makefile or a runcom that will take care of creating everything associated with that directory and its sub-directories. Makefiles and runcoms are named command.mk and command.rc respectively. 

:mkcmd will recreate commands based upon a makefile or runcom if one of them exists; alternatively commands are recreated in a standard way based on the suffix of the source file.  All commands requiring more than one file of source are grouped in sub-directories, and must have a makefile or a runcom.  C programs (.c) are compiled by the C compiler and loaded stripped with shared text.  Assembly language programs (.s) are assembled with /usr/include/sys.s which contains the system call definitions.  Yacc programs (.y) and lex programs (.l) are processed by yacc(1) and lex(1) respectively before C compilation. Shell programs (.sh) are copied to create the command.  Each of these operations leaves a command in ./cmd which is then installed by using /etc/install. 

The arguments to :mkcmd are either command names, or subsystem names.  The subsystems distributed with UNIX are: acct, graf, rje, sccs, and text.  Prefacing the :mkcmd instruction with an assignment to the Shell variable $ARGS will cause the indicated components of the subsystem to be rebuilt. 

The entire sccs subsystem can be rebuilt by:

/usr/src/:mkcmd  sccs

while the delta component of sccs can be rebuilt by:

ARGS="delta"  /usr/src/:mkcmd  sccs

The log command, which is a part of the stat package, which is itself a part of the graf package, can be rebuilt by:

ARGS="stat log"  /usr/src/:mkcmd  graf

The argument \∗ will cause all commands and subsystems to be rebuilt. 

Makefiles, both in ./cmd and in sub-directories, have a standard format.  In particular :mkcmd depends on there being entries for install and clobber. Install should cause everything over which the makefile has jurisdiction to be made and installed by /etc/install.  Clobber should cause a complete cleanup of all unnecessary files resulting from the previous invocation. 

Most of the runcoms in ./cmd (as opposed to sub-directories) relate in particular to a need for separated instruction and data (I and D) space. 

In the past, dependency on the C library routine ctime(3C) was also important. Ctime had to be modified for all systems located outside of the eastern time zone, and all commands that referenced it had to be recompiled.  Ctime has been rewritten to check the environment (see environ(7)) for the time zone. This results in time zone conversions possible on a per-process basis. /etc/profile sets the initial environment for each user, and /etc/rc sets it for certain system daemons.  These two programs are the only ones which must be modified outside of the eastern time zone. 

An effort has been made to separate the creation of a command from source, and its installation on the running system.  The command /etc/install is used by :mkcmd and most makefiles to install commands in the proper place on the running system.  The use of install allows maximum flexibility in the administration of the system.  Install makes very few assumptions about where a command is located, who owns it, and what modes are in effect.  All assumptions may be overridden on invocation of the command, or more permanently by redefining a few variables in install.  The object is to install a new version of a command in the same place, with the same attributes as the prior version. 

In addition, the use of a separate command to perform installation allows for the creation of test systems in other than standard places, easy movement of commands to balance load, and independent maintenance of makefiles.  The minimization of makefiles in most cases, and the site independence of the others should greatly reduce the necessary maintenance, and allow makefiles to be considered part of the standard source. 

SEE ALSO

install(1M), make(1). 

May 16, 1980

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026