List Info

Thread: Use executable target in an actions




Use executable target in an actions
user name
2006-09-19 23:04:52
Hi,

I'd like to invoke a bjam built executable in an actions. 
For  
example, I have an exe target, xmlc,

exe xmlc : source ;

that I'd like to use in an actions but I don't know how to
reference  
xmlc in the actions.  Also, is there some way to make an
actions  
depend on a target so that the executable will be built
before the  
actions that invokes the executable is run?

Thanks.

-- Noel Belcourt


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Use executable target in an actions
user name
2006-09-20 06:06:13
K. Noel Belcourt wrote:
> Hi,
> 
> I'd like to invoke a bjam built executable in an
actions.  For  
> example, I have an exe target, xmlc,
> 
> exe xmlc : source ;
> 
> that I'd like to use in an actions but I don't know
how to reference  
> xmlc in the actions.  Also, is there some way to make
an actions  
> depend on a target so that the executable will be built
before the  
> actions that invokes the executable is run?
read 
http://www.crystalcl
earsoftware.com/cgi-bin/boost_wiki/wiki.pl?Boost.Build_V2/Us
ingBuiltTool

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Use executable target in an actions
user name
2006-09-20 12:48:13
K. Noel Belcourt wrote:
> Hi,
>
> I'd like to invoke a bjam built executable in an
actions.  For  
> example, I have an exe target, xmlc,
>
> exe xmlc : source ;
>
> that I'd like to use in an actions but I don't know
how to reference  
> xmlc in the actions.  Also, is there some way to make
an actions  
> depend on a target so that the executable will be built
before the  
> actions that invokes the executable is run?
>
> Thanks.
>
> -- Noel Belcourt

Here's something that I use.  It may not be the best way to
do things,
but it works for me.  

    exe bin2c : bin2c.c ;
    make Splash.h : bin2c Splash.png : bin2c_run ;
    actions bin2c_run
    {
        $(>[1]) $(>[2-]) $(<)
    }


The "make" command here creates Splash.h using
bin2c and Splash.png as
source files with bin2c_run as the commands to run.  Since
it's using
the target "bin2c" as a source file, it has to
build it first, so it
compiles bin2c before trying to run it.  

"actions bin2c_run" gets the full path of the
bin2c executable as the
first item in the source argument "$(>[1])"
and uses the rest of the
source arguments "$(>[2-])" and the output
argument "$(<)" as the
arguments to bin2c, so on Windows you get a command like:

   
bin\msvc-7.1\debug\link-static\threading-multi\bin2c.ex
e Splash.png
    msvc-7.1\debug\link-static\threading-multi\Splash.h


HTH,

Phillip

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Use executable target in an actions
user name
2006-09-20 12:48:13
K. Noel Belcourt wrote:
> Hi,
>
> I'd like to invoke a bjam built executable in an
actions.  For  
> example, I have an exe target, xmlc,
>
> exe xmlc : source ;
>
> that I'd like to use in an actions but I don't know
how to reference  
> xmlc in the actions.  Also, is there some way to make
an actions  
> depend on a target so that the executable will be built
before the  
> actions that invokes the executable is run?
>
> Thanks.
>
> -- Noel Belcourt

Here's something that I use.  It may not be the best way to
do things,
but it works for me.  

    exe bin2c : bin2c.c ;
    make Splash.h : bin2c Splash.png : bin2c_run ;
    actions bin2c_run
    {
        $(>[1]) $(>[2-]) $(<)
    }


The "make" command here creates Splash.h using
bin2c and Splash.png as
source files with bin2c_run as the commands to run.  Since
it's using
the target "bin2c" as a source file, it has to
build it first, so it
compiles bin2c before trying to run it.  

"actions bin2c_run" gets the full path of the
bin2c executable as the
first item in the source argument "$(>[1])"
and uses the rest of the
source arguments "$(>[2-])" and the output
argument "$(<)" as the
arguments to bin2c, so on Windows you get a command like:

   
bin\msvc-7.1\debug\link-static\threading-multi\bin2c.ex
e Splash.png
    msvc-7.1\debug\link-static\threading-multi\Splash.h


HTH,

Phillip

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Use executable target in an actions
user name
2006-09-20 21:53:18
On Sep 20, 2006, at 6:48 AM, Phillip Seaver wrote:

