code: public boolean needsRebuild(final CCTask task, final TargetInfo target, final int dependencyDepth) {
      // look at any files where the compositeLastModified
      // is not known, but the includes are known
      //
      boolean mustRebuild = false;
      final CompilerConfiguration compiler = (CompilerConfiguration) target.getConfiguration();
      final String includePathIdentifier = compiler.getIncludePathIdentifier();
      final File[] sources = target.getSources();
      final DependencyInfo[] dependInfos = new DependencyInfo[sources.length];
      final long outputLastModified = target.getOutput().lastModified();
      //
      // try to solve problem using existing dependency info
      // (not parsing any new files)
      //
      DependencyInfo[] stack = new DependencyInfo[50];
      boolean rebuildOnStackExhaustion = true;
      if (dependencyDepth >= 0) {
        if (dependencyDepth < 50) {
          stack = new DependencyInfo[dependencyDepth];
        }
        rebuildOnStackExhaustion = false;
      }
      final TimestampChecker checker = new TimestampChecker(outputLastModified, rebuildOnStackExhaustion);
      for (int i = 0; i < sources.length && !mustRebuild; i++) {
        final File source = sources[i];
        final String relative = CUtil.getRelativePath(this.baseDirPath, source);
        DependencyInfo dependInfo = getDependencyInfo(relative, includePathIdentifier);
        if (dependInfo == null) {
          task.log("Parsing " + relative, Project.MSG_VERBOSE);
          dependInfo = parseIncludes(task, compiler, source);
        }
        walkDependencies(task, dependInfo, compiler, stack, checker);
        mustRebuild = checker.getMustRebuild();
      }
      return mustRebuild;
    }
docs: Determines if the specified target needs to be rebuilt.
  
  This task may result in substantial IO as files are parsed to determine
  their dependencies