[Cmake] Automatic dependency building under Unix

Amitha Perera perera at cs.rpi.edu
Wed May 9 15:17:07 EDT 2001


> Also, I am not convinced that this would not cause some strange problems.
> I don't think makefiles should jump up the tree, but only down.
> If you don't do a make from the top, it is your problem.   
> Some strange things could happen, possible infinite make loops, as make jumps
> up a directory, then back into the same directory, then back up.  If the
> target failed to build, it would never stop.  

I think inifinite loops are unlikely. Even if possible, they will
occur only on "make -k". (Assuming, of course, that there are no
circular dependencies. Circular dependencies==all bets are off.)
Consider the following makefile:

c: a b
        cat a b > c
a:
        touch a
b:
        echo "Can't build b, but am not failing"

Running it does the expected:

     pre tmp $ make 
     touch a
     echo "Can't build b, but am not failing"
     Can't build b, but am not failing
     cat a b > c
     cat: b: No such file or directory
     make: *** [c] Error 1
     pre tmp $ ls a b c
     ls: b: No such file or directory
     a       c
     pre tmp $ 

Another possible solution:
path/lib:
        (cd path; $(MAKE)) || touch path/lib


Anyway, my point is that it would be such a waste not to use all the
dependency information that is available in the CMake system. Under
VC++, you can select your project as the active project, and a build
will only build that part of the system on which your project
depends. The nice thing about this is that the whole system does not
have to be working---only those things that you depend on needs to
work.

In the TJr world, we have got used to "make -k" for everything,
because many things often don't work. That is not good. Everything
_should_ work. If I'm working on something that depends only on other
things that do work, then I should never, ever need to "make -k".

If I am working on all of vxl, perhaps for multi-platform testing,
etc, fine: I'll type make at the top. On the other hand, if I'm
working on a small subset of the system, allowing me to easily compile
only those parts is great. This is especially good for those that are
simply vxl "users" (as are most in the RPI group).

Amitha.





More information about the CMake mailing list