common.mk: overhaul (started in dm-verity.git but moved here)

Overhauled common.mk to befit its shiny new repository:

  At present, common.mk requires that all build artifacts be
  prepended with $(OUT).  This is hideous and leads to common
  build/source leakage.

  This change moves make to run out of the build tree and set
  per target source resolution back to the source tree, instead of
  attempting to catch all object creation and send it to the build dir.

  It adds special archive target-based wrappers:
    CXX_BINARY, CXX_LIBRARY, . . .

  It adds a testing target wrapper and kills the dep-based test runner:
    TEST(target) or TEST(CXX_BINARY(target))

  It adds CLEAN(target) to replace RM helper variables.

  Moves to using .PHONY instead of FORCE across the board.

  Test running assumes CONFIG_COMPAT for x86_64 versus x86.

  (This includes NOSTRIP change from the cros-disks repo.)

  Removes all implicit rules not implemented in common.mk.

  Adds hooks to catch magic targets (CXX_*) from being used on accident
  without being properly defined (check_deps).

  Add hooks to catch CXX_LIBARY versus CXX_LIBRARY.

  Adds per-test-target NEEDS_ROOT and NEED_MOUNT helper variables.
   (Still not polished)

Adds an example hierarchy which also acts as a regression test suite.
(This was started in https://gerrit.chromium.org/gerrit/#change,11620
 but that was before there was this repo. So I'm moving authoritative work
 here and will use that cl and the cros-disks ones for sync only)

TEST=cd example; ./run_tests.sh
BUG=chromium-os:23064

Change-Id: I739295d6d1f30b87fd2ef06587c65e95a9c3ed14
13 files changed
tree: f3b5b4a1662c345886b6d1728d726ef2ea667da8
  1. example/
  2. common.mk
  3. LICENSE
  4. README