Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!zaphod.mps.ohio-state.edu!rpi!crdgw1!nieters From: nieters@copernicus.crd.ge.com (coolbean) Newsgroups: comp.unix.questions Subject: Re: **** make file in another dir -- help !! **** Message-ID: Date: 31 Aug 90 17:22:01 GMT References: <730@babcock.cerc.wvu.wvnet.edu> Sender: news@crdgw1.crd.ge.com Reply-To: nieters@copernicus.crd.ge.com Distribution: usa Organization: GE Corporate R&D, Schenectady, NY Lines: 48 In-reply-to: siping@cathedral.cerc.wvu.wvnet.edu's message of 31 Aug 90 14:15:29 GMT Hi We do what you are talking about. There is a project/src directory and we make files in a project/debug directory that depend on files in ../src. Here's an example of the 'important' parts of the Makefile to achieve this: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= To make a target in debug called "foo" which depends on foo.c in debug and bar.c in ../src # some definitions # standard message about linking LINK_MSG = @echo Linking $@ # normal link command. LIBS is conditionally defined for each a.out file. LINK_CMD = $(LINK.c) -o $@ $(LIBS) # a sample target FOO_SRCS = foo.c bar.c FOO_OBJS = $(FOO_SRCS:.c=.o) foo := LIBS = $(FOO_OBJS) foo : $(FOO_OBJS) $(LINK_MSG) $(LINK_CMD) # # how to make things in ../src %.c : ../src/%.c -@ln -s $< 2>/dev/null # vanilla object files (assume Unix) %.o : %.c $(COMPILE.c) -o $@ $< -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= We run this using Sun's make but I don't think there is anything particularly exotic to this example that won't work on "normal" make. --ed -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Ed Nieters INTERnet: nieters@crd.ge.com GE Corporate R&D UUCPnet: uunet!crd.ge.com!nieters Schenectady, NY 12301 BELLnet: (518) 387-5187