libweave: Remove gyp build files.

Also, added notes to examples/build.sh and examples/prerequisites.sh
so that folks know where to turn to.

BUG: 26508278

Change-Id: Ibc224916463383cd75089b9ef1c468bc12d150ca
Reviewed-on: https://weave-review.googlesource.com/2189
Reviewed-by: Vitaly Buka <vitalybuka@google.com>
diff --git a/.gitignore b/.gitignore
index 3ee16a1..a256906 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,5 @@
-*.target.mk
 *~
 /out/
 /third_party/include
 /third_party/lib
 gomacc.lock
-Makefile
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index b45bd87..0bb7f26 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -19,6 +19,7 @@
 David Zeuthen <zeuthen@google.com>
 Gene Gutnik <gene@google.com>
 Gerry Fan <gfan@google.com>
+Jacob Marble <jacobmarble@google.com>
 Johan Euphrosine <proppy@google.com>
 Mike Frysinger <vapier@google.com>
 Nathan Bullock <nathanbullock@google.com>
diff --git a/Makefile b/Makefile
index c49462f..911f106 100644
--- a/Makefile
+++ b/Makefile
@@ -66,14 +66,14 @@
   endif
 endif
 
-include file_lists.mk third_party.mk examples.mk tests.mk
-
 ###
 # libweave.so
 
 out/$(BUILD_MODE)/libweave.so : out/$(BUILD_MODE)/libweave_common.a
 	$(CXX) -shared -Wl,-soname=libweave.so -o $@ -Wl,--whole-archive $^ -Wl,--no-whole-archive -lcrypto -lexpat -lpthread -lrt
 
+include file_lists.mk third_party/third_party.mk examples/examples.mk tests.mk
+
 ###
 # src/
 
diff --git a/README.md b/README.md
index 548d302..5f69b01 100644
--- a/README.md
+++ b/README.md
@@ -34,13 +34,13 @@
 
 # Directory structure
 
-| Path           | Description                        |
-|----------------|------------------------------------|
-| include/       | Includes to be used by device code |
-| src/           | Implementation sources             |
-| examples/      | Example of device code             |
-| third_party/   | Dependencies                       |
-| \*.gyp\* files | Build files                        |
+| Path                     | Description                        |
+|--------------------------|------------------------------------|
+| include/                 | Includes to be used by device code |
+| src/                     | Implementation sources             |
+| examples/                | Example of device code             |
+| third_party/             | Dependencies                       |
+| Makefile, \*.mk files    | Build files                        |
 
 
 # Quick start on Debian/Ubuntu
@@ -48,19 +48,8 @@
 ### Install prerequisites
 
 ```
-examples/prerequisites.sh
-```
-
-### Build library, tests, run tests, build example
-
-```
-examples/build.sh
-```
-
-### Execute example (see this [README](/examples/daemon/README.md) for details):
-
-```
-sudo out/Debug/weave_daemon
+sudo apt-get update
+sudo apt-get install autoconf automake binutils g++ hostapd libavahi-client-dev libcurl4-openssl-dev libexpat1-dev libnl-3-dev libnl-route-3-dev libssl-dev libtool
 ```
 
 # Prerequisites
@@ -71,50 +60,63 @@
   - automake
   - binutils
   - libtool
-  - gyp
   - libexpat1-dev
 
 ### For tests
 
-  - gtest
-  - gmock
+  - gtest (included; see third_party/get_gtest.sh)
+  - gmock (included; see third_party/get_gtest.sh)
 
 ### For examples
 
   - hostapd
   - libavahi-client-dev
   - libcurl4-openssl-dev
-  - libevent 2.1.x-alpha
+  - libevent 2.1.x-alpha (included; see third_party/get_libevent.sh)
 
 
 # Compiling
 
-### Generate build files
+The `make --jobs/-j` flag is encouraged, to speed up build time. For example
 
 ```
-gyp -I libweave_common.gypi --toplevel-dir=. --depth=. \
-    -f make libweave_standalone.gyp
+make all -j
 ```
 
-### Build library with tests
+### Build library
 
 ```
 make
-```
-
-### Build library only
 
 ```
-make libweave
+
+or
+
 ```
+make out/Debug/libweave.so
+```
+
+### Build examples
+
+```
+make examples-all
+```
+
+See [the examples README](/examples/daemon/README.md) for details.
 
 # Testing
 
-### Run unittests tests
+### Run tests
 
 ```
