Declaring source dependencies in makefiles

To implement build avoidance based on time stamps, standard make variants require you to declare all the source file dependencies of each build target.

For example, object module hello.o depends on source files hello.c and hello.h in the same directory:

hello.o: hello.c hello.h
      rm -f hello.o
      cc -ccl /c hello.c

Typically, these source files depend on project-specific header files through #include directives, perhaps nested within one another. The standard UNIX or Linux files do not change very often, but changed header files can produce compilation failure.

To alleviate this problem, some organizations include every header file dependency in their makefiles. They rely on utility programs (for example, makedepend) to read the source files and determine the dependencies.

clearmake does not require that source-file dependencies be declared in makefiles (but see Source dependencies declared explicitly). The first time a derived object is built, its build script is always executed; thus, the dependency declarations are irrelevant for determining whether the target is out of date. After a derived object has been built, its configuration record provides a complete list of source-file dependencies used in the previous build, including those on all header files (nested and non-nested) read during the build.

Note: clearmake rebuilds a target if there have been changes to any directories listed as source-file dependencies.

You can leave source-file dependency declarations in your existing makefiles, but you need not update them as you revise the makefiles. You need not place source-file dependencies in new makefiles to be used with clearmake.

Note: Although source-file dependency declarations are not required, you might want to include them in your makefiles, anyway. The principal reason for doing so is portability: you might need to provide your sources to another team (or another company) that is not using HCL VersionVault.