[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ft-devel] Jam bug regarding cyclic header files

From: Hubert Mackenberg
Subject: [ft-devel] Jam bug regarding cyclic header files
Date: Thu, 20 Dec 2007 11:28:50 +0100


it seems there is a bug in ftjam regarding cyclic header files:
If have have cyclic header files then a .c file depending
on any of these header file is not recompiled under certain
conditions. A simple example is given below.

Does anyone have an idea how to fix it?

Please note that this bug report was also posted to the
jamming mailing list at perforce since the bug seems to
be present in those jam versions as well.

Thanks a lot,



In this example a.c includes a.h, a.h includes b.h and
b.h includes c.h. But a.c is not recompiled if c.h is updated.

To get the example running you need 5 files a.c, b.c, a.h,
b.h and c.h. You may create them using:

   echo "this is a.c" > a.c
   echo "this is b.c" > b.c
   echo "this is a.h" > a.h
   echo "this is b.h" > b.h
   echo "this is c.h" > c.h

Then use the 'test.jam' file added below and run

   jam -f test.jam

once to create a first version of a.obj and b.obj.

If you now touch c.h then only b.obj is recompiled,
a.obj is missing. You can do this directly

   touch c.h
   jam -f test.jam

or by using Jam's -t option:

   jam -f test.jam -t c.h


# Jam has problems with cyclic includes.
# Here is an example.
# Both a.c and b.c include c.h either dircetly or indirectly.
# Thus touching c.h should recompile both a.c and b.c.
# Now
#    jam -f test.jam -t a.h
# works fine: both a.obj and b.obj are recompiled.
# But
#    jam -f test.jam -t c.h
# fails: only b.obj is recompiled.

# We have two .obj files depending on the corresponding .c files
NotFile all ;

Depends all : b.obj a.obj ;

Depends a.obj : a.c ;
Depends b.obj : b.c ;

# Use a very simple compile rule for bug demonstration
actions compile
    Echo Hello $(1) > $(1)

compile b.obj ;
compile a.obj ;

# Use standard include dependencies
Includes a.c : a.h ;
Includes b.c : b.h ;

# Use cyclic include file dependencies:
#    a.h -> b.h -> c.h -> a.h
Includes a.h : b.h ;
Includes b.h : c.h ;
Includes c.h : a.h ;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]