Fix dependency graph computation in ndk-build

This introduces a new definitions-graph.mk file providing
proper topological sorting (with wild unit tests for it),
and make the rest of ndk-build use it.

This solves the incorrect dependency computation demonstrated
by the 'topological-sort' test, which is no longer in BROKEN_BUILD
state after this change. For more information, see
http://b.android.com/39378

Note that this also simplifies the build process a little, i.e.:

  - if a shared library or executable depends on several
    static libraries, try to build them in parallel, even
    if one depends on the other.

  - better computation of the list of whole static libraries.
    in general, whole libraries are treated like regular ones
    now when it comes to computing dependencies. Only at
    link time, the libraries that are tagged as 'whole will
    be put in a separate function.

    There is no unit test for this, I probably need to add
    one.

Change-Id: I36d9179e53b0b7bcb7de50e2a1a769c231c28201
7 files changed