This is the source tree for the V commands directory.
Below, CMD may be some command (e.g. date); MACHINE is some
machine (currently m68k, vax or (in a few cases) unix).
Object files are generated under machine-specific subdirectories
of the form /xV/cmds/CMD/MACHINE.

The buildfiles and buildtemplates are arranged in the following manner:

                          cmds
                          - buildfile
			  - buildlibtemplate
			  - buildmitemplate
			     |
     ------------------------------------------------
     |                 |              |             |
   m68k              vax             unix           CMD (e.g date)
   - buildfile       - buildfile     -buildfile     - buildfile
   - buildtemplate   - buildtemplate -buildtemplate |
                            ------------------------------------
                            |           |           |          |
                           m68k        vax         unix        mi
                           - buildfile - buildfile - buildfile - buildfile
						               - buildtemplate

cmds/buildfile makes everything.
cmds/CMD/buildfile makes all versions of a particular command
cmds/CMD/mi/buildfile makes all cmds/CMD/* directories.
cmds/MACHINE/buildfile makes all cmds/*/MACHINE directories.
cmds/MACHINE/CMD/buildfile only makes that subdirectory.

The buildfile under mi directories as well as the buildfile under the subject 
directory (i.e. date) is an include of cmds/buildmitemplate.
cmds/buildlibtemplate has a list of all subdirectories under cmds in
such a way that one can build all m68k and vax directories from cmds/m68k
and cmds/vax, respectively. This scheme eases the maintenance of buildfiles 
and prevents code duplication.

To install, cd to the desired level of the hierarchy, and "build install".
E.g. cd to cmds/CMD/mi to install all versions of CMD.

If you change a buildfile, buildtemplate, or something of that nature,
you should cd to cmds (or a lower inclusive subdirectory) and do a
"build". Also beware that the loader leaves the executables around 
even when the build is not successful. If you were to build again in
that subdirectory without making a correction to any of the source files, 
build would tell you that CMD.m68k and/or CMD.vax was upto date, disguising
the problem in that subdirectory. So if you need to be sure whether a
subdirectory works or not, you should do a "build clean" before "build".

The buildfile in an object subdirectory (cmds/CMD/MACHINE) is
almost always just a combination (using #include) of:
    cmds/MACHINE/buildtemplate (machine-specific command-independent rules)
and:
    cmds/CMD/mi/buildtemplate (machine-independent command-specific rules).

This assumes that all machine-dependent source is in the object
directory, as well as machine-independent source in the corresponding
machine-independent source directory of the same name. Otherwise, some
fix up is required.

No source files are checked out by the buildfiles.  They use whatever
files are lying around -- this way, when someone does a build, they
don't clobber your work by checking stuff out.  The buildfiles also use
ALL the files it sees named *.[cs] in the machine directory and *.c in
the mi directory.  

When you add a new "command" take "date" subdirectory for example and copy
buildfiles for date, date/{m68k,vax,mi} subdirectories to the corresponding
directories for your command. The only thing that needs to be edited is 
the name of the directory. Buildtemplate in "command"/mi is unique for
every command but has the following skeleton. The /xV/cmds/buildfile
should be edited to add the new command to the list of directories to
be built from the top.

*************************************************************************

#Buildtemplate for "command" subdirectory
 
SOURCES = list of source files
HEADERS = list of header files
OBJECTS = list of object files listed with .$(OBJSUFFIX) suffix.

all:	command1.$(MACHINE) command2.$(MACHINE) 

command1.$(MACHINE): command1.c
	$(CC) $(MIFLAGS) $(MDFLAGS) $(INCLUDES) -o command1.$(MACHINE) \
                   command1.c $(LIBRARIES)

command2.$(MACHINE): command2.c
	$(CC) $(MIFLAGS) $(MDFLAGS) $(INCLUDES) -o command2.$(MACHINE) \
		command2.c $(LIBRARIES)


install: all
	$(NETINSTALL) -p "command1.$(MACHINE) command2.$(MACHINE)" \
		$(VSYS)/bin
 
clean:
	rm -f *.BAK *.CKP .emacs_* *.s $(OBJECTS) command1.$(MACHINE) \
        	command2.$(MACHINE)
 
cleanbak:
	rm -f *.BAK *.CKP .emacs_*
 
tags: $(HEADERS) $(SOURCES)
	ctags $(HEADERS) $(SOURCES)
	mv tags ../mi/tags
 
lint:
	lint -hbxac $(HEADERS) $(SOURCES)