> K. Noel Belcourt wrote:
>> I'd like to invoke a bjam built executable in an
actions.
> Here's something that I use.  It may not be the best
way to do things,
> but it works for me.  
>
>     exe bin2c : bin2c.c ;
>     make Splash.h : bin2c Splash.png : bin2c_run ;
>     actions bin2c_run
>     {
>         $(>[1]) $(>[2-]) $(<)
>     }
>
>
> The "make" command here creates Splash.h
using bin2c and Splash.png as
> source files with bin2c_run as the commands to run. 
Since it's using
> the target "bin2c" as a source file, it has
to build it first, so it
> compiles bin2c before trying to run it.  
>
> "actions bin2c_run" gets the full path of
the bin2c executable as the
> first item in the source argument
"$(>[1])" and uses the rest of the
> source arguments "$(>[2-])" and the
output argument "$(<)" as the
> arguments to bin2c, so on Windows you get a command
like:
>
>    
bin\msvc-7.1\debug\link-static\threading-multi\bin2c.ex
e  
> Splash.png
>    
msvc-7.1\debug\link-static\threading-multi\Splash.h

It does help.  The only thing I can't figure out is how to
call an  
actions from a rule.  If I define a rule like your 'make'
rule above,  
how do I call the action from within the rule?

This is probably easy to do but I don't see how.

-- Noel


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Use executable target in an actions
user name
2006-09-21 12:22:42
K. Noel Belcourt wrote:
> On Sep 20, 2006, at 6:48 AM, Phillip Seaver wrote:
>
>   
>> K. Noel Belcourt wrote:
>>     
>>> I'd like to invoke a bjam built executable in
an actions.
>>>       
>> Here's something that I use.  It may not be the
best way to do things,
>> but it works for me.  
>>
>>     exe bin2c : bin2c.c ;
>>     make Splash.h : bin2c Splash.png : bin2c_run ;
>>     actions bin2c_run
>>     {
>>         $(>[1]) $(>[2-]) $(<)
>>     }
>>
>>
>> The "make" command here creates
Splash.h using bin2c and Splash.png as
>> source files with bin2c_run as the commands to run.
 Since it's using
>> the target "bin2c" as a source file, it
has to build it first, so it
>> compiles bin2c before trying to run it.  
>>
>> "actions bin2c_run" gets the full path
of the bin2c executable as the
>> first item in the source argument
"$(>[1])" and uses the rest of the
>> source arguments "$(>[2-])" and the
output argument "$(<)" as the
>> arguments to bin2c, so on Windows you get a command
like:
>>
>>    
bin\msvc-7.1\debug\link-static\threading-multi\bin2c.ex
e  
>> Splash.png
>>    
msvc-7.1\debug\link-static\threading-multi\Splash.h
>>     
>
> It does help.  The only thing I can't figure out is
how to call an  
> actions from a rule.  If I define a rule like your
'make' rule above,  
> how do I call the action from within the rule?
>
> This is probably easy to do but I don't see how.
>
> -- Noel
The "make" rule above has
"bin2c_run", which tells bb to use those
commands for creating Splash.h.  All you have to do is
reference the
target of the make rule.  In my case, I use
<implicit-dependency>Splash.h on the exe rule that
includes it.  If
you're generating a source file, you would just add it to
the sources of
the target that uses it.

    exe gen_c : gen_c.c ;
    make foo.c : gen_c gen_c_source.x : gen_c_run ;
    actions gen_c_run
    {
        $(>[1]) $(>[2-]) $(<)
    }
    exe use_c : use_c.c foo.c ;


Phillip

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Use executable target in an actions
user name
2006-09-21 17:14:38
On Sep 21, 2006, at 6:22 AM, Phillip Seaver wrote:

> The "make" rule above has
"bin2c_run", which tells bb to use those
> commands for creating Splash.h.  All you have to do is
reference the
> target of the make rule.  In my case, I use
> <implicit-dependency>Splash.h on the exe rule
that includes it.  If
> you're generating a source file, you would just add it
to the  
> sources of
> the target that uses it.
>
>     exe gen_c : gen_c.c ;
>     make foo.c : gen_c gen_c_source.x : gen_c_run ;
>     actions gen_c_run
>     {
>         $(>[1]) $(>[2-]) $(<)
>     }
>     exe use_c : use_c.c foo.c ;

Hi Phillip,

Okay, I had a mental block.  I didn't realize the make you
refer to  
is the make.jam in the v2/tools directory, I thought it was
a rule  
you wrote.  Now that I've looked at make.jam, I understand
completely  
what you're saying.  Thanks for taking the time to explain
it to me,  
that helps a lot.

-- Noel


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
[1-7]

about | contact  Other archives ( Real Estate discussion Medical topics )