This is a PBS (Perl Build System) module.

When is ''Rules/C_depender.pm' used?

Whenever C or CPP files need to be depended. This module is automatically used when 'Rules/C.pm' is used.

What 'Rules/C_depender.pm' does.

It adds a rule to start the C depender whenevenra C or CPP node is added to the dependency graph.

it also add a rule to "build" C files. The build does nothing and is there merely to handle the case where PBS finds a dependency (a header file) must be rebuild thus forcing the rebuild of the C node too.

How does the C depender work?

The C depender first checks to see if a C dependency cache exists for the C file to depend. If the cache exists, it is read, verified and a dependency graph regenerated from the cache.

If the cache file doesn't exist, The 'PreprocessorDepend' is called to find which header files the C file depends on.

'PreprocessorDepend' must be defined in your config.

A graph is generated from the dependencies and it is serialized into a cache with the MD5 of all the nodes in the dependency graph.

The dependency graph is then merged with the global dependency graph. I finally returns the direct dependencies to the C file. As the nodes have already been merged, PBS will only link to those dependencies.

Since the header files are also considered source, we need to tell PBS that the C file must be "rebuild". This is done by returning "__PBS_FORCE_TRIGGER::" as one of the dependencies.

The C depender , which is a normal depender, merges the dependency nodes directely in the dependency graph. It also implements a distrubuted cache on the behalf of PBS. When a cache is regenerated, it cannot be used before successfull build is done. The C depender doesn't know about when a successfull build has occured and it must relly on PBS for the synchronisation.. The C depender doesn't know about what file depends on a C file. It could be an object file or any other file. The dependency could also be indirect.

TODO: __PBS_SYNCHRONIZE: explain how the synchronizing works explain how we use the unsynchronized cache to not redepend