[comp.unix.questions] make's usage of VPATH

mdv@domain.com (Mike Verstegen) (08/11/90)

A recent posting's comment about VPATH in make prompted me to use strings(1)
to check our make to see if our makes were configured with this feature.
Both of our systems' (3B2 V.3.1 and ISC 2.0.2) makes had the text VPATH in
them. Then, using the documentation for nmake, I tried to get VPATHs to work.
Unfortuanately, it did not. Either I don't understand VPATH as used in make,
or make doesn't understand what I'm asking for.

What I think VPATHs do is to provide alternate locations from source files
in make's dependency analysis. For example, if I'm working on a project and
I want to try out a private modification I could do the following:

Directory contents:

	/u/official.d		work.d
	=============		======
	foo.c			foo.c
	bar.c

Makefile contents:

	OBJ=foo.o bar.o
	fubar:	$(OBJ)
		cc -o fubar $(OBJ)

Commands executed:
	cd work.d
	VPATH=.:/u/official.d	# also tried putting this in Makfile, no change
	export VPATH
	make foobar

Results:
	Make:  Don't know how to make bar.o.  Stop.

I think (acutally I thought):
make would look in work.d and see foo.c in . (the first component in VPATH)
and compile to foo.o as usual [it did].  Then, it would look for bar.c
in . and see that it was not there. make would then look in /u/offical.d
(the next component in VPATH), see it there, and use that as the file for
complication [it did not].

Since VPATH is not a doucmented feature (at least that I can find) I know
I cannot expect it to work, though I really would like this capability. I would
appreciate any feedback on whether what I have described above is a correct
expection and, if so, why doesn't it work? If it's not supposed to work (i.e.
VPATH was there just to fool people like me), maybe I'll try to track down
nmake which claims to support this feature.

Please e-mail replies and I'll summarize if there is enough interest.

--
Mike Verstegen
..!uunet!comtst!mdv
mdv@domain.com