Boost logo

Boost-Build :

From: Rene Rivera (grafik.list_at_[hidden])
Date: 2006-03-26 20:44:37


Henry Roeland wrote:
> I'm sort of a newbie to Jam and I'm trying to write a rule that generates
> a Jamfile into an XML file. This all in order to let this XML be
> transformed to e.g. MS Visual Studio Project file.
>
> I'm experiencing problems when trying this:
>
> e.g.actions PrintCFLAGSToFile
> {
> printf "$(2)" "$(CFLAGS)" >> $(<)
> }
>
> results in jam parsing args to printf like:
> printf "%s" "-Zi" "-DMSDOS" "-D_WINDOWS" "-D_TM_WIN" "-D_TMDEF_UINT"
> "-D_huge=" "-D_X86_" "-DWIN32" "-EHsc" "-GR" "-W3" "-Gy" "-Fd" "-LD" "-MD"
> "-wd" "4996" >> test.xml
>
> And this is not really working.
>
> Is there any action that writes JAM variables/flags literally to disk?
>
> Notes: It should work on WinXP. Above action is using printf from Cygwin.
>
> Why?
> Our current build system, which is based on Imake/make/nmake, has some
> scripts to generate MS Visual Studio 6 project files. I want to be sure
> that, if I propose Jam as the new build tool to use, it is also possible
> to have this functionality of generating MS Visual Studio project files
> from the build system.

That is a rational that's come up many times :-)

> Hopefully somebody can offer me some help.

Assuming Boost.Build.v2 you can:

=====Jamfile=====
import print ;

print.output <e>test.xml ;
print.text line1 line2 line3 : overwrite ;
=================

And invoke with: bjam test.xml

The funny "<e>" is to match the internal name of the target when given
"test.xml" on the command line. In reality you would need to do a bit
more work to make it integrate more with BBv2.

Anyway you can look at "tools/build/v2/util/print.jam" for how the above
works. You should see that it invokes the single text-action which uses
the @() response file bjam functionality.

--
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org - grafik/redshift-software.com
-- 102708583/icq - grafikrobot/aim - grafikrobot/yahoo

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk