Wallace, Richard writes:
I'm trying to get a small library to build using Jam. The problem I'm
running into is the library is spread across a couple of different
directories.
...
I'm stumped as to what to try next. Suggestions?
As it happens, I almost solved the same problem last week. Not really
fond of my solution, but anyway. I made two rules, one analogous to
Objects and one to Program (Library in your case).
rule Build
{
Objects $(>) ;
set-$(<) += [ FGristFiles $(>:S=$(SUFOBJ)) ] ;
}
rule Program
{
local target ;
Depends exe : $(<) ;
Depends $(<) : $(set-$(>)) ;
MakeLocate $(<) : $(LOCATE_TARGET) ;
Clean clean : $(<) ;
Link $(<) : $(set-$(>)) ;
}
The first rule adds a number of .o files to a named set, the second
builds a program from all the .o files in a list of named sets. The
trick is: Build can be in src/a/Jamfile and Program in src/b/Jamfile
and it still works, provided you SubInclude them in that order.
But I'm not entirely happy. Maybe Diane or someone can improve on that.
--Arnt