I tried that.  To illustrate, let's change gcc toolset rule/actions for c++ to:

rule compile.c++ ( targets * : sources * : properties * )
{
    FOO on $(targets) = $(sources:S=.L) ;
...  
}
actions compile.c++ bind FOO
{
    echo $(FOO)
    "$(CONFIG_COMMAND)" $(LANG) -ftemplate-depth-100 $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
}

then test with boost-build/example/libraries/app> bjam gcc -a -d2
We get the following output:
...found 20 targets...
...updating 4 targets...
gcc.compile.c++ ../app/bin/gcc/debug/app.o

    echo ../app/bin/gcc/debug/app.L
    "g++"  -ftemplate-depth-100 -O0 -fno-inline -Wall -g  -I"../util/foo/include" -c -o "../app/bin/gcc/debug/app.o" "../app/app.cpp"

../app/bin/gcc/debug/app.L
...

Not the intended:
../app/app.L

Cheers,
Mark

Phillip Seaver <phil@apago.com> wrote:
Would $(sources:S=.L) work?