[jamming] Executing shell command, save results to variable

Gary Gendel gary at icmanage.com
Wed Feb 28 06:17:18 PST 2007


Chris,

I accomplished a similar thing by rewriting the action for (in my case C++)
which performs the command at the native level in preparation for the command.

rule C++ {
    EXTRAFLAGS=`wx_config --includes`
    $(C++) $EXTRAFLAGS <blah> <blah> <blah>
}

You can get a bit more fancy and have the command(s) you wan put into a file
during setup and sourcing that file in the proper rule.

It's not as elegant as having Jam be able to do a shell `cmd` operation
directly, but I haven't had any luck when I asked for it.

That said, you can do a lot by wrapping the jam call in a script to do a lot of
this nonsense up front outside of Jam.

BTW, I actually don't use this rule-replacement approach in production, but it
worked in an experimental system.

Gary

Chris Stankevitz wrote:
> Hi group,
> 
> Is it possible to execute a shell command and save the results as a jam 
> variable?  The command I want to execute and its output is:
>    wx-config --libs
> 
> -pthread   -L/usr/X11R6/lib  -lwx_gtk2u_xrc-2.6 -lwx_gtk2u_qa-2.6 
> -lwx_gtk2u_htm l-2.6 -lwx_gtk2u_adv-2.6 -lwx_gtk2u_core-2.6 
> -lwx_baseu_xml-2.6 -lwx_baseu_net-2.6 -lwx_baseu-2.6
> 
> Thank you!
> 
> Chris
> _______________________________________________
> jamming mailing list  -  jamming at perforce.com
> http://maillist.perforce.com/mailman/listinfo/jamming

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gary.vcf
Type: text/x-vcard
Size: 295 bytes
Desc: not available
Url : http://maillist.perforce.com/pipermail/jamming/attachments/20070228/79348198/gary.vcf


More information about the jamming mailing list