Here is a build.xml reproducing an issue with the dependencies analysis, simply run ant at least two times to get the issue.
The problem happens when an included file has the same name as a directory, but the directory is found before among the includes.
The consequence is that it messes up the dependency computation and either does not rebuild when needed or always keeps rebuilding even when not needed.
As a side not is happens all the time with boost which has directories named like system include files (algorithm, math, etc..).
The fix is so simple that I truly really hope it gets commited soon.....