Finish auto-converting most of the gyp files.

I've also started writing down which ones need manual work.

Change-Id: I442782e1e3352e0de32b612f1bd2c167f231495a
diff --git a/aos/linux_code/BUILD b/aos/linux_code/BUILD
index 7305bc7..63c970c 100644
--- a/aos/linux_code/BUILD
+++ b/aos/linux_code/BUILD
@@ -6,7 +6,7 @@
     'dump_rtprio.cc',
   ],
   deps = [
-    '//aos/common/logging:logging',
+    '//aos/common/logging',
     '//aos/common:time',
   ],
 )
@@ -14,7 +14,10 @@
 cc_library(
   name = 'complex_thread_local',
   srcs = [
-    'complex_thread_local.cc'
+    'complex_thread_local.cc',
+  ],
+  hdrs = [
+    'complex_thread_local.h',
   ],
   deps = [
     '//aos/common:once',
@@ -31,7 +34,7 @@
     ':complex_thread_local',
     '//third_party/gtest',
     '//aos/common/util:thread',
-    '//aos/common/logging:logging',
+    '//aos/common/logging',
   ],
 )
 
@@ -40,21 +43,27 @@
   srcs = [
     'init.cc',
   ],
+  hdrs = [
+    'init.h',
+  ],
   deps = [
     '//aos/linux_code/ipc_lib:shared_mem',
     '//aos/common:die',
-    '//aos/common/logging:logging',
+    '//aos/common/logging',
   ],
 )
 
 cc_library(
   name = 'configuration',
-  src = [
+  srcs = [
     'configuration.cc',
   ],
+  hdrs = [
+    'configuration.h',
+  ],
   deps = [
     '//aos/common:once',
-    '//aos/common/logging:logging',
+    '//aos/common/logging',
   ],
 )
 
diff --git a/aos/linux_code/ipc_lib/BUILD b/aos/linux_code/ipc_lib/BUILD
new file mode 100644
index 0000000..c511968
--- /dev/null
+++ b/aos/linux_code/ipc_lib/BUILD
@@ -0,0 +1,105 @@
+package(default_visibility = ['//visibility:public'])
+
+cc_library(
+  name = 'aos_sync',
+  srcs = [
+    'aos_sync.cc',
+  ],
+  hdrs = [
+    'aos_sync.h',
+  ],
+  deps = [
+    '//aos/common/logging:logging_interface',
+    '//aos/common:once',
+  ],
+)
+
+cc_library(
+  name = 'core_lib',
+  srcs = [
+    'core_lib.c',
+  ],
+  hdrs = [
+    'core_lib.h',
+  ],
+  deps = [
+    ':aos_sync',
+    ':shared_mem',
+  ],
+)
+
+cc_library(
+  name = 'shared_mem',
+  srcs = [
+    'shared_mem.c',
+  ],
+  hdrs = [
+    'shared_mem.h',
+  ],
+  deps = [
+    ':aos_sync',
+    '//aos/common/logging:logging_interface',
+  ],
+)
+
+cc_library(
+  name = 'queue',
+  srcs = [
+    'queue.cc',
+  ],
+  hdrs = [
+    'queue.h',
+  ],
+  deps = [
+    '//aos/linux_code/ipc_lib:condition',
+    '//aos/linux_code/ipc_lib:mutex',
+    ':core_lib',
+    '//aos/common/logging:logging_interface',
+  ],
+)
+
+cc_test(
+  name = 'raw_queue_test',
+  srcs = [
+    'raw_queue_test.cc',
+  ],
+  deps = [
+    '//third_party/gtest',
+    ':queue',
+    '//aos/common/logging',
+    ':core_lib',
+    '//aos/common:queue_testutils',
+    '//aos/common:time',
+    '//aos/common:die',
+    '//aos/common/util:thread',
+    '//aos/common/util:death_test_log_implementation',
+  ],
+)
+
+cc_test(
+  name = 'ipc_stress_test',
+  srcs = [
+    'ipc_stress_test.cc',
+  ],
+  tags = [
+    'manual',
+  ],
+  deps = [
+    '//third_party/gtest',
+    '//aos/common:time',
+    '//aos/common:queue_testutils',
+    '//aos/linux_code/ipc_lib:mutex',
+    ':core_lib',
+    '//aos/common:die',
+    '//aos/common/libc:dirname',
+    '//aos/common/libc:aos_strsignal',
+    '//aos/common/logging',
+  ],
+)
+
+cc_library(
+  name = 'scoped_message_ptr',
+  deps = [
+    ':queue',
+  ],
+)
diff --git a/aos/linux_code/logging/BUILD b/aos/linux_code/logging/BUILD
index fbd153f..a35cd0e 100644
--- a/aos/linux_code/logging/BUILD
+++ b/aos/linux_code/logging/BUILD
@@ -1,60 +1,72 @@
 package(default_visibility = ['//visibility:public'])
 
 cc_library(
-  name = 'linux_interface',
+  name = 'log_replay',
   srcs = [
-    'linux_interface.cc',
+    'log_replay.cc',
+  ],
+  hdrs = [
+    'log_replay.h',
   ],
   deps = [
-    '//aos/linux_code:complex_thread_local',
-    '//aos/common:die',
-    '//aos/common/libc:aos_strerror',
-  ],
-)
-
-cc_library(
-  name = 'linux_logging',
-  srcs = [
-    'linux_logging.cc',
-  ],
-  deps = [
+    ':binary_log_file',
+    '//aos/common:queues',
+    '//aos/common/logging',
     '//aos/linux_code/ipc_lib:queue',
+  ],
+)
+
+cc_binary(
+  name = 'binary_log_writer',
+  srcs = [
+    'binary_log_writer.cc',
+  ],
+  deps = [
+    '//aos/common/logging',
+    '//aos/linux_code:init',
+    '//aos/linux_code:configuration',
+    '//aos/common:die',
+    ':binary_log_file',
+    '//aos/common:queue_types',
+  ],
+)
+
+cc_binary(
+  name = 'log_streamer',
+  srcs = [
+    'log_streamer.cc',
+  ],
+  deps = [
+    '//aos/common/logging',
+    '//aos/linux_code:init',
     '//aos/common:time',
+    '//aos/linux_code/ipc_lib:queue',
   ],
 )
 
-cc_test(
-  name = 'logging_impl_test',
+cc_binary(
+  name = 'log_displayer',
   srcs = [
-    'logging_impl_test.cc',
+    'log_displayer.cc',
   ],
   deps = [
-    '//third_party/gtest',
-    '//aos/common/logging:logging',
+    '//aos/common/logging',
+    '//aos/linux_code:init',
+    ':binary_log_file',
+    '//aos/common:queue_types',
+    '//aos/linux_code:configuration',
   ],
 )
 
 cc_library(
-  name = 'queue_logging',
+  name = 'binary_log_file',
   srcs = [
-    'queue_logging.cc',
+    'binary_log_file.cc',
+  ],
+  hdrs = [
+    'binary_log_file.h',
   ],
   deps = [
-    '//aos/common/logging:logging',
-    '//aos/common:die',
-    '//aos/common:queue_types',
-  ],
-)
-
-cc_library(
-  name = 'matrix_logging',
-  srcs = [
-    'matrix_logging.cc',
-  ],
-  deps = [
-    '//aos/common/logging:logging',
-    '//aos/common:die',
-    '//aos/common:queue_types',
-    '//third_party/eigen',
+    '//aos/common/logging',
   ],
 )
diff --git a/aos/linux_code/output/BUILD b/aos/linux_code/output/BUILD
new file mode 100644
index 0000000..bcd63bd
--- /dev/null
+++ b/aos/linux_code/output/BUILD
@@ -0,0 +1,22 @@
+package(default_visibility = ['//visibility:public'])
+
+cc_library(
+  name = 'http_server',
+  srcs = [
+    'HTTPServer.cpp',
+    'evhttp_ctemplate_emitter.cc',
+    'ctemplate_cache.cc',
+  ],
+  hdrs = [
+    'HTTPServer.h',
+    'evhttp_ctemplate_emitter.h',
+    'ctemplate_cache.h',
+  ],
+  deps = [
+    '//third_party/libevent',
+    '//third_party/ctemplate',
+    '//aos/common:once',
+    '//aos/common:scoped_fd',
+    '//aos/common/logging',
+  ],
+)
diff --git a/aos/linux_code/starter/BUILD b/aos/linux_code/starter/BUILD
new file mode 100644
index 0000000..2e5a80c
--- /dev/null
+++ b/aos/linux_code/starter/BUILD
@@ -0,0 +1,17 @@
+package(default_visibility = ['//visibility:public'])
+
+cc_binary(
+  name = 'starter_exe',
+  srcs = [
+    'starter.cc',
+  ],
+  deps = [
+    '//aos/linux_code:init',
+    '//third_party/libevent',
+    '//aos/common/logging',
+    '//aos/common:once',
+    '//aos/common:time',
+    '//aos/common/libc:aos_strsignal',
+    '//aos/common/util:run_command',
+  ],
+)