Boost logo

Boost-Build :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2006-06-22 13:44:37


Andrei Melnikov wrote:
> I tried to reduce code duplications in actions in msvc.jam (see the attachment).

Great. I haven't had chance to look at it yet, so won't comment except to say
that it sounds like a Good Thing (TM) :).

> I coudn't find much documentation on "on" rule and target-specific
> variables, so I'm not sure that my code really does what I think it
> does.
>
> If you think my idea is good, I'll change the rest of the actions this way.

If it makes the actions shorter, I'm all for it.

> Also, can someone explain me the magic behind the following:
>
> @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(CC_RSPLINE))"
>
> So I'll be able to perform better code reduction than I did in my
> patch. Is @() a special operator to create files?

This is the work I did for the reponse files. The logic is in the bjam
code. This is how it works. Given:

   @"@(FILE:E=EXPR)"

(1) The value of FILE is expanded. If this is STDOUT or STDERR, the
appropriate file handle is used. Otherwise, a file is created of the
specified name.

(2) The contents of EXPR is expanded and the contents is written
out to FILE.

(3) The name of FILE is written in place of @(...).

For example, given:

   local file = release/hello.obj
   local text = "Hola Tierra"

   action ...
   {
      cat @($(FILE:W).txt:E=$(text))
   }

the action will cause "Hola Tierra" to be printed on the console:

(1) the file release/hello.obj.txt is created
(2) "Hola Tierra" is written to release/hello.obj.txt
(3) the action is now:

   cat release/hello.obj.txt

(4) cat then prints the contents of that file (Hola Tierra).

NOTE: This special magic is evaluated at action time, so is
difficult to merge, but you could isolate the E=... part.

HTH,
- Reece
_________________________________________________________________
Try Live.com - your fast, personalized homepage with all the things you care about in one place.
http://www.live.com/getstarted


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