I'm trying to sort out how to compile a sub-project in two different ways (the conditional code is controlled by -DJAVA).  I'll make two different libaries (foo & foo_java).  The question is how to let the boost-build know that there are distinct sets of objects even though the sources are identical.

lib foo : s1.c s2.c ;

lib foo_java : s1.c s2.c : <define>JAVA ;

The above is what I'm inclined to utter, but I get complaints about  Duplicate name of actual target: <pbin/sun/debug/link-static>s1.o

Other projects would say:

exe bar : bar.c ..//foo

exe baz: baz.c ..//foo_java

Of course, I'd like to refactor the code so that it isn't littered with conditions, but I hope that isn't a prerequisite to migrating from make to bjam.