%% "Reynolds, John" <[EMAIL PROTECTED]> writes:

No need to send HTML to the list; plain text is sufficient.  Thanks.

  rj> I've been reading the GNU make manual and trying to understand how
  rj> make will search subdirs for files that are dependencies. So far,
  rj> I've not had much luck.

  rj> VPATH = .;hello2
  rj> objects = hello.o hello2.o

  rj> all     :       hello

  rj> hello   : $(objects)
  rj>         gcc -o hello $(objects)

  rj> hello.o : hello.cpp
  rj>         gcc -c hello.cpp

  rj> hello2.o        : hello2.cpp

Your problem is you're writing these rules incorrectly.  See the GNU
make manual, section ``Writing Shell Commands With Directory Search''.

If you want to use VPATH, you can't write the names of the targets or
prerequisites directly in the command scripts; here you _explicitly_ use
hello, hello.cpp, and $(objects) in your compile/link invocation lines.

You _MUST_ use automatic variables, not explicit values, if you want to
use VPATH.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.ultranet.com/~pauld/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

Reply via email to