Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!mcsun!hp4nl!targon!andre From: andre@targon.UUCP (andre) Newsgroups: comp.unix.questions Subject: Re: Make: Compiling source code from a different directory. Message-ID: <931@targon.UUCP> Date: 7 Dec 89 08:05:24 GMT References: <404@massey.ac.nz> Reply-To: andre@targon.UUCP (andre) Organization: Nixdorf Computer BV., DO, P.O. Box 29,Vianen, The Netherlands Lines: 38 In article <404@massey.ac.nz> K.Spagnolo@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. I have no direct solution, but you if you can live with make getting the sources into the destination directory you can always try (works on all makes I saw until now) OBJ=a.o b.o c.o SRC=$(OBJ:.o=.c) SRCDIR=../src $(SRC): $(SRCDIR)/$$@ cp $? . You need the $$@ to postpone expansion until runtime not readtime. PS. The $$@ seems to be added later, things like $$(@:.o=.c) or $$*.c wil not work. hope this helps, -- The mail| AAA DDDD It's not the kill, but the thrill of the chase. demon...| AA AAvv vvDD DD Ketchup is a vegetable. hits!.@&| AAAAAAAvv vvDD DD {nixbur|nixtor}!adalen.via --more--| AAA AAAvvvDDDDDD Andre van Dalen, uunet!hp4nl!targon!andre