Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ mk(8) — CX/UX 6.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

install(1M)

lex(1)

make(1)

yacc(1)

ctime(3C)

environ(5)

mk(8)

NAME

mk − how to remake the system and commands

DESCRIPTION

All source for the UNIX system 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, games, 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 piece, over which it has control. 

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 stand directory contains stand-alone commands and boot programs.  :mkstand will rebuild and install these programs. 

The games directory contains the fortune(6) utility and a set of games familiar to UNIX users.  :mkgames 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. 

The command :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 as(1) and loaded stripped with shared text.  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. 

The arguments to :mkcmd are either command names or subsystem names.  The subsystems distributed with the UNIX system 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. 

The uts directory contains the source for the UNIX operating system.  See Chapter 4 of the CX/UX System Administration Manual for instructions on how to rebuild the kernel. 

Makefiles, both in ./cmd and in sub-directories, have a standard format.  In particular :mkcmd depends on there being entries for install, all, and clobber. Install should cause everything over which the makefile has jurisdiction to be made and installed by /etc/install.  All should cause everything over which the makefile has jurisdiction to be made but it will not be installed.  Instead, the object is left in the sub-directory.  Clobber should cause a complete cleanup of all unnecessary files resulting from the previous invocation.  Each of the :mkdir commands can be passed the -i option to perform an install on the sub-directory and the -c option to perform a clobber on the sub-directory.  If -i is not passed, all is performed. 

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. 

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(5)) for the time zone.  This results in time zone conversions possible on a per-process basis.  The file /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. 

SEE ALSO

install(1M), lex(1), make(1), yacc(1), ctime(3C), and environ(5). 

CX/UX Administrator’s Reference

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