Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-09-24 03:15:52


Andre Hentz wrote:
> Vladimir Prus wrote:
> > Andre Hentz wrote:
> >>Andre Hentz wrote:
> >>> The other proble is that the C files were being compiled and linked
> >>>before the "touch", which was wierd. I'll try again and let you know.
> >>
> >> Never mind this one. My bad.
> >
> > Ok. Now another question. Do you want to be able to do this:
> >
> > lib a : a1.m a2.m a3.m ;
> > stage bin : a ;
> >
> > and have all ctf files installed? In other words: whenever ".m" file is
> > in sources of a lib or exe, the corresponding ctf should be among the
> > results and always staged. Right?
>
> I don't think so. I'm still learning this new version of the matlab
> compile but as far as I understand, it takes only the main .m file,
> build the dependency graph and puts everything into the same .ctf file.
>
> So the answer to your question, from my particular point of view is: I
> don't even want more than one source file to be specified.

Ok, so let me suggest one solution. First, an explanation. When you write:

lib a : ........

this may produce everything -- the LIB itself, response files, various
intermediate files nobody cares about. Most of the time, if you stage 'a' you
want only LIB target to be staged. For that reason V2 marks all targets which
are not of LIB type as intermediate and 'stage' ignores intermediate targets.

There are many ways around that.
1. Tweak .m -> .c .ctf generator so that it marks .cft as not intermediate
2. Write a new main target 'matlab-lib' which does the same
3. Specify that CTF files are to be staged in the 'stage' invocation (not
possible in CVS state, but I have various solution around).

>From user's point of view, the first approach is the simplest, because it
requires the least work. I attach an implementation. Basically, it just
defines a new generator and overrides the 'generated-targets' method, which
is responsible for actually creating the result.

Let me know if that works for you.

Jamfile is
exe a : a.m ;
stage x : a ;

and project-root.jam is

import m ;

- Volodya
 --Boundary-00=_4e9UBUmjysGn2Up Content-Type: text/x-java;
charset="iso-8859-1";
name="m.jam"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="m.jam"

import type ;
type.register M : m ;
type.register CTF : ctf : : main ;

import "class" : new ;

import generators ;

class mex-generator : generator
{
rule generated-targets ( sources + : property-set : project name ? )
{
local r = [ generator.generated-targets $(sources) : $(property-set)
: $(project) $(name) ] ;
# Clear the 'intermediate' flag on third target (of type CTF)
# so that whenever ".m" file is present in sources of any target
# the CTF target will be considered real result of the target,
# and will be staged as well as other files (like exe)
$(r[3]).set-intermediate ;
return $(r) ;
}
}
generators.register [
new mex-generator m.mex : M : C(%_main) C(%_component_data) CTF ] ;

actions mex
{
touch $(<) ;
} --Boundary-00=_4e9UBUmjysGn2Up--


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