Make Depend

Conrad J. Sabatier conrads at cox.net
Sat Nov 27 11:32:49 PST 2004


On Sat, 27 Nov 2004 09:43:17 +0100, Gert Cuykens
<gert.cuykens at gmail.com> wrote:

> "A Makefile rule that typically scans all C/C++ source files in a
> directory, and generates rules that indicate that an object file
> depends on certain header files, and must be recompiled if they are
> recompiled."
> 
> i dont understand this. how can a object depend on something that is
> not compiled yet? Would the freebsd world not be a happier place if
> make did the dependancy thingies what ever they are automatically ?

Yes, it certainly would be a happier place.  :-)  And it would be great,
too, if I could interface with my computer purely by voice control and
synthesized speech feedback, and have it do what I *mean* and not what I
say.  :-)

But alas, computers are not *that* smart yet.  They still need a little
help from us humans (actually, a *lot* of help).  :-)

Re: dependencies, it should be simple to understand if you give it a
moment's thought.  Let's say you have a file "main.c" that calls
functions in "foo.c".  In order for main.c to compile and link properly
to create a complete, executable program, it's absolutely essential that
foo.c be compiled and linked in as well.

What Makefile dependencies are about is ensuring that, if a change is
made to foo.c, it will be recompiled and relinked with main.c to
guarantee that the final executable is up to date in all respects.

Does that help?  :-)

-- 
Conrad J. Sabatier <conrads at cox.net> -- "In Unix veritas"


More information about the freebsd-questions mailing list