[openbeos] Re: building not so custom targets

  • From: "Andrew Bachmann" <shatty@xxxxxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Wed, 24 Dec 2003 11:00:31 -0800 PST

Jérôme Duval <korli@xxxxxxxx> wrote:
> Hello,
> 1/ i need to build two targets with the same files.
> Should i do something like this ? Am i sure it'll CC two times the file.c and 
> not reuse the first one ? Is it the way to do this ?

Like this: (untested)

Object <prog1>file.o : file.c ;
CCFLAGS on <prog1>file.o += -DPROG1 -Wall -Wno-multichar ;
C++FLAGS on <prog1>file.o += -DPROG1 -Wall -Wno-multichar ;

R5KernelAddon prog1 : bin ;
MainFromObjects prog1 : <prog1>file.o ;

Object <prog2>file.o : file.c ;
CCFLAGS on <prog2>file.o += -DPROG2 -Wall -Wno-multichar ;
C++FLAGS on <prog2>file.o += -DPROG2 -Wall -Wno-multichar ;

R5KernelAddon prog2 : bin ;
MainFromObjects prog2 : <prog1>file.o ;

You may want to use ObjectCcFlags instead of the "on" construct.  I think
that they are equivalent.  You might have to MakeLocate the two file.o
in different places, or you might not.  I'm not sure.

> 2/ How can i extend the #include search to subdirectories ?
> #include "file.h" // file.h is in a subdirectory

I do it this way in the nvidia accelerant Jamfile:

UseHeaders [ FDirName $(SUBDIR) path to subdir ] ;
UseHeaders [ FDirName $(SUBDIR) different subdir ] ;
> 3/ How can i extend source search to subdirectories or a subdirectory of the 
> parent directory ?
> R5KernelAddon prog1 : bin :
>        file.c ; # file.c is in a subdirectory

My recommendation on this is to build an intermediary .a for the subdirectory.
You can see the nvidia accelerant "engine" directory for an example of this.  It
may or may not apply to your situation.


Other related posts: