[jamming] BJam's command/shell execution

Joshua ChaitinPollak jpollak at kivasystems.com
Fri Mar 23 07:54:17 PST 2007


Sanel,

Thanks for the tip, I'll try this. I guess I could also change rule  
to be like SubIncludeOnce, which was recently posted, and only  
operate if it hasn't done so yet.

-Josh

On Mar 23, 2007, at 10:01 AM, Sanel Zukan wrote:

> Hi Josh,
>
> BJam is heavily modified jam (it is not the same good old jam as we
> know it), and I would advise you to check Boost mailing list since
> probably no one from here knows how it behaves today.
>
> Anyway, here is how I would do it in jam code, and hoping this will  
> pass
> on BJam too:
>
>   - good would be to create revisions.tcpp file from whom you will
>   generate revisions.cpp (and so jam can track changes)
>
>   - add this rule:
>
> rule Prepare
> {
> 	Depends $(<) : $(>) ;
> 	Always $(<) ;
> 	Depends all : $(<) ;
> 	Prepare1 $(<) : $(>) ;
> 	Clean clean : $(<) ;
> }
>
> actions Prepare1
> {
> 	rev=`svnversion`
> 	cat $(>) > $(<)
> 	echo "void config::getRevision(std::string& rev) { rev = \"$rev 
> \"; } >> $(<)
> }
>
> And call it with:
>
> Prepare revision.cpp : revision.tcpp ;
> Main your-executable : revision.cpp (... and the rest ...) ;
>
> With this you don't need to compare revisions since .tcpp -> .cpp will
> be always generated (better than to mess with shell if code).
>
>> I guess I could call a shell script
>> to build the revision.cpp file all the time, but I'd rather not
>> unless its out of date.
>
> Why would you do this? Always generating revision.cpp will not make an
> overhead to whole project, unless bunch of code depends on it. If
> you want to be build only once, just remove "Always $(<) ;" part, in
> which case you will have to do "jam clean" each time you commit some
> changes (sounds much reasonable because adding changes to repository
> oftern requires rebuilding target project/sub-project from start).
>
> --
> Sanel
> _______________________________________________
> jamming mailing list  -  jamming at perforce.com
> http://maillist.perforce.com/mailman/listinfo/jamming
>

-- 
Joshua ChaitinPollak
Software Engineer
Kiva Systems



More information about the jamming mailing list