build: Rewrite build with common.mk

This rewrites the Makefiles of Newblue based on common.mk copied from
platform2/common-mk.

The targets include
- libnewblue.so: a shared lib which used by Newblue daemon
- hci_plugin/libbt-vendor.so: a shared lib use by libnewblue.so
- new_blue_test: an executable for testing during development
- tests/newblue_unittest: an executable for Newblue unit tests

Other fixes:
- replacing PREF_PATH with pref_path which is defined an extern variable
  and the different definitions are picked based on the targets due to
  the link error caused the build system reusing the same object without
  re-compiling even if CFLAGs have changed
- removing the use of _UNITTEST_ due to the link error caused by the
  build system reusing the same object without re-compiling even if
  CFLAGS have changed
- removing the use of static_or_test macro which depends on the
  _UNITTEST_ flag
- compilation errors in gatt.c, tests/persist_unittest.cc and unused variables

BUG=chromium:844266
TEST=build Newblue with the following commands and verify build and
     installation
     make (with CC=clang and CXX=clang++)
     make test (with CC=clang and CXX=clang++)
     emerge-$BOARD newblue
     FEATURES="test" emerge-{$BOARD} newblue
     cros deploy DUT newblue
CQ-DEPEND=CL:1056095

Change-Id: I454020ab9ae2d4c9f59b2e79aef63ea957b35aa3
Reviewed-on: https://chromium-review.googlesource.com/1064979
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Miao-chen Chou <mcchou@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
14 files changed