-out/Debug/libweave_testrunner
-out/Debug/libweave_exports_testrunner
+make test
+make export-test
+```
+
+or
+
+```
+make testall
 ```
 
 # Making changes
diff --git a/examples/build.sh b/examples/build.sh
index 262c56b..6a2450d 100755
--- a/examples/build.sh
+++ b/examples/build.sh
@@ -3,26 +3,12 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+# Instead of this script, try running "make all -j" and "make testall".
+# TODO: Delete this file after 15-feb-2016.
+
 DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
 ROOT_DIR=$(cd -P -- "$(dirname -- "$0")/.." && pwd -P)
 
 cd $ROOT_DIR
 
-gyp -Ilibweave_common.gypi --toplevel-dir=. --depth=. -f make $DIR/daemon/examples.gyp
-
-if [ -z "$BUILD_CONFIG" ]; then
-   export BUILD_CONFIG=Debug
-fi
-
-export BUILD_TARGET=$*
-if [ -z "$BUILD_TARGET" ]; then
-   export BUILD_TARGET="weave_daemon_examples libweave_testrunner libweave_exports_testrunner"
-fi
-
-export CORES=`cat /proc/cpuinfo | grep processor | wc -l`
-BUILDTYPE=$BUILD_CONFIG make -j $CORES $BUILD_TARGET || exit 1
-
-if [[ $BUILD_TARGET == *"libweave_testrunner"* ]]; then
-  out/${BUILD_CONFIG}/libweave_testrunner --gtest_break_on_failure || exit 1
-  out/${BUILD_CONFIG}/libweave_exports_testrunner --gtest_break_on_failure || exit 1
-fi
+make all -j
diff --git a/examples/daemon/README.md b/examples/daemon/README.md
index a447082..4585b5b 100644
--- a/examples/daemon/README.md
+++ b/examples/daemon/README.md
@@ -4,16 +4,19 @@
 
 # Building
 
-### prepare environment
+### Build daemon examples
+
+The example binaries land in the out/Debug/ directory build all of them at once:
+
 ```
-examples/prerequisites.sh
+make all-examples
 ```
 
-### build daemon
+...or one at a time.
+
 ```
-examples/build.sh
+make out/Debug/weave_daemon_light
 ```
-Binaries for daemon are in the out/ directory.
 
 # Prepare Host OS
 
diff --git a/examples/daemon/examples.gyp b/examples/daemon/examples.gyp
deleted file mode 100644
index d63c5e4..0000000
--- a/examples/daemon/examples.gyp
+++ /dev/null
@@ -1,16 +0,0 @@
-{
-  'targets': [
-    {
-      'target_name': 'weave_daemon_examples',
-      'type': 'none',
-      'dependencies': [
-        'sample/daemon.gyp:weave_daemon_sample',
-        'light/daemon.gyp:weave_daemon_light',
-        'lock/daemon.gyp:weave_daemon_lock',
-        'ledflasher/daemon.gyp:weave_daemon_ledflasher',
-        'speaker/daemon.gyp:weave_daemon_speaker',
-        'oven/daemon.gyp:weave_daemon_oven',
-      ]
-    }
-  ]
-}
diff --git a/examples/daemon/ledflasher/daemon.gyp b/examples/daemon/ledflasher/daemon.gyp
deleted file mode 100644
index 5abfcd6..0000000
--- a/examples/daemon/ledflasher/daemon.gyp
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright 2015 The Weave Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-{
-  'targets': [
-    {
-      'target_name': 'weave_daemon_ledflasher',
-      'type': 'executable',
-      'sources': [
-        'ledflasher.cc',
-      ],
-      'dependencies': [
-        '<@(DEPTH)/libweave_standalone.gyp:libweave',
-        '<@(DEPTH)/examples/provider/provider.gyp:libweave_provider',
-      ]
-    }
-  ]
-}
diff --git a/examples/daemon/light/daemon.gyp b/examples/daemon/light/daemon.gyp
deleted file mode 100644
index e8bb646..0000000
--- a/examples/daemon/light/daemon.gyp
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright 2015 The Weave Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-{
-  'targets': [
-    {
-      'target_name': 'weave_daemon_light',
-      'type': 'executable',
-      'sources': [
-        'light.cc',
-      ],
-      'dependencies': [
-        '<@(DEPTH)/libweave_standalone.gyp:libweave',
-        '<@(DEPTH)/examples/provider/provider.gyp:libweave_provider',
-      ]
-    }
-  ]
-}
diff --git a/examples/daemon/lock/daemon.gyp b/examples/daemon/lock/daemon.gyp
deleted file mode 100644
index 0402a29..0000000
--- a/examples/daemon/lock/daemon.gyp
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright 2015 The Weave Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-{
-  'targets': [
-    {
-      'target_name': 'weave_daemon_lock',
-      'type': 'executable',
-      'sources': [
-        'lock.cc',
-      ],
-      'dependencies': [
-        '<@(DEPTH)/libweave_standalone.gyp:libweave',
-        '<@(DEPTH)/examples/provider/provider.gyp:libweave_provider',
-      ]
-    }
-  ]
-}
diff --git a/examples/daemon/oven/daemon.gyp b/examples/daemon/oven/daemon.gyp
deleted file mode 100644
index 44b4798..0000000
--- a/examples/daemon/oven/daemon.gyp
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright 2015 The Weave Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-{
-  'targets': [
-    {
-      'target_name': 'weave_daemon_oven',
-      'type': 'executable',
-      'sources': [
-        'oven.cc',
-      ],
-      'dependencies': [
-        '<@(DEPTH)/libweave_standalone.gyp:libweave',
-        '<@(DEPTH)/examples/provider/provider.gyp:libweave_provider',
-      ]
-    }
-  ]
-}
diff --git a/examples/daemon/sample/daemon.gyp b/examples/daemon/sample/daemon.gyp
deleted file mode 100644
index 29d8235..0000000
--- a/examples/daemon/sample/daemon.gyp
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright 2015 The Weave Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-{
-  'targets': [
-    {
-      'target_name': 'weave_daemon_sample',
-      'type': 'executable',
-      'sources': [
-        'sample.cc',
-      ],
-      'dependencies': [
-        '<@(DEPTH)/libweave_standalone.gyp:libweave',
-        '<@(DEPTH)/examples/provider/provider.gyp:libweave_provider',
-      ]
-    }
-  ]
-}
diff --git a/examples/daemon/speaker/daemon.gyp b/examples/daemon/speaker/daemon.gyp
deleted file mode 100644
index 3bf7a91..0000000
--- a/examples/daemon/speaker/daemon.gyp
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright 2015 The Weave Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-{
-  'targets': [
-    {
-      'target_name': 'weave_daemon_speaker',
-      'type': 'executable',
-      'sources': [
-        'speaker.cc',
-      ],
-      'dependencies': [
-        '<@(DEPTH)/libweave_standalone.gyp:libweave',
-        '<@(DEPTH)/examples/provider/provider.gyp:libweave_provider',
-      ]
-    }
-  ]
-}
diff --git a/examples.mk b/examples/examples.mk
similarity index 100%
rename from examples.mk
rename to examples/examples.mk
diff --git a/examples/prerequisites.sh b/examples/prerequisites.sh
index 1b27806..489bb58 100755
--- a/examples/prerequisites.sh
+++ b/examples/prerequisites.sh
@@ -3,6 +3,9 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+# Instead of this script, try running "make all -j".
+# TODO: Delete this file after 15-feb-2016.
+
 DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
 ROOT_DIR=$(cd -P -- "$(dirname -- "$0")/.." && pwd -P)
 
@@ -11,7 +14,6 @@
   automake \
   binutils \
   g++ \
-  gyp \
   hostapd \
   libavahi-client-dev \
   libcurl4-openssl-dev \
@@ -21,47 +23,3 @@
   libssl-dev \
   libtool \
   || exit 1
-
-mkdir -p $ROOT_DIR/third_party/lib $ROOT_DIR/third_party/include 2> /dev/null
-
-# Make gtest and gmock
-cd $ROOT_DIR/third_party
-rm -rf googletest
-
-git clone https://github.com/google/googletest.git || exit 1
-cd $ROOT_DIR/third_party/googletest
-
-# gtest is in process of changing of dir structure and it has broken build
-# files. So this is temporarily workaround to fix that.
-git reset --hard d945d8c000a0ade73585d143532266968339bbb3
-mv googletest googlemock/gtest
-
-for SUB_DIR in googlemock/gtest googlemock; do
-  cd $ROOT_DIR/third_party/googletest/$SUB_DIR || exit 1
-  autoreconf -fvi || exit 1
-  ./configure --disable-shared || exit 1
-  make || exit 1
-  cp -rf include/* $ROOT_DIR/third_party/include/ || exit 1
-  cp -rf lib/.libs/* $ROOT_DIR/third_party/lib/ || exit 1
-done
-rm -rf $ROOT_DIR/third_party/googletest
-
-# Make libevent.
-# Example uses libevent to implement HTTPS server. This capability is
-# available only in version 2.1.x-alpha. Step could be replaced with apt-get
-# in future.
-cd $ROOT_DIR/third_party
-rm -rf libevent
-
-git clone https://github.com/libevent/libevent.git || exit 1
-cd libevent || exit 1
-./autogen.sh || exit 1
-./configure --disable-shared || exit 1
-make || exit 1
-if [ -z "$DISABLE_LIBEVENT_TEST" ]; then
-  echo -e "\n\nTesting libevent...\nCan take several minutes.\n"
-  make verify || exit 1
-fi
-cp -rf include/* $ROOT_DIR/third_party/include/ || exit 1
-cp -rf .libs/lib* $ROOT_DIR/third_party/lib/ || exit 1
-rm -rf $ROOT_DIR/third_party/libevent
diff --git a/examples/provider/provider.gyp b/examples/provider/provider.gyp
deleted file mode 100644
index 3d13d8f..0000000
--- a/examples/provider/provider.gyp
+++ /dev/null
@@ -1,59 +0,0 @@
-# Copyright 2015 The Weave Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-{
-  'targets': [
-    {
-      'target_name': 'libweave_provider',
-      'type': 'static_library',
-      'variables': {
-        'deps': [
-          'avahi-client',
-          'expat',
-          'libcurl',
-          'libcrypto',
-          'openssl',
-        ]
-      },
-      'cflags': [
-        '>!@(pkg-config >(deps) --cflags)',
-        '-pthread',
-      ],
-      'sources': [
-        'avahi_client.cc',
-        'bluez_client.cc',
-        'curl_http_client.cc',
-        'event_http_client.cc',
-        'event_http_server.cc',
-        'event_network.cc',
-        'event_task_runner.cc',
-        'file_config_store.cc',
-        'wifi_manager.cc',
-        'ssl_stream.cc',
-      ],
-      'dependencies': [
-        '<@(DEPTH)/libweave_standalone.gyp:libweave',
-      ],
-      'direct_dependent_settings' : {
-        'variables': {
-          'parent_deps': [
-            '<@(deps)'
-          ]
-        },
-        'link_settings': {
-          'ldflags+': [
-            '>!@(pkg-config >(parent_deps) --libs-only-L --libs-only-other)',
-          ],
-          'libraries+': [
-            '>!(pkg-config >(parent_deps) --libs-only-l)',
-          ],
-        },
-        'libraries': [
-          '-levent',
-          '-levent_openssl',
-          '-lpthread',
-        ]
-      }
-    }
-  ]
-}
diff --git a/libweave.gypi b/libweave.gypi
deleted file mode 100644
index 6f64c89..0000000
--- a/libweave.gypi
+++ /dev/null
@@ -1,151 +0,0 @@
-# Copyright 2015 The Weave Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-{
-  'variables': {
-    'weave_sources': [
-      'src/backoff_entry.cc',
-      'src/base_api_handler.cc',
-      'src/commands/cloud_command_proxy.cc',
-      'src/commands/command_instance.cc',
-      'src/commands/command_queue.cc',
-      'src/commands/schema_constants.cc',
-      'src/component_manager_impl.cc',
-      'src/config.cc',
-      'src/data_encoding.cc',
-      'src/device_manager.cc',
-      'src/device_registration_info.cc',
-      'src/error.cc',
-      'src/http_constants.cc',
-      'src/json_error_codes.cc',
-      'src/notification/notification_parser.cc',
-      'src/notification/pull_channel.cc',
-      'src/notification/xml_node.cc',
-      'src/notification/xmpp_channel.cc',
-      'src/notification/xmpp_iq_stanza_handler.cc',
-      'src/notification/xmpp_stream_parser.cc',
-      'src/privet/auth_manager.cc',
-      'src/privet/cloud_delegate.cc',
-      'src/privet/constants.cc',
-      'src/privet/device_delegate.cc',
-      'src/privet/device_ui_kind.cc',
-      'src/privet/openssl_utils.cc',
-      'src/privet/privet_handler.cc',
-      'src/privet/privet_manager.cc',
-      'src/privet/privet_types.cc',
-      'src/privet/publisher.cc',
-      'src/privet/security_manager.cc',
-      'src/privet/wifi_bootstrap_manager.cc',
-      'src/privet/wifi_ssid_generator.cc',
-      'src/registration_status.cc',
-      'src/states/state_change_queue.cc',
-      'src/streams.cc',
-      'src/string_utils.cc',
-      'src/utils.cc',
-      'third_party/chromium/crypto/p224.cc',
-      'third_party/chromium/crypto/p224_spake.cc',
-      'third_party/chromium/crypto/sha2.cc',
-      'third_party/libuweave/src/crypto_hmac.c',
-      'third_party/libuweave/src/crypto_utils.c',
-      'third_party/libuweave/src/macaroon.c',
-      'third_party/libuweave/src/macaroon_caveat.c',
-      'third_party/libuweave/src/macaroon_context.c',
-      'third_party/libuweave/src/macaroon_encoding.c',
-      'third_party/modp_b64/modp_b64.cc',
-    ],
-    'weave_test_sources': [
-      'src/test/fake_stream.cc',
-      'src/test/fake_task_runner.cc',
-      'src/test/unittest_utils.cc',
-    ],
-    'weave_unittest_sources': [
-      'src/backoff_entry_unittest.cc',
-      'src/base_api_handler_unittest.cc',
-      'src/commands/cloud_command_proxy_unittest.cc',
-      'src/commands/command_instance_unittest.cc',
-      'src/commands/command_queue_unittest.cc',
-      'src/component_manager_unittest.cc',
-      'src/config_unittest.cc',
-      'src/data_encoding_unittest.cc',
-      'src/device_registration_info_unittest.cc',
-      'src/error_unittest.cc',
-      'src/notification/notification_parser_unittest.cc',
-      'src/notification/xml_node_unittest.cc',
-      'src/notification/xmpp_channel_unittest.cc',
-      'src/notification/xmpp_iq_stanza_handler_unittest.cc',
-      'src/notification/xmpp_stream_parser_unittest.cc',
-      'src/privet/auth_manager_unittest.cc',
-      'src/privet/privet_handler_unittest.cc',
-      'src/privet/security_manager_unittest.cc',
-      'src/privet/wifi_ssid_generator_unittest.cc',
-      'src/states/state_change_queue_unittest.cc',
-      'src/streams_unittest.cc',
-      'src/string_utils_unittest.cc',
-      'src/test/weave_testrunner.cc',
-      'third_party/chromium/crypto/p224_spake_unittest.cc',
-      'third_party/chromium/crypto/p224_unittest.cc',
-      'third_party/chromium/crypto/sha2_unittest.cc',
-    ],
-    'weave_exports_unittest_sources': [
-      'src/test/weave_testrunner.cc',
-      'src/weave_unittest.cc',
-    ],
-    'base_sources': [
-      'third_party/chromium/base/bind_helpers.cc',
-      'third_party/chromium/base/callback_internal.cc',
-      'third_party/chromium/base/guid_posix.cc',
-      'third_party/chromium/base/json/json_parser.cc',
-      'third_party/chromium/base/json/json_reader.cc',
-      'third_party/chromium/base/json/json_writer.cc',
-      'third_party/chromium/base/json/string_escape.cc',
-      'third_party/chromium/base/memory/ref_counted.cc',
-      'third_party/chromium/base/logging.cc',
-      'third_party/chromium/base/location.cc',
-      'third_party/chromium/base/memory/weak_ptr.cc',
-      'third_party/chromium/base/memory/weak_ptr.cc',
-      'third_party/chromium/base/rand_util.cc',
-      'third_party/chromium/base/rand_util_posix.cc',
-      'third_party/chromium/base/strings/string_number_conversions.cc',
-      'third_party/chromium/base/strings/string_piece.cc',
-      'third_party/chromium/base/strings/stringprintf.cc',
-      'third_party/chromium/base/strings/string_util.cc',
-      'third_party/chromium/base/strings/string_util_constants.cc',
-      'third_party/chromium/base/strings/utf_string_conversion_utils.cc',
-      'third_party/chromium/base/third_party/dmg_fp/g_fmt.cc',
-      'third_party/chromium/base/third_party/dmg_fp/dtoa.cc',
-      'third_party/chromium/base/third_party/icu/icu_utf.cc',
-      'third_party/chromium/base/time/clock.cc',
-      'third_party/chromium/base/time/default_clock.cc',
-      'third_party/chromium/base/time/time.cc',
-      'third_party/chromium/base/time/time_posix.cc',
-      'third_party/chromium/base/values.cc',
-    ],
-    'base_unittests': [
-      'third_party/chromium/base/bind_unittest.cc',
-      'third_party/chromium/base/callback_list_unittest.cc',
-      'third_party/chromium/base/callback_unittest.cc',
-      'third_party/chromium/base/guid_unittest.cc',
-      'third_party/chromium/base/json/json_parser_unittest.cc',
-      'third_party/chromium/base/json/json_reader_unittest.cc',
-      'third_party/chromium/base/json/json_writer_unittest.cc',
-      'third_party/chromium/base/json/string_escape_unittest.cc',
-      'third_party/chromium/base/logging_unittest.cc',
-      'third_party/chromium/base/memory/ref_counted_unittest.cc',
-      'third_party/chromium/base/memory/scoped_ptr_unittest.cc',
-      'third_party/chromium/base/memory/weak_ptr_unittest.cc',
-      'third_party/chromium/base/move_unittest.cc',
-      'third_party/chromium/base/numerics/safe_numerics_unittest.cc',
-      'third_party/chromium/base/observer_list_unittest.cc',
-      'third_party/chromium/base/rand_util_unittest.cc',
-      'third_party/chromium/base/scoped_clear_errno_unittest.cc',
-      'third_party/chromium/base/strings/string_number_conversions_unittest.cc',
-      'third_party/chromium/base/strings/string_piece_unittest.cc',
-      'third_party/chromium/base/strings/string_util_unittest.cc',
-      'third_party/chromium/base/strings/stringprintf_unittest.cc',
-      'third_party/chromium/base/template_util_unittest.cc',
-      'third_party/chromium/base/time/time_unittest.cc',
-      'third_party/chromium/base/tuple_unittest.cc',
-      'third_party/chromium/base/values_unittest.cc',
-    ],
-  },
-}
diff --git a/libweave_common.gypi b/libweave_common.gypi
deleted file mode 100644
index e7b45ce..0000000
--- a/libweave_common.gypi
+++ /dev/null
@@ -1,87 +0,0 @@
-# Copyright 2015 The Weave Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-{
-  'variables': {
-    'clang%': 0,
-  },
-  'target_defaults': {
-    'configurations': {
-      'Release': {
-        'defines': [
-          'NDEBUG',
-        ],
-        'cflags': [
-          '-Os',
-        ],
-      },
-      'Debug': {
-        'defines': [
-          '_DEBUG',
-        ],
-        'cflags': [
-          '-O0  ',
-          '-g3',
-        ],
-      },
-    },
-    'include_dirs': [
-      '.',
-      'include',
-      'third_party/chromium',
-      'third_party/include',
-      'third_party/libuweave',
-      'third_party/modp_b64/modp_b64',
-    ],
-    'cflags!': ['-fPIE'],
-    'cflags': [
-      '-fno-exceptions',
-      '-fPIC',
-      '-fvisibility=hidden',
-      '-Wall',
-      '-Werror',
-      '-Wextra',
-      '-Wl,--exclude-libs,ALL',
-      '-Wno-char-subscripts',
-      '-Wno-format-nonliteral',
-      '-Wno-missing-field-initializers',
-      '-Wno-unused-local-typedefs',
-      '-Wno-unused-parameter',
-      '-Wpacked',
-      '-Wpointer-arith',
-      '-Wwrite-strings',
-    ],
-    'cflags_cc': [
-      '-std=c++11',
-    ],
-    'cflags_c': [
-      '-std=c99',
-    ],
-    'libraries': [
-      # 'library_dirs' does not work as expected with make files
-      '-Lthird_party/lib',
-    ],
-    'library_dirs': ['third_party/lib'],
-  },
-  'conditions': [
-     ['clang==1', {
-       'target_defaults': {
-          'cflags!': ['-Wl,--exclude-libs,ALL'],
-          'cflags': [
-            '-fsanitize=address',
-            '-fno-omit-frame-pointer',
-            '-Wno-deprecated-register',
-            '-Wno-inconsistent-missing-override',
-          ],
-          'ldflags': [
-            '-fsanitize=address',
-          ],
-        },
-        'make_global_settings': [
-          ['CC','/usr/bin/clang-3.6'],
-          ['CXX','/usr/bin/clang++-3.6'],
-          ['LINK','/usr/bin/clang++-3.6'],
-        ],
-     }],
-  ]
-}
diff --git a/libweave_standalone.gyp b/libweave_standalone.gyp
deleted file mode 100644
index d36d208..0000000
--- a/libweave_standalone.gyp
+++ /dev/null
@@ -1,84 +0,0 @@
-# Copyright 2015 The Weave Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-{
-  'includes': [
-    'libweave.gypi',
-  ],
-  'target_defaults': {
-    'libraries': [
-      '-lcrypto',
-      '-lexpat',
-      '-lgmock',
-      '-lgtest',
-      '-lpthread',
-      '-lrt',
-    ],
-  },
-  'targets': [
-    {
-      'target_name': 'libweave_common',
-      'type': 'static_library',
-      'include_dirs': [
-        '<@(DEPTH)/external',
-      ],
-      'sources': [
-        '<@(weave_sources)',
-        '<@(base_sources)',
-      ],
-    },
-    {
-      'target_name': 'libweave',
-      'type': 'shared_library',
-      'include_dirs': [
-        '../libweave/external',
-      ],
-      'dependencies': [
-        'libweave_common',
-      ],
-      'sources': [
-        'src/empty.cc'
-      ],
-    },
-    {
-      'target_name': 'libweave-test',
-      'type': 'static_library',
-      'standalone_static_library': 1,
-      'include_dirs': [
-        '<@(DEPTH)/external',
-      ],
-      'sources': [
-        '<@(weave_test_sources)',
-      ],
-    },
-    {
-      'target_name': 'libweave_testrunner',
-      'type': 'executable',
-      'include_dirs': [
-        '<@(DEPTH)/external',
-      ],
-      'dependencies': [
-        'libweave_common',
-        'libweave-test',
-      ],
-      'sources': [
-        '<@(weave_unittest_sources)',
-        '<@(base_unittests)',
-      ],
-    },
-    {
-      'target_name': 'libweave_exports_testrunner',
-      'type': 'executable',
-      'include_dirs': [
-        '<@(DEPTH)/external',
-      ],
-      'dependencies': [
-        'libweave',
-        'libweave-test',
-      ],
-      'sources': [
-        '<@(weave_exports_unittest_sources)',
-      ],
-    },
-  ],
-}
diff --git a/tests.mk b/tests.mk
index aa9ee53..7c05017 100644
--- a/tests.mk
+++ b/tests.mk
@@ -5,6 +5,14 @@
 ###
 # tests
 
+TEST_FLAGS ?= \
+	--gtest_break_on_failure
+
+TEST_ENV ?=
+ifeq (1, $(CLANG))
+  TEST_ENV += ASAN_SYMBOLIZER_PATH=$(shell which llvm-symbolizer-3.6)
+endif
+
 weave_test_obj_files := $(WEAVE_TEST_SRC_FILES:%.cc=out/$(BUILD_MODE)/%.o)
 
 # We don't need libgtest.a, but the headers files in third_party/include.
@@ -26,7 +34,7 @@
 	$(CXX) -o $@ $^ $(CFLAGS) -lcrypto -lexpat -lgmock -lgtest -lpthread -lrt -Lthird_party/lib
 
 test : out/$(BUILD_MODE)/libweave_testrunner
-	$<
+	$(TEST_ENV) $< $(TEST_FLAGS)
 
 ###
 # export tests
@@ -42,7 +50,9 @@
 	$(CXX) -o $@ $^ $(CFLAGS) -lcrypto -lexpat -lgmock -lgtest -lpthread -lrt -Lthird_party/lib -Wl,-rpath=out/$(BUILD_MODE)/
 
 export-test : out/$(BUILD_MODE)/libweave_exports_testrunner
-	$<
+	$(TEST_ENV) $< $(TEST_FLAGS)
 
-.PHONY : test export-test
+testall : test export-test
+
+.PHONY : test export-test testall
 
diff --git a/third_party.mk b/third_party/third_party.mk
similarity index 100%
rename from third_party.mk
rename to third_party/third_party.mk