Make: Compiling source code from a different directory.

Brad Yearwood brad at optilink.UUCP
Thu Nov 30 19:21:45 AEST 1989


>From article <4652 at cogito.cs.vu.nl>, by erikb at cs.vu.nl (Erik Baalbergen):
# In article <404 at massey.ac.nz> K.Spagnolo at massey.ac.nz (Ken Spagnolo) writes:
# ->We have several machines that all need to run the same code.  Rather
# ->than keep the source on each and worry about keeping them up to date,
# ->...
# ->%.o: $(SRCDIR)/%.c
# ->	$(CC) $(CFLAGS) -c $<
# ->
# ->It works fine on the Sun, but when I tried it on our new DECstation 3100,
# ->it didn't work.  Does anyone know of another way to achieve this?  No
# ->matter what I try, I get "Don't know how to make target".  Thanx a lot.
# ->
# This meta-rule construct is not present in all makes, especially
# older makes.  You may consider meta rules as a non-standard make feature.
# Try to use VPATH (also non-standard), if present in the make on
# your DECstation (see man page).  Otherwise you could write explicit
# ...

GNU Make has VPATH, meta-rules, nice extensions to meta-rules, nice file
and pathname manipulation functions, and complete source code in case you
need something not already provided.  GNU Make, with a couple of local hacks
to provide selective VPATH expansion functions, is an essential item in our
project toolbox here.  I also find the documentation for GNU Make to be much
more readable and complete than other Make documentation.  If your project
moves to a different machine or site, having source code for Make relieves
you from reliance upon non-standard features which might be available on
one system but not on another.

McGrath and Stallman have a real winner in GNU Make.

Brad Yearwood
Optilink Corp.  {pyramid, tekbspa, pixar}!optilink!brad
Petaluma, California



More information about the Comp.unix.questions mailing list