[jamming] Compiling the same file with different flags for different targets

Diane Holt holt.diane at gmail.com
Thu Dec 4 20:56:52 PST 2008


You'd really recommend putting all that in each Jamfile rather than writing
a couple of rules and having:

SubDir TOP blah blah blah ;

SharedLib libtest : lib.c ;
Main libtest : lib.c ;

Personally, I prefer not to have the Jamfiles as simple as possible, so
they're easier for developers to work with.

As for debug v. release, I handle that sort of thing (along with many
others) in config files, and build specific to the selected configuration
(ie., the Jamfiles don't deal with any of that -- they're the same for
whatever configuration I'm building).

Diane

On Thu, Dec 4, 2008 at 4:25 PM, Craig Allsop <cjamallsop at gmail.com> wrote:

> OR
>
> SOURCE_GRIST is used to distinguish between different versions of the
> same source but different flags/options. LOCATE_TARGET is used to
> place the different versions with the same names into different output
> directories and avoid conflict.
>
> Just set them in a scope for each Main so that jam knows that there
> are two versions of lib.o with different flags. Jam has a rule
> ObjectCcFlags for setting flags. You can put it one jamfile if you
> desire...
>
> SubDir TOP blah blah blah ;
>
> {
>  local SOURCE_GRIST = $(SOURCE_GRIST) static ;
>  local LOCATE_TARGET = $(LOCATE_TARGET) static ;
>   Main test1 : test1.c lib.c ;
> }
>
> {
>  local SOURCE_GRIST = $(SOURCE_GRIST) shared ;
>  local LOCATE_TARGET = $(LOCATE_TARGET) shared ;
>   Main libtest.so : lib.c ;
>   ObjectCcFlags lib.c : -fPIC ;
>   LINKFLAGS on libtest.so = -shared ;
> }
>
> Next you'll want debug and release configurations too, it's all more
> of the same really. Stick it all in a loop and call it for every
> different combination so you can build all the flavours at the same
> time.
>
> Craig.
>
>
> On Tue, Dec 2, 2008 at 12:14 PM, warkda rrior
> <announcements.for.warkdarrior at gmail.com> wrote:
> > Hi,
> _______________________________________________
> jamming mailing list  -  jamming at perforce.com
> http://maillist.perforce.com/mailman/listinfo/jamming
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.perforce.com/pipermail/jamming/attachments/20081204/16ba5a08/attachment-0001.html>


More information about the jamming mailing list