Skip to content
  • Charlie Jacobsen's avatar
    test-v2: Refactor test modules/examples build for external build. · 3511bec6
    Charlie Jacobsen authored and Vikram Narayanan's avatar Vikram Narayanan committed
    I re-create the test_mods directory hierarchy in the build dir, and
    bring over the Kbuilds. I also auto-generate the 'src =' line in
    the Kbuilds for the external build hack.
    
    Throughout the top-level Makefile, I use an additional hack. Let me
    explain. We use recursive make to build dependencies (like versions
    of libcap), because only the recursive make knows how to check that
    the dependencies are up to date. But this means we have to make the
    dependency targets phonies, so they always run. This in turn means
    that those targets that depend on *them* will always run. To avoid
    this, I use 'check for presence only' dependencies for these types
    of dependencies that would trigger a full rebuild. The trick though
    is to specify the final build output file as the dependency, rather
    than the phony target, and to not create a rule for the final build
    output file. (This way, if the file does not exist, the top-level
    Makefile will just fail and say it doesn't know how to build the
    file. It won't know that one of the phony targets does that.)
    
    Anyway, test_mods is one example. It depends on liblcd.a being built,
    but in order to prevent triggering a recursive make on liblcd.a, we
    just use a 'check for presence only' type of dependency. It's up
    to the person building to ensure they rebuild top-level targets
    as necessary. (It doesn't seem easy to chain the whole build
    together, with proper dependency management, since we're using
    recursive make for dependency builds and kernel builds.)
    
    build_all.sh updated to trigger build of all targets in the correct
    order.
    3511bec6