Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ames!haven!h.cs.wvu.wvnet.edu!cerc.wvu.wvnet.edu!vrm From: vrm@cerc.wvu.wvnet.edu (Vasile R. Montan) Newsgroups: comp.unix.questions Subject: Re: Help with Makefile Summary: Using Pattern Matching Rules Message-ID: <217@cerc.wvu.wvnet.edu.edu> Date: 6 Sep 89 17:41:38 GMT References: <20767@adm.BRL.MIL> Sender: news@cerc.wvu.wvnet.edu Lines: 39 From: Micky Liu > > I am trying to build a Makefile for sources that have to be built > for different architectures. So let's say I have my sources at > the root and I want to place the objects in their subdirectories > under the root like: > /src > /src/vax > /src/sun3 > /src/sun4 > > But I only want to keep one Makefile in the my /src directory. > I have already made a method to determine the architecture and > then it invokes itself with the proper flags. The problem is > that I cannot seem to get the implicit rules to work anymore. > On the SUN machines, you can use a pattern matching rule: $(DEST)/%.o: %.c $(COMPILE.c) -o $@ $< where DEST is somehow set to the appropriate directory (ex. sun4) and COMPILE.c is as defined in /usr/include/make/default.mk. The rule to create your program would be: $(PROGRAM): $(OBJS:%=$(DEST)/%) $(LIBS) However, this does not work on any of the versions of make on the other platforms we are working on. PS: Micky, I would be interested in any email feedback that you may have gotten from your query. Also your method for determining what architecture you are compiling on would be interesting. I tried to send you email, but it bounced back. -- Vasile