Subject: Re: Makefile rules
To: Jachym Holecek <freza@psi.cz>
From: Stuart Brooks <stuartb@cat.co.za>
List: tech-userlevel
Date: 09/09/2004 15:25:15
Thanks for the replies,

Using the .PATH option looks promising but the documentation I have found
about make is very thin. Is there anything I could read to get a bit more
information. I've been through 'Make - a Tutorial" but it only seems to
scratch the surface. What I'm interested in is the exact role which .OBJDIR
and .PATH play.

I had hoped that I could specify the .OBJDIR and then adjust the implicit
rules as follows but it doesn't seem to work ...

DIR=some_directory
.OBJDIR: $(DIR)

.cpp.o:
  $(COMPILER) -c -o$(DIR)/$@ $<

Regards
 Stuart


> Hello,
>
> > I was wondering what version of make Netbsd uses. In particular the one
I
> > have on my Netbsd 1.5.1 system only appears to support .SUFFIX rules, as
> > opposed to gmake which allows pattern matching in its implicit rules.
> >
> > FWIW I am trying to get make to build to a different directory depending
on
> > the defines, something like:
> >
> > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> > DIR = some_directory
> > OBJECTS = $(DIR)/main.o $(DIR)/t1.o ... $(DIR)/t50.o
> >
> > $(DIR)/%.o : %.cpp
> >   $(COMPILER) -c ...
> >
> > TARGET: $(OBJECTS)
> >   $(LINKER) ...
> > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>
> Maybe something like this?
>
> DIR = some_directory
> OBJECTS = main.o t1.o ... t50.o
>
> # For BSD make
> .PATH: ${DIR}
>
> # For GNU make
> VPATH=". ${DIR}"
>
> %.o : %.cpp
> $(COMPILER) -c ...
>
> TARGET: $(OBJECTS)
> $(LINKER) ...
>
> And if you don't mind being BSD specific, you could safe yourself some
work
> (such as standard compile + links rules) using bsd.*.mk framework.
>
> Regards,
> -- Jachym Holecek
>