[btl.unix] Found: a version of 'make' that uses a MAKEPATH

ggr@pyuxbb.UUCP (09/28/83)

Well, it uses the environment variable VPATH, and you won't guess where
I found it.  In my own /usr/src/cmd/make directory.  It seems that
if you have a USG UNIX (aka System III or System V) you already
have this undocumented (of course) feature.  Thanks to Guy Harris
(that other Guy) who had remembered it from a bout of code-reading
he once did.

Thanks also to many who replied having make front-ends that fiddle
with linking files, read '.from' files to get paths, or take
'.PREFIXES' lines in the Makefile itself.

This feature is *not* in the Version 7 make, nor in various BSD
makes I've seen (at least not as VPATH).

Now to make it useful:  it seems to be adequate (if you carefully
craft your Makefiles) *if* the search directories other than the
current are kept up to date (object files not deleted).
Otherwise, you get results like:

	$ VPATH=:/usr/src/cmd/diff make -f /usr/src/cmd/diff/diff.mk
		cc -O -s -i -o diff diff.c
	0: No source file diff.c
	*** Error code 1

	Stop.

Now you can get around this by making a 'cc' command that uses VPATH
also, does stat's on its arguments that look like input file names, and
replaces them with full pathnames before invoking the real /bin/cc.
(You have to do this with commands other than cc as well.)
Or maybe I can work this into make itself.
Or maybe I'll take another look at the other solutions.

			=== Guy Riddle == AT&T Bell Laboratories, Piscataway ===

ggr@pyuxbb.UUCP (Guy Riddle) (09/29/83)

I forgot to mention an interesting trifle about VPATH yesterday.
The directories in the VPATH search path can be separated by ':'s,
as you might expect, or they may be separated by '-'s, which
you wouldn't unless you were a UNIX history buff.

The separation of directories by hypens is apparently a "compatability
feature" from the dark past.  It seems that a very early version of
the Bourne shell, when it was called /bin/bsh and wasn't the "real"
shell yet, separated directory names in the PATH variable with hyphens.
When Steve changed to colons, bunches of programs were fixed to
handle either one.  Apparently there remain places where this legacy
lives on.

So watch out if you like to put hyphens in your directory names.

			=== Guy Riddle == AT&T Bell Laboratories, Piscataway ===