[jamming] Undesired multi pass build

Roger.Shimada at lawson.com Roger.Shimada at lawson.com
Wed Feb 4 14:58:51 PST 2004


I thought that I should ask the mailing list about this before getting 
lost in the jam source.  :-)

We generate .h files based on .c files.  For example, we might have 
common.c:

        int     Answer = 42;

from which we generate a common.h in an include directory:

        extern int      Answer;

Note that common.c is used to both compile and to generate the header 
file.

Now let's say there is a source.c that does #include <common.h>.

There is a library that is built from common.c and source.c.

When I update common.c and run jam, common.h gets regenerated and common.c 
is recompiled. But source.c does not get recompiled.  I run jam again, and 
source.c gets recompiled.

Any ideas on how to fix the following Jamfile so an update of common.c 
will rebuild both common.h and compile both .c files?  If not, any hints 
on fixing this in jam?

GENINC = $(GENDIR)/include ;
HDRS += $(GENINC) ;

rule
LaHeaderGlobal
{
    local   var ;

    for var in $(<)
    {
        LawMkHdr $(GENINC)/$(var:B).h : $(var:B).c : -g ;
    }
}

rule
LawMkHdr
{
    local   source ;

    source = [ FGristFiles $(>) ] ;
    Depends files : $(<) ;
    Depends $(<) : $(source) ;
    Clean clean : $(<) ;
    SEARCH on $(source) = $(SEARCH_SOURCE) ;
    MakeLocate $(<) : $(LOCATE_TARGET) ;
    MKHDRFLAG on $(<) = $(3) ;
    LawMkHdr1 $(<) : $(source) ;
}

actions
LawMkHdr1
{
    mkhdr $(MKHDRFLAG) $(>)
}

Library mylib : common.c source.c ;

LaHeaderGlobal  common.c ;

--
Roger Shimada - Software Architect
Lawson Software                     Phone: +1-651-767-4610
380 St. Peter Street               e-mail: roger.shimada at lawson.com
St. Paul, MN  55102  USA           AOL IM: rshimada



More information about the jamming mailing list