Added missing system libraries and headers for bazel.

Change-Id: I966d28dd5a6677acc73c608a89efa30f8358b0dd
diff --git a/WORKSPACE b/WORKSPACE
index e69de29..66027a8 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -0,0 +1,27 @@
+new_local_repository(
+  name = 'usr_repo',
+  path = '/usr',
+  build_file = 'debian/BUILD.usr',
+)
+
+# TODO(brian): Make these point to something which isn't hard-coded to come off
+# the host system...
+bind(
+  name = 'librt',
+  actual = '@usr_repo//:librt',
+)
+
+bind(
+  name = 'libdl',
+  actual = '@usr_repo//:libdl',
+)
+
+bind(
+  name = 'libm',
+  actual = '@usr_repo//:libm',
+)
+
+bind(
+  name = 'libpthread',
+  actual = '@usr_repo//:libpthread',
+)
diff --git a/aos/common/controls/BUILD b/aos/common/controls/BUILD
index 6c0805c..5c9ed5c 100644
--- a/aos/common/controls/BUILD
+++ b/aos/common/controls/BUILD
@@ -31,6 +31,9 @@
 
 cc_library(
   name = 'polytope',
+  hdrs = [
+    'polytope.h',
+  ],
   deps = [
     '//third_party/eigen',
     '//third_party/cddlib',
diff --git a/aos/common/util/BUILD b/aos/common/util/BUILD
index dedec24..d94e6e4 100644
--- a/aos/common/util/BUILD
+++ b/aos/common/util/BUILD
@@ -102,6 +102,7 @@
     '//third_party/eigen',
     '//aos/common:time',
     '//aos/common/logging',
+    '//external:libm',
   ],
 )
 
diff --git a/aos/linux_code/BUILD b/aos/linux_code/BUILD
index ce7b1b0..245acc6 100644
--- a/aos/linux_code/BUILD
+++ b/aos/linux_code/BUILD
@@ -22,6 +22,7 @@
   deps = [
     '//aos/common:once',
     '//aos/common:die',
+    '//external:libpthread',
   ],
 )
 
diff --git a/aos/linux_code/ipc_lib/BUILD b/aos/linux_code/ipc_lib/BUILD
index 83235ee..a8be135 100644
--- a/aos/linux_code/ipc_lib/BUILD
+++ b/aos/linux_code/ipc_lib/BUILD
@@ -55,6 +55,7 @@
     '//aos/linux_code/ipc_lib:mutex',
     ':core_lib',
     '//aos/common/logging:logging_interface',
+    '//external:librt',
   ],
 )
 
diff --git a/debian/BUILD.usr b/debian/BUILD.usr
new file mode 100644
index 0000000..0815609
--- /dev/null
+++ b/debian/BUILD.usr
@@ -0,0 +1,25 @@
+package(default_visibility = ['//visibility:public'])
+
+cc_library(
+  name = 'librt',
+  srcs = [ 'lib/x86_64-linux-gnu/librt.so' ],
+)
+
+cc_library(
+  name = 'libdl',
+  srcs = [ 'lib/x86_64-linux-gnu/libdl.so' ],
+)
+
+cc_library(
+  name = 'libm',
+  srcs = [ 'lib/x86_64-linux-gnu/libm.so' ],
+)
+
+cc_library(
+  name = 'libpthread',
+  srcs = [ 'lib/x86_64-linux-gnu/libpthread.so' ],
+  linkopts = [
+    '-pthread',
+  ],
+)
+
diff --git a/frc971/control_loops/BUILD b/frc971/control_loops/BUILD
index 75fda32..c220b96 100644
--- a/frc971/control_loops/BUILD
+++ b/frc971/control_loops/BUILD
@@ -89,6 +89,7 @@
   deps = [
     '//third_party/eigen',
     '//aos/common/controls:polytope',
+    '//external:libm',
   ],
 )
 
diff --git a/y2014/control_loops/claw/BUILD b/y2014/control_loops/claw/BUILD
index 0b23a71..35aa61b 100644
--- a/y2014/control_loops/claw/BUILD
+++ b/y2014/control_loops/claw/BUILD
@@ -44,6 +44,7 @@
     '//frc971/control_loops:coerce_goal',
     '//aos/common/logging:queue_logging',
     '//aos/common/logging:matrix_logging',
+    '//external:libm',
   ],
 )
 
diff --git a/y2014/control_loops/shooter/BUILD b/y2014/control_loops/shooter/BUILD
index 2007973..8013afc 100644
--- a/y2014/control_loops/shooter/BUILD
+++ b/y2014/control_loops/shooter/BUILD
@@ -43,6 +43,7 @@
     '//y2014:constants',
     '//frc971/control_loops:state_feedback_loop',
     '//aos/common/logging:queue_logging',
+    '//external:libm',
   ],
 )
 
diff --git a/y2015/actors/BUILD b/y2015/actors/BUILD
index 3aee02f..28c4af3 100644
--- a/y2015/actors/BUILD
+++ b/y2015/actors/BUILD
@@ -106,6 +106,7 @@
     '//y2015:constants',
     '//y2015/control_loops/fridge:fridge_queue',
     '//third_party/eigen',
+    '//external:libm',
   ],
 )
 
diff --git a/y2015/util/BUILD b/y2015/util/BUILD
index bf1d3ed..27c144d 100644
--- a/y2015/util/BUILD
+++ b/y2015/util/BUILD
@@ -5,6 +5,7 @@
   deps = [
     '//third_party/eigen',
     '//y2015:constants',
+    '//external:libm',
   ],
 )