Make: Compiling source code from a different directory.

Erik Baalbergen erikb at cs.vu.nl
Wed Nov 29 18:50:24 AEST 1989


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,
->I set up the makefile on our Sun 386i to access the source kept on
->our Pyramid.  This wasn't too difficult.  I have an obj directory that
->contains the makefile, and on the same level, a src directory that is
->a symbolic link to the other machine.  So the makefile defines SRCDIR
->as ../src and uses the following rule to find everything:
->
->%.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.
->
->-- 
->Ken Spagnolo - Systems Programmer, Postmaster, Usenet Administrator, etc.
->   Computer Centre, Massey University, Palmerston North, New Zealand
->K.Spagnolo at massey.ac.nz  Phone: +64-63-69099 x8587  New Zealand = GMT+12

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
dependencies; a dull job, but resulting in a standard, "portable" makefile :-)

Erik Baalbargen
-- 
Erik H. Baalbergen				    <erikb at cs.vu.nl>
Vrije Universiteit / Dept. of Maths. & Comp. Sc.
De Boelelaan 1081
1081 HV Amsterdam / The Netherlands		tel. +31 20 548 8080



More information about the Comp.unix.questions mailing list