Help with Makefile

Vasile R. Montan vrm at cerc.wvu.wvnet.edu
Thu Sep 7 03:41:38 AEST 1989


From: Micky Liu <micky at cunixc.cc.columbia.edu>
> 
> 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



More information about the Comp.unix.questions mailing list