Boost logo

Boost-Build :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2007-08-12 23:06:05


On 08/04/2007 09:30 AM, Vladimir Prus wrote:
> Larry Evans wrote:
>
>> On 08/03/2007 01:23 PM, Larry Evans wrote:
>> [snip]
>>> * question 2
>>>
>>> The following is from gcc.jam:
>>> <-------- cut here ---------
>>> actions link bind LIBRARIES
>>> {
>>> "$(CONFIG_COMMAND)" -L"$(LINKPATH)"
>>> -Wl,$(RPATH_OPTION:E=-R)$(SPACE)-Wl,"$(RPATH)"
>>> -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" $(START-GROUP)
>>> "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) $(END-GROUP)
>>> $(OPTIONS) $(USER_OPTIONS)
>>> #the above appears all on one line in my editor.
>>> }
>>>
>>> >-------- cut here ---------
>>>
>>> What variable values are available in the actions body? Was the
[snip]
> A rule can use the following variables:
>
> 1. Variables globally set in the module an action is in.
> 2. A variable set "on target"
>
> On Boost.Build, the "on target" variables to set are described via
> the 'flags' rule. So, this line from gcc.jam:
>
> flags $(toolset).link RPATH_LINK $(condition) : <xdll-path> : unchecked ;
>
> makes RPATH_LINK available in the 'link' action.
[snip]
A still confused. The attachments show my attempt at using variables in
the action of a cpreproc rule. What I really want is the variable
storing the include paths; however, I tried cut and pasting the
RPATH_LINK from gcc.jam to get it to work; however, as the output shows,
it's not working. What am I doing wrong?

TIA.

BTW, in the compile.out attachment, the lines starting with gcc.jam: are
from some debug prints I added to gcc.jam:

     case gnu :
         {
         # Strip the binary when no debugging is needed.
         # We use --strip-all flag as opposed to -s since icc
         # (intel's compiler) is generally option-compatible with
         # and inherits from gcc toolset, but does not support -s
         flags $(toolset).link OPTIONS $(condition)/<debug-symbols>off :
-Wl,--strip-all
           : unchecked ;
         ECHO "gcc.jam:init-link-flags:toolset,condition= $(toolset) ,
$(condition)" ;
         flags $(toolset).link RPATH $(condition) : <dll-path> : unchecked ;

import type ;
import generators ;
import toolset : flags ;
import feature ;

feature.extend toolset : cpreproc ;

type.register CPREPROC : cpreproc ;
generators.register-c-compiler cpreproc.cpreproc-run : CPP : CPREPROC ;
flags cpreproc.cpreproc-run INCLUDES <toolset>cpreproc : <include> : checked ;

rule init ( version ? : command * : options * )
{
    local feature-include = [ feature.get-values <include> ] ;
    ECHO "rule cpreproc.init: include= " $(feature-include) ;
    local linker = [ feature.get-values <linker-type> : $(options) ] ;
    ECHO "rule cpreproc.init: linker= " $(linker) ;
    if $(linker) {
      ECHO "rule cpreproc.init: non-null linker" ;
    }
    local root = [ feature.get-values <root> : $(options) ] ;
    ECHO "rule cpreproc.init: root= " $(root) ;
    flags cpreproc.cpreproc-run RPATH <toolset>cpreproc : <dll-path> : unchecked ;
}

#following modelled after the rule syntax definition after sentence:
# Most main target rules in Boost.Build have the same common signature:
#in:
# http://www.boost.org/doc/html/bbv2/advanced.html#bbv2.advanced.targets
rule cpreproc-run ( target : sources + : requirements * )
{
    ECHO "rule cpreproc-run: includes= " $(INCLUDES) ;
}

actions cpreproc-run
{
    echo "actions cpreproc-run: includes= $(INCLUDES) " ;
    echo "actions cpreproc-run: requirements= " $(REQUIREMENTS) ;
    echo "actions cpreproc-run: RPATH= " $(RPATH) ;
    ls -l $(>) ;
}

cd /home/evansl/prog_dev/boost-svn/ro/boost-trunk/sandbox/lje/bjam/
bjam --v2 toolset=cpreproc test_cpreproc
gcc.jam:init-link-flags:toolset,condition= gcc , <toolset>gcc-4.1
gcc.jam:init-link-flags:toolset,condition= gcc , <toolset>gcc-4.3_v
rule cpreproc.init: include=
rule cpreproc.init: linker=
rule cpreproc.init: root=
rule cpreproc-run: includes=
...found 8 targets...
...updating 1 target...
cpreproc.cpreproc-run bin/cpreproc/debug/test_cpreproc.cpreproc
actions cpreproc-run: includes= .
actions cpreproc-run: requirements=
actions cpreproc-run: RPATH=
-rw-r--r-- 1 evansl evansl 99 2005-05-29 13:19 test.cpp
...updated 1 target...

Compilation finished at Sun Aug 12 22:04:36

import type ;

type.register OUTPUT : output ;

project
  : requirements
      <include>.
  : default-build debug
      <include>.
  ;
obj test_obj
  : test.cpp
  ;
exe test_exe
  : test.cpp
  ;
cpreproc test_cpreproc
  : test.cpp
  ;


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