Merge "Reorganize and extend Kinetis hardware access macros"
diff --git a/aos/BUILD b/aos/BUILD
index 2e73c51..8aa274c 100644
--- a/aos/BUILD
+++ b/aos/BUILD
@@ -45,6 +45,9 @@
     hdrs = [
         "once.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     visibility = ["//visibility:public"],
     deps = [
         "//aos/common:gtest_prod",
diff --git a/aos/build/queues.bzl b/aos/build/queues.bzl
index 9dd23bd..840b4fe 100644
--- a/aos/build/queues.bzl
+++ b/aos/build/queues.bzl
@@ -25,28 +25,28 @@
   }
 
 _single_queue_file = rule(
-  implementation = _single_queue_file_impl,
-  attrs = {
-    'src': attr.label(
-      mandatory = True,
-      single_file = True,
-      allow_files = ['.q'],
-    ),
-    'q_deps': attr.label(
-      providers = ['transitive_q_files'],
-      mandatory = True,
-    ),
-    'package_name': attr.string(
-      mandatory = True,
-    ),
-    '_queue_compiler': attr.label(
-      executable = True,
-      default = Label('//aos/build/queues:compiler'),
-      cfg = 'host',
-    ),
-  },
-  outputs = _single_queue_file_outputs,
-  output_to_genfiles = True,
+    attrs = {
+        "src": attr.label(
+            mandatory = True,
+            single_file = True,
+            allow_files = [".q"],
+        ),
+        "q_deps": attr.label(
+            providers = ["transitive_q_files"],
+            mandatory = True,
+        ),
+        "package_name": attr.string(
+            mandatory = True,
+        ),
+        "_queue_compiler": attr.label(
+            executable = True,
+            default = Label("//aos/build/queues:compiler"),
+            cfg = "host",
+        ),
+    },
+    output_to_genfiles = True,
+    outputs = _single_queue_file_outputs,
+    implementation = _single_queue_file_impl,
 )
 
 def _q_deps_impl(ctx):
@@ -56,34 +56,38 @@
   return struct(transitive_q_files = transitive_q_files)
 
 _q_deps = rule(
-  implementation = _q_deps_impl,
-  attrs = {
-    'srcs': attr.label_list(
-      mandatory = True,
-      non_empty = True,
-      allow_files = ['.q'],
-    ),
-    'deps': attr.label_list(
-      mandatory = True,
-      non_empty = False,
-      providers = ['transitive_q_files'],
-    ),
-  },
+    attrs = {
+        "srcs": attr.label_list(
+            mandatory = True,
+            non_empty = True,
+            allow_files = [".q"],
+        ),
+        "deps": attr.label_list(
+            mandatory = True,
+            non_empty = False,
+            providers = ["transitive_q_files"],
+        ),
+    },
+    implementation = _q_deps_impl,
 )
 
-'''Creates a C++ library from a set of .q files.
+"""Creates a C++ library from a set of .q files.
 
 Attrs:
   srcs: A list of .q files.
   deps: Other queue_library rules this one depends on.
-'''
+"""
+
 def queue_library(name, srcs, deps = [],
+                  compatible_with = None, restricted_to = None,
                   visibility = None):
   q_deps = _q_deps(
     name = name + '__q_deps',
     srcs = srcs,
     deps = [dep + '__q_deps' for dep in deps],
     visibility = visibility,
+    compatible_with = compatible_with,
+    restricted_to = restricted_to,
   )
 
   for src in srcs:
@@ -93,6 +97,8 @@
       q_deps = ':%s__q_deps' % name,
       package_name = PACKAGE_NAME,
       visibility = ['//visibility:private'],
+      compatible_with = compatible_with,
+      restricted_to = restricted_to,
     )
 
   native.cc_library(
@@ -106,4 +112,6 @@
       '//aos/common/logging:printf_formats',
     ],
     visibility = visibility,
+    compatible_with = compatible_with,
+    restricted_to = restricted_to,
   )
diff --git a/aos/common/BUILD b/aos/common/BUILD
index b1c5b3b..f9ef264 100644
--- a/aos/common/BUILD
+++ b/aos/common/BUILD
@@ -23,7 +23,9 @@
     hdrs = [
         "macros.h",
     ],
-    compatible_with = mcu_cpus,
+    compatible_with = mcu_cpus + [
+        "//tools:armhf-debian",
+    ],
 )
 
 cc_library(
@@ -31,6 +33,9 @@
     hdrs = [
         "type_traits.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
 )
 
 cc_library(
@@ -41,6 +46,9 @@
     hdrs = [
         "time.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     deps = [
         ":macros",
         ":mutex",
@@ -53,6 +61,9 @@
     name = "gen_queue_primitives",
     outs = ["queue_primitives.h"],
     cmd = "$(location //aos/build/queues:queue_primitives) $@",
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     tools = ["//aos/build/queues:queue_primitives"],
     visibility = ["//visibility:private"],
 )
@@ -61,6 +72,9 @@
     name = "gen_print_field",
     outs = ["print_field.cc"],
     cmd = "$(location //aos/build/queues:print_field) $@",
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     tools = ["//aos/build/queues:print_field"],
     visibility = ["//visibility:private"],
 )
@@ -70,6 +84,9 @@
     hdrs = [
         ":gen_queue_primitives",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     visibility = ["//aos/common/logging:__pkg__"],
 )
 
@@ -93,6 +110,9 @@
     hdrs = [
         "unique_malloc_ptr.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
 )
 
 cc_library(
@@ -105,6 +125,9 @@
     hdrs = [
         "queue_types.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     deps = [
         ":byteorder",
         ":generated_queue_headers",
@@ -142,6 +165,9 @@
     hdrs = [
         "byteorder.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
 )
 
 cc_library(
@@ -152,6 +178,9 @@
     hdrs = [
         "message.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     deps = [
         ":byteorder",
         ":macros",
@@ -161,10 +190,12 @@
 
 cc_library(
     name = "queues",
-    srcs = [],
     hdrs = [
         "queue.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     deps = [
         ":messages",
         "//aos/linux_code:queue",
@@ -177,6 +208,9 @@
     hdrs = [
         "scoped_fd.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     deps = [
         "//aos/common/logging",
     ],
@@ -212,6 +246,9 @@
     hdrs = [
         "gtest_prod.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
 )
 
 cc_test(
@@ -235,6 +272,9 @@
     hdrs = [
         "die.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     deps = [
         ":macros",
         "//aos/common/libc:aos_strerror",
@@ -280,6 +320,9 @@
     hdrs = [
         "condition.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     deps = [
         ":mutex",
         "//aos/common/logging",
@@ -337,6 +380,9 @@
     hdrs = [
         "mutex.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     deps = [
         ":die",
         ":type_traits",
diff --git a/aos/common/controls/BUILD b/aos/common/controls/BUILD
index 46b5f24..7ca2e60 100644
--- a/aos/common/controls/BUILD
+++ b/aos/common/controls/BUILD
@@ -78,6 +78,9 @@
     srcs = [
         "control_loops.q",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
 )
 
 cc_library(
diff --git a/aos/common/libc/BUILD b/aos/common/libc/BUILD
index e2a87cb..74a4c70 100644
--- a/aos/common/libc/BUILD
+++ b/aos/common/libc/BUILD
@@ -1,68 +1,71 @@
-package(default_visibility = ['//visibility:public'])
+package(default_visibility = ["//visibility:public"])
 
 cc_library(
-  name = 'aos_strsignal',
-  srcs = [
-    'aos_strsignal.cc',
-  ],
-  hdrs = [
-    'aos_strsignal.h',
-  ],
-  deps = [
-    '//aos/common/logging',
-  ],
+    name = "aos_strsignal",
+    srcs = [
+        "aos_strsignal.cc",
+    ],
+    hdrs = [
+        "aos_strsignal.h",
+    ],
+    deps = [
+        "//aos/common/logging",
+    ],
 )
 
 cc_test(
-  name = 'aos_strsignal_test',
-  srcs = [
-    'aos_strsignal_test.cc',
-  ],
-  deps = [
-    ':aos_strsignal',
-    '//aos/testing:googletest',
-    '//aos/common/logging',
-  ],
+    name = "aos_strsignal_test",
+    srcs = [
+        "aos_strsignal_test.cc",
+    ],
+    deps = [
+        ":aos_strsignal",
+        "//aos/common/logging",
+        "//aos/testing:googletest",
+    ],
 )
 
 cc_library(
-  name = 'dirname',
-  srcs = [
-    'dirname.cc',
-  ],
-  hdrs = [
-    'dirname.h',
-  ],
+    name = "dirname",
+    srcs = [
+        "dirname.cc",
+    ],
+    hdrs = [
+        "dirname.h",
+    ],
 )
 
 cc_test(
-  name = 'dirname_test',
-  srcs = [
-    'dirname_test.cc',
-  ],
-  deps = [
-    ':dirname',
-    '//aos/testing:googletest',
-  ],
+    name = "dirname_test",
+    srcs = [
+        "dirname_test.cc",
+    ],
+    deps = [
+        ":dirname",
+        "//aos/testing:googletest",
+    ],
 )
 
 cc_library(
-  name = 'aos_strerror',
-  srcs = [
-    'aos_strerror.cc',
-  ],
-  hdrs = [
-    'aos_strerror.h',
-  ],
+    name = "aos_strerror",
+    srcs = [
+        "aos_strerror.cc",
+    ],
+    hdrs = [
+        "aos_strerror.h",
+    ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
 )
 
 cc_test(
-  name = 'aos_strerror_test',
-  srcs = [
-    'aos_strerror_test.cc',
-  ],
-  deps = [
-    ':aos_strerror',
-    '//aos/testing:googletest',
-  ],
+    name = "aos_strerror_test",
+    srcs = [
+        "aos_strerror_test.cc",
+    ],
+    deps = [
+        ":aos_strerror",
+        "//aos/testing:googletest",
+    ],
 )
diff --git a/aos/common/logging/BUILD b/aos/common/logging/BUILD
index 6d0d956..09e355d 100644
--- a/aos/common/logging/BUILD
+++ b/aos/common/logging/BUILD
@@ -10,6 +10,9 @@
         "interface.h",
         "logging.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     visibility = ["//visibility:public"],
     deps = [
         ":sizes",
@@ -106,6 +109,9 @@
     hdrs = [
         "sizes.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
 )
 
 cc_test(
@@ -128,6 +134,9 @@
     hdrs = [
         "queue_logging.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     visibility = ["//visibility:public"],
     deps = [
         ":logging",
@@ -161,6 +170,9 @@
     hdrs = [
         "printf_formats.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     visibility = ["//visibility:public"],
     deps = [
         "//aos/common:macros",
@@ -175,6 +187,9 @@
     hdrs = [
         "implementations.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     linkopts = [
         "-lpthread",
     ],
diff --git a/aos/common/network/BUILD b/aos/common/network/BUILD
index c5476b2..470969f 100644
--- a/aos/common/network/BUILD
+++ b/aos/common/network/BUILD
@@ -1,49 +1,51 @@
-package(default_visibility = ['//visibility:public'])
+package(default_visibility = ["//visibility:public"])
 
 cc_library(
-  name = 'team_number',
-  srcs = [
-    'team_number.cc',
-  ],
-  hdrs = [
-    'team_number.h',
-  ],
-  deps = [
-    '//aos/linux_code:configuration',
-    '//aos:once',
-    '//aos/common/logging',
-    '//aos/common/util:string_to_num',
-  ],
+    name = "team_number",
+    srcs = [
+        "team_number.cc",
+    ],
+    hdrs = [
+        "team_number.h",
+    ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        "//aos:once",
+        "//aos/common/logging",
+        "//aos/common/util:string_to_num",
+        "//aos/linux_code:configuration",
+    ],
 )
 
 cc_library(
-  name = 'socket',
-  srcs = [
-    'receive_socket.cc',
-    'send_socket.cc',
-    'socket.cc',
-  ],
-  hdrs = [
-    'receive_socket.h',
-    'send_socket.h',
-    'socket.h',
-  ],
-  deps = [
-    '//aos/common/logging',
-    '//aos/common:time',
-    '//aos/common/util:inet_addr',
-    '//aos/linux_code:configuration',
-  ],
+    name = "socket",
+    srcs = [
+        "receive_socket.cc",
+        "send_socket.cc",
+        "socket.cc",
+    ],
+    hdrs = [
+        "receive_socket.h",
+        "send_socket.h",
+        "socket.h",
+    ],
+    deps = [
+        "//aos/common:time",
+        "//aos/common/logging",
+        "//aos/common/util:inet_addr",
+        "//aos/linux_code:configuration",
+    ],
 )
 
 cc_test(
-  name = 'team_number_test',
-  srcs = [
-    'team_number_test.cc',
-  ],
-  deps = [
-    ':team_number',
-    '//aos/testing:googletest',
-  ],
+    name = "team_number_test",
+    srcs = [
+        "team_number_test.cc",
+    ],
+    deps = [
+        ":team_number",
+        "//aos/testing:googletest",
+    ],
 )
-
diff --git a/aos/common/util/BUILD b/aos/common/util/BUILD
index 8fcd2fe..0f2ca73 100644
--- a/aos/common/util/BUILD
+++ b/aos/common/util/BUILD
@@ -90,6 +90,9 @@
     hdrs = [
         "string_to_num.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
 )
 
 cc_test(
@@ -172,6 +175,9 @@
     hdrs = [
         "options.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
 )
 
 cc_test(
@@ -190,6 +196,9 @@
     hdrs = [
         "compiler_memory_barrier.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
 )
 
 cc_library(
diff --git a/aos/downloader/downloader.bzl b/aos/downloader/downloader.bzl
index 3fb2fc8..139401a 100644
--- a/aos/downloader/downloader.bzl
+++ b/aos/downloader/downloader.bzl
@@ -31,6 +31,7 @@
   return struct(
     runfiles = ctx.runfiles(
       files = to_download + ctx.files._downloader,
+      transitive_files = ctx.attr._downloader.default_runfiles.files,
       collect_data = True,
       collect_default = True,
     ),
@@ -43,7 +44,7 @@
     downloader_srcs = ctx.files.srcs
   )
 
-'''Creates a binary which downloads code to a robot.
+"""Creates a binary which downloads code to a robot.
 
 Running this with `bazel run` will actually download everything.
 
@@ -55,41 +56,42 @@
   start_srcs: Like srcs, except they also get put into start_list.txt.
   default_target: The default host to download to. If not specified, defaults to
                   roboRIO-971.local.
-'''
+"""
+
 aos_downloader = rule(
-  implementation = _aos_downloader_impl,
-  attrs = {
-    '_downloader': attr.label(
-      executable = True,
-      cfg = 'host',
-      default = Label('//aos/downloader'),
-    ),
-    'start_srcs': attr.label_list(
-      mandatory = True,
-      allow_files = True,
-    ),
-    'srcs': attr.label_list(
-      mandatory = True,
-      allow_files = True,
-    ),
-    'dirs': attr.label_list(
-      mandatory = False,
-      providers = [
-        'downloader_dir',
-        'downloader_srcs',
-      ]
-    ),
-    'default_target': attr.string(
-      default = 'roboRIO-971-frc.local',
-    ),
-  },
-  executable = True,
-  outputs = {
-    '_startlist': '%{name}.start_list.dir/start_list.txt',
-  },
+    attrs = {
+        "_downloader": attr.label(
+            executable = True,
+            cfg = "host",
+            default = Label("//aos/downloader"),
+        ),
+        "start_srcs": attr.label_list(
+            mandatory = True,
+            allow_files = True,
+        ),
+        "srcs": attr.label_list(
+            mandatory = True,
+            allow_files = True,
+        ),
+        "dirs": attr.label_list(
+            mandatory = False,
+            providers = [
+                "downloader_dir",
+                "downloader_srcs",
+            ],
+        ),
+        "default_target": attr.string(
+            default = "roboRIO-971-frc.local",
+        ),
+    },
+    executable = True,
+    outputs = {
+        "_startlist": "%{name}.start_list.dir/start_list.txt",
+    },
+    implementation = _aos_downloader_impl,
 )
 
-'''Downloads files to a specific directory.
+"""Downloads files to a specific directory.
 
 This rule does nothing by itself. Use it by adding to the dirs attribute of an
 aos_downloader rule.
@@ -98,16 +100,17 @@
   srcs: The files to download. They all go in the same directory.
   dir: The directory (relative to the standard download directory) to put all
        the files in.
-'''
+"""
+
 aos_downloader_dir = rule(
-  implementation = _aos_downloader_dir_impl,
-  attrs = {
-    'srcs': attr.label_list(
-      mandatory = True,
-      allow_files = True,
-    ),
-    'dir': attr.string(
-       mandatory = True,
-    ),
-  },
+    attrs = {
+        "srcs": attr.label_list(
+            mandatory = True,
+            allow_files = True,
+        ),
+        "dir": attr.string(
+            mandatory = True,
+        ),
+    },
+    implementation = _aos_downloader_dir_impl,
 )
diff --git a/aos/linux_code/BUILD b/aos/linux_code/BUILD
index 3884130..b572a25 100644
--- a/aos/linux_code/BUILD
+++ b/aos/linux_code/BUILD
@@ -17,6 +17,9 @@
     hdrs = [
         "queue-tmpl.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     visibility = ["//aos/common:__pkg__"],
 )
 
@@ -28,6 +31,9 @@
     hdrs = [
         "complex_thread_local.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     linkopts = [
         "-lpthread",
     ],
@@ -58,6 +64,9 @@
     hdrs = [
         "init.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     deps = [
         "//aos/common:die",
         "//aos/common/logging:implementations",
@@ -73,6 +82,9 @@
     hdrs = [
         "configuration.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     deps = [
         "//aos:once",
         "//aos/common:unique_malloc_ptr",
diff --git a/aos/linux_code/ipc_lib/BUILD b/aos/linux_code/ipc_lib/BUILD
index d5d2c8d..289bde8 100644
--- a/aos/linux_code/ipc_lib/BUILD
+++ b/aos/linux_code/ipc_lib/BUILD
@@ -8,6 +8,9 @@
     hdrs = [
         "aos_sync.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     linkopts = [
         "-lpthread",
     ],
@@ -27,6 +30,9 @@
     hdrs = [
         "core_lib.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     deps = [
         ":aos_sync",
         ":shared_mem_types",
@@ -41,6 +47,9 @@
     hdrs = [
         "shared_mem.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     linkopts = [
         "-lrt",
     ],
@@ -59,6 +68,9 @@
     hdrs = [
         "shared_mem_types.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     deps = [
         ":aos_sync",
     ],
@@ -72,6 +84,9 @@
     hdrs = [
         "queue.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     linkopts = [
         "-lrt",
     ],
@@ -109,6 +124,9 @@
     srcs = [
         "ipc_stress_test.cc",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     tags = [
         "manual",
     ],
diff --git a/aos/testing/BUILD b/aos/testing/BUILD
index 4f2fc83..93cd4bb 100644
--- a/aos/testing/BUILD
+++ b/aos/testing/BUILD
@@ -1,86 +1,89 @@
 cc_library(
-  name = 'googletest',
-  visibility = ['//visibility:public'],
-  srcs = [
-    'gtest_main.cc',
-  ],
-  deps = [
-    '//third_party/googletest',
-  ],
-  testonly = True,
+    name = "googletest",
+    testonly = True,
+    srcs = [
+        "gtest_main.cc",
+    ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    visibility = ["//visibility:public"],
+    deps = [
+        "//third_party/googletest",
+    ],
 )
 
 cc_library(
-  name = 'test_logging',
-  visibility = ['//visibility:public'],
-  srcs = [
-    'test_logging.cc',
-  ],
-  hdrs = [
-    'test_logging.h',
-  ],
-  deps = [
-    ':googletest',
-    '//aos/common/logging:implementations',
-    '//aos:once',
-    '//aos/common:mutex',
-  ],
-  testonly = True,
+    name = "test_logging",
+    testonly = True,
+    srcs = [
+        "test_logging.cc",
+    ],
+    hdrs = [
+        "test_logging.h",
+    ],
+    visibility = ["//visibility:public"],
+    deps = [
+        ":googletest",
+        "//aos:once",
+        "//aos/common:mutex",
+        "//aos/common/logging:implementations",
+    ],
 )
 
 cc_test(
-  name = 'test_logging_test',
-  srcs = [
-    'test_logging_test.cc',
-  ],
-  deps = [
-    ':googletest',
-    ':test_logging',
-    '//aos/common/logging',
-  ],
+    name = "test_logging_test",
+    srcs = [
+        "test_logging_test.cc",
+    ],
+    deps = [
+        ":googletest",
+        ":test_logging",
+        "//aos/common/logging",
+    ],
 )
 
 cc_library(
-  name = 'prevent_exit',
-  visibility = ['//visibility:public'],
-  srcs = [
-    'prevent_exit.cc',
-  ],
-  hdrs = [
-    'prevent_exit.h',
-  ],
-  deps = [
-    '//aos/common/logging',
-  ],
-  testonly = True,
+    name = "prevent_exit",
+    testonly = True,
+    srcs = [
+        "prevent_exit.cc",
+    ],
+    hdrs = [
+        "prevent_exit.h",
+    ],
+    visibility = ["//visibility:public"],
+    deps = [
+        "//aos/common/logging",
+    ],
 )
 
 cc_library(
-  name = 'test_shm',
-  visibility = ['//visibility:public'],
-  srcs = [
-    'test_shm.cc',
-  ],
-  hdrs = [
-    'test_shm.h',
-  ],
-  deps = [
-    '//aos/common:queues',
-    '//aos/linux_code/ipc_lib:shared_mem',
-    '//aos/common/logging',
-    ':test_logging',
-  ],
-  testonly = True,
+    name = "test_shm",
+    testonly = True,
+    srcs = [
+        "test_shm.cc",
+    ],
+    hdrs = [
+        "test_shm.h",
+    ],
+    visibility = ["//visibility:public"],
+    deps = [
+        ":test_logging",
+        "//aos/common:queues",
+        "//aos/common/logging",
+        "//aos/linux_code/ipc_lib:shared_mem",
+    ],
 )
 
 cc_library(
-  name = 'random_seed',
-  visibility = ['//visibility:public'],
-  srcs = [
-    'random_seed.cc',
-  ],
-  hdrs = [
-    'random_seed.h',
-  ],
-  testonly = True,
+    name = "random_seed",
+    testonly = True,
+    srcs = [
+        "random_seed.cc",
+    ],
+    hdrs = [
+        "random_seed.h",
+    ],
+    visibility = ["//visibility:public"],
 )
diff --git a/aos/vision/blob/BUILD b/aos/vision/blob/BUILD
index d7a39ad..e1255c8 100644
--- a/aos/vision/blob/BUILD
+++ b/aos/vision/blob/BUILD
@@ -1,144 +1,187 @@
-load('//tools/build_rules:gtk_dependent.bzl', 'gtk_dependent_cc_binary', 'gtk_dependent_cc_library')
-package(default_visibility = ['//visibility:public'])
+load("//tools/build_rules:gtk_dependent.bzl", "gtk_dependent_cc_binary", "gtk_dependent_cc_library")
+
+package(default_visibility = ["//visibility:public"])
 
 cc_library(
-  name = 'range_image',
-  hdrs = ['range_image.h'],
-  srcs = ['range_image.cc'],
-  deps = [
-    '//aos/vision/math:vector',
-    '//aos/vision/debug:overlay',
-    '//aos/vision/math:segment',
-    '//aos/vision/image:image_types',
-    '//third_party/eigen',
-  ],
+    name = "range_image",
+    srcs = ["range_image.cc"],
+    hdrs = ["range_image.h"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        "//aos/vision/debug:overlay",
+        "//aos/vision/image:image_types",
+        "//aos/vision/math:segment",
+        "//aos/vision/math:vector",
+        "//third_party/eigen",
+    ],
 )
 
 cc_library(
-  name = 'region_alloc',
-  hdrs = ['region_alloc.h'],
-  deps = [
-    '//aos/common/logging',
-  ],
+    name = "region_alloc",
+    hdrs = ["region_alloc.h"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        "//aos/common/logging",
+    ],
 )
 
 cc_library(
-  name = 'contour',
-  hdrs = ['contour.h'],
-  srcs = ['contour.cc'],
-  deps = [
-    '//aos/vision/debug:overlay',
-    '//aos/vision/math:segment',
-    ':range_image',
-    ':region_alloc',
-  ],
+    name = "contour",
+    srcs = ["contour.cc"],
+    hdrs = ["contour.h"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        ":range_image",
+        ":region_alloc",
+        "//aos/vision/debug:overlay",
+        "//aos/vision/math:segment",
+    ],
 )
 
 cc_library(
-  name = 'threshold',
-  hdrs = ['threshold.h'],
-  deps = [
-    ':range_image',
-    '//aos/vision/image:image_types',
-  ]
+    name = "threshold",
+    hdrs = ["threshold.h"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        ":range_image",
+        "//aos/vision/image:image_types",
+    ],
 )
 
 cc_library(
-  name = 'hierarchical_contour_merge',
-  hdrs = ['hierarchical_contour_merge.h'],
-  srcs = ['hierarchical_contour_merge.cc'],
-  deps = [
-    ':contour',
-    ':disjoint_set',
-    ':range_image',
-    '//third_party/eigen',
-  ],
-  restricted_to = ['//tools:k8', '//tools:armhf-debian'],
+    name = "hierarchical_contour_merge",
+    srcs = ["hierarchical_contour_merge.cc"],
+    hdrs = ["hierarchical_contour_merge.h"],
+    restricted_to = [
+        "//tools:k8",
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        ":contour",
+        ":disjoint_set",
+        ":range_image",
+        "//third_party/eigen",
+    ],
 )
 
 cc_library(
-  name = 'disjoint_set',
-  hdrs = ['disjoint_set.h'],
+    name = "disjoint_set",
+    hdrs = ["disjoint_set.h"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
 )
 
 cc_library(
-  name = 'find_blob',
-  hdrs = ['find_blob.h'],
-  srcs = ['find_blob.cc'],
-  deps = [
-    '//aos/vision/debug:overlay',
-    '//aos/vision/math:segment',
-    ':disjoint_set',
-    ':range_image',
-    '//third_party/eigen',
-  ]
+    name = "find_blob",
+    srcs = ["find_blob.cc"],
+    hdrs = ["find_blob.h"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        ":disjoint_set",
+        ":range_image",
+        "//aos/vision/debug:overlay",
+        "//aos/vision/math:segment",
+        "//third_party/eigen",
+    ],
 )
 
 cc_library(
-  name = 'codec',
-  hdrs = ['codec.h'],
-  srcs = ['codec.cc'],
-  deps = [
-    '//aos/vision/debug:overlay',
-    '//aos/vision/math:segment',
-    ':range_image',
-    '//third_party/eigen',
-  ],
+    name = "codec",
+    srcs = ["codec.cc"],
+    hdrs = ["codec.h"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        ":range_image",
+        "//aos/vision/debug:overlay",
+        "//aos/vision/math:segment",
+        "//third_party/eigen",
+    ],
 )
 
 cc_test(
-  name = 'codec_test',
-  srcs = ['codec_test.cc'],
-  deps = [
-    ':codec',
-    '//aos/testing:googletest',
-  ],
+    name = "codec_test",
+    srcs = ["codec_test.cc"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        ":codec",
+        "//aos/testing:googletest",
+    ],
 )
 
 cc_library(
-  name = 'move_scale',
-  hdrs = ['move_scale.h'],
-  srcs = ['move_scale.cc'],
-  deps = [
-    ':range_image',
-    '//aos/vision/image:image_types',
-  ],
+    name = "move_scale",
+    srcs = ["move_scale.cc"],
+    hdrs = ["move_scale.h"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        ":range_image",
+        "//aos/vision/image:image_types",
+    ],
 )
 
 cc_library(
-  name = 'test_utils',
-  hdrs = ['test_utils.h'],
-  srcs = ['test_utils.cc'],
-  deps = [
-    ':range_image',
-  ],
+    name = "test_utils",
+    srcs = ["test_utils.cc"],
+    hdrs = ["test_utils.h"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        ":range_image",
+    ],
 )
 
 cc_library(
-  name = 'transpose',
-  hdrs = ['transpose.h'],
-  srcs = ['transpose.cc'],
-  deps = [
-    ':range_image',
-  ],
+    name = "transpose",
+    srcs = ["transpose.cc"],
+    hdrs = ["transpose.h"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        ":range_image",
+    ],
 )
 
 cc_test(
-  name = 'transpose_test',
-  srcs = ['transpose_test.cc'],
-  deps = [
-    ':transpose',
-    ':test_utils',
-    '//aos/testing:googletest',
-  ],
+    name = "transpose_test",
+    srcs = ["transpose_test.cc"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        ":test_utils",
+        ":transpose",
+        "//aos/testing:googletest",
+    ],
 )
 
 gtk_dependent_cc_library(
-  name = 'stream_view',
-  hdrs = ['stream_view.h'],
-  deps = [
-    ':range_image',
-    '//aos/vision/debug:debug_window',
-    '//aos/vision/image:image_types',
-  ],
+    name = "stream_view",
+    hdrs = ["stream_view.h"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        ":range_image",
+        "//aos/vision/debug:debug_window",
+        "//aos/vision/image:image_types",
+    ],
 )
diff --git a/aos/vision/debug/BUILD b/aos/vision/debug/BUILD
index ed26c69..06f5d0b 100644
--- a/aos/vision/debug/BUILD
+++ b/aos/vision/debug/BUILD
@@ -1,51 +1,62 @@
-load('//tools/build_rules:gtk_dependent.bzl', 'gtk_dependent_cc_binary', 'gtk_dependent_cc_library')
+load("//tools/build_rules:gtk_dependent.bzl", "gtk_dependent_cc_binary", "gtk_dependent_cc_library")
+
 package(default_visibility = ["//visibility:public"])
 
 cc_library(
     name = "overlay",
     hdrs = ["overlay.h"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     deps = [
-        '//aos/vision/math:vector',
-        '//aos/vision/math:segment',
-        '//aos/vision/image:image_types',
-        ],
-)
-
-gtk_dependent_cc_library(name = "debug_window",
-    srcs = ["debug_window.cc"],
-    hdrs = ["debug_window.h"],
-    deps = [
-        '@usr_repo//:gtk+-3.0',
         "//aos/vision/image:image_types",
-        ":overlay",
-    ]
+        "//aos/vision/math:segment",
+        "//aos/vision/math:vector",
+    ],
 )
 
 gtk_dependent_cc_library(
-  name = 'debug_framework',
-  srcs = [
-    'debug_framework.cc',
-    'jpeg_list-source.cc',
-    'tcp-source.cc',
-    'blob_log-source.cc',
-    'camera-source.cc'
-  ],
-  hdrs = ['debug_framework.h'],
-  deps = [
-    '//aos/common/logging:logging',
-    '//aos/common/logging:implementations',
-    '//aos/vision/blob:codec',
-    '//aos/vision/blob:range_image',
-    '//aos/vision/blob:stream_view',
-    '//aos/vision/blob:find_blob',
-    '//aos/vision/events:gtk_event',
-    '//aos/vision/events:epoll_events',
-    "//aos/vision/events:tcp_client",
-    '//aos/vision/image:jpeg_routines',
-    '//aos/vision/image:image_stream',
-    '//aos/vision/image:image_types',
-    '//aos/common/util:global_factory',
-    '@usr_repo//:gtk+-3.0',
-  ],
-  alwayslink = 1,
+    name = "debug_window",
+    srcs = ["debug_window.cc"],
+    hdrs = ["debug_window.h"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        ":overlay",
+        "//aos/vision/image:image_types",
+        "@usr_repo//:gtk+-3.0",
+    ],
+)
+
+gtk_dependent_cc_library(
+    name = "debug_framework",
+    srcs = [
+        "blob_log-source.cc",
+        "camera-source.cc",
+        "debug_framework.cc",
+        "jpeg_list-source.cc",
+        "tcp-source.cc",
+    ],
+    hdrs = ["debug_framework.h"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        "//aos/common/logging",
+        "//aos/common/logging:implementations",
+        "//aos/common/util:global_factory",
+        "//aos/vision/blob:codec",
+        "//aos/vision/blob:find_blob",
+        "//aos/vision/blob:range_image",
+        "//aos/vision/blob:stream_view",
+        "//aos/vision/events:epoll_events",
+        "//aos/vision/events:gtk_event",
+        "//aos/vision/events:tcp_client",
+        "//aos/vision/image:image_stream",
+        "//aos/vision/image:image_types",
+        "//aos/vision/image:jpeg_routines",
+        "@usr_repo//:gtk+-3.0",
+    ],
+    alwayslink = 1,
 )
diff --git a/aos/vision/events/BUILD b/aos/vision/events/BUILD
index 495c50a..b3affc2 100644
--- a/aos/vision/events/BUILD
+++ b/aos/vision/events/BUILD
@@ -1,70 +1,98 @@
-load('//tools/build_rules:gtk_dependent.bzl', 'gtk_dependent_cc_binary', 'gtk_dependent_cc_library')
-package(default_visibility = ['//visibility:public'])
+load("//tools/build_rules:gtk_dependent.bzl", "gtk_dependent_cc_binary", "gtk_dependent_cc_library")
+
+package(default_visibility = ["//visibility:public"])
 
 cc_library(
-  name = 'epoll_events',
-  srcs = ['epoll_events.cc'],
-  hdrs = ['epoll_events.h'],
-  deps = [
-    '//aos/common:scoped_fd',
-    '//aos/common/logging',
-    '//aos/common:time',
-  ],
+    name = "epoll_events",
+    srcs = ["epoll_events.cc"],
+    hdrs = ["epoll_events.h"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        "//aos/common:scoped_fd",
+        "//aos/common:time",
+        "//aos/common/logging",
+    ],
 )
 
 cc_library(
-  name = 'socket_types',
-  hdrs = ['socket_types.h'],
-  deps = [
-    '//aos/vision/events:tcp_server',
-    '//aos/vision/image:image_types',
-    '//third_party/protobuf:protobuf',
-  ],
+    name = "socket_types",
+    hdrs = ["socket_types.h"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        "//aos/vision/events:tcp_server",
+        "//aos/vision/image:image_types",
+        "//third_party/protobuf",
+    ],
 )
 
 cc_library(
-  name = 'intrusive_free_list',
-  hdrs = ['intrusive_free_list.h'],
+    name = "intrusive_free_list",
+    hdrs = ["intrusive_free_list.h"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
 )
 
 cc_library(
-  name = 'tcp_server',
-  srcs = ['tcp_server.cc'],
-  hdrs = ['tcp_server.h'],
-  deps = [':epoll_events', ':intrusive_free_list'],
+    name = "tcp_server",
+    srcs = ["tcp_server.cc"],
+    hdrs = ["tcp_server.h"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        ":epoll_events",
+        ":intrusive_free_list",
+    ],
 )
 
 cc_library(
-  name = 'tcp_client',
-  srcs = ['tcp_client.cc'],
-  hdrs = ['tcp_client.h'],
-  deps = [':epoll_events'],
+    name = "tcp_client",
+    srcs = ["tcp_client.cc"],
+    hdrs = ["tcp_client.h"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [":epoll_events"],
 )
 
 cc_library(
-  name = 'udp',
-  srcs = ['udp.cc'],
-  hdrs = ['udp.h'],
-  deps = [
-    '//aos/common:macros',
-    '//aos/common:scoped_fd',
-  ],
+    name = "udp",
+    srcs = ["udp.cc"],
+    hdrs = ["udp.h"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        "//aos/common:macros",
+        "//aos/common:scoped_fd",
+    ],
 )
 
 cc_test(
-  name = 'udp_test',
-  srcs = ['udp_test.cc'],
-  deps = [
-    ':udp',
-    '//aos/testing:googletest',
-  ],
+    name = "udp_test",
+    srcs = ["udp_test.cc"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        ":udp",
+        "//aos/testing:googletest",
+    ],
 )
 
 gtk_dependent_cc_library(
-  name = 'gtk_event',
-  srcs = ['gtk_event.cc'],
-  deps = [
-    ':epoll_events',
-    '@usr_repo//:gtk+-3.0',
-  ],
+    name = "gtk_event",
+    srcs = ["gtk_event.cc"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        ":epoll_events",
+        "@usr_repo//:gtk+-3.0",
+    ],
 )
diff --git a/aos/vision/image/BUILD b/aos/vision/image/BUILD
index e41aabc..8409ea5 100644
--- a/aos/vision/image/BUILD
+++ b/aos/vision/image/BUILD
@@ -1,46 +1,66 @@
-package(default_visibility = ['//visibility:public'])
-load('//tools/build_rules:protobuf.bzl', 'proto_cc_library')
+package(default_visibility = ["//visibility:public"])
+
+load("//tools/build_rules:protobuf.bzl", "proto_cc_library")
 
 cc_library(
-  name = 'image_types',
-  hdrs = ['image_types.h'],
-  deps = [
-    '//aos/common/logging:logging',
-  ],
+    name = "image_types",
+    hdrs = ["image_types.h"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        "//aos/common/logging",
+    ],
 )
 
 proto_cc_library(
-  name = 'camera_params',
-  src = 'camera_params.proto',
+    name = "camera_params",
+    src = "camera_params.proto",
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
 )
 
 cc_library(
-  name = 'reader',
-  srcs = ['reader.cc'],
-  hdrs = ['V4L2.h', 'reader.h'],
-  deps = [
-    '//aos/common:time',
-    '//aos/common/logging:logging',
-    ':image_types',
-    ':camera_params',
-  ],
+    name = "reader",
+    srcs = ["reader.cc"],
+    hdrs = [
+        "V4L2.h",
+        "reader.h",
+    ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        ":camera_params",
+        ":image_types",
+        "//aos/common:time",
+        "//aos/common/logging",
+    ],
 )
 
 cc_library(
-  name = 'jpeg_routines',
-  srcs = ['jpeg_routines.cc'],
-  hdrs = ['jpeg_routines.h'],
-  deps = [
-    '//third_party/libjpeg',
-    '//aos/common/logging:logging',
-    ':image_types'
-  ],
+    name = "jpeg_routines",
+    srcs = ["jpeg_routines.cc"],
+    hdrs = ["jpeg_routines.h"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        ":image_types",
+        "//aos/common/logging",
+        "//third_party/libjpeg",
+    ],
 )
 
-cc_library(name = 'image_stream',
-  hdrs = ['image_stream.h'],
-  deps = [
-    '//aos/vision/events:epoll_events',
-    '//aos/vision/image:reader'
-  ]
+cc_library(
+    name = "image_stream",
+    hdrs = ["image_stream.h"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        "//aos/vision/events:epoll_events",
+        "//aos/vision/image:reader",
+    ],
 )
diff --git a/aos/vision/math/BUILD b/aos/vision/math/BUILD
index fe4927b..1de8436 100644
--- a/aos/vision/math/BUILD
+++ b/aos/vision/math/BUILD
@@ -1,29 +1,38 @@
-package(default_visibility = ['//visibility:public'])
+package(default_visibility = ["//visibility:public"])
 
 cc_library(
-  name = 'segment',
-  hdrs = ['segment.h'],
-  deps = [':vector'],
+    name = "segment",
+    hdrs = ["segment.h"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [":vector"],
 )
 
 cc_library(
-  name = 'vector',
-  hdrs = [
-    'vector.h',
-  ],
-  deps = [
-    '//third_party/eigen',
-  ],
+    name = "vector",
+    hdrs = [
+        "vector.h",
+    ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        "//third_party/eigen",
+    ],
 )
 
 cc_test(
-  name = 'vector_test',
-  srcs = [
-    'vector_test.cc',
-  ],
-  deps = [
-    ':vector',
-    '//aos/testing:googletest',
-  ],
-  size = 'small',
+    name = "vector_test",
+    size = "small",
+    srcs = [
+        "vector_test.cc",
+    ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        ":vector",
+        "//aos/testing:googletest",
+    ],
 )
diff --git a/compilers/linaro_linux_gcc_4.9.BUILD b/compilers/linaro_linux_gcc_4.9.BUILD
index 52748d5..db2e9bb 100644
--- a/compilers/linaro_linux_gcc_4.9.BUILD
+++ b/compilers/linaro_linux_gcc_4.9.BUILD
@@ -1,114 +1,81 @@
-package(default_visibility = ['//visibility:public'])
+package(default_visibility = ["//visibility:public"])
 
 filegroup(
-  name = 'gcc',
-  srcs = [
-    'bin/arm-linux-gnueabihf-gcc',
-  ],
+    name = "gcc",
+    srcs = [
+        "bin/arm-linux-gnueabihf-gcc",
+    ],
 )
 
 filegroup(
-  name = 'ar',
-  srcs = [
-    'bin/arm-linux-gnueabihf-ar',
-  ],
+    name = "ar",
+    srcs = [
+        "bin/arm-linux-gnueabihf-ar",
+    ],
 )
 
 filegroup(
-  name = 'ld',
-  srcs = [
-    'bin/arm-linux-gnueabihf-ld',
-  ],
+    name = "ld",
+    srcs = [
+        "bin/arm-linux-gnueabihf-ld",
+    ],
 )
 
 filegroup(
-  name = 'nm',
-  srcs = [
-    'bin/arm-linux-gnueabihf-nm',
-  ],
+    name = "nm",
+    srcs = [
+        "bin/arm-linux-gnueabihf-nm",
+    ],
 )
 
 filegroup(
-  name = 'objcopy',
-  srcs = [
-    'bin/arm-linux-gnueabihf-objcopy',
-  ],
+    name = "objcopy",
+    srcs = [
+        "bin/arm-linux-gnueabihf-objcopy",
+    ],
 )
 
 filegroup(
-  name = 'objdump',
-  srcs = [
-    'bin/arm-linux-gnueabihf-objdump',
-  ],
+    name = "objdump",
+    srcs = [
+        "bin/arm-linux-gnueabihf-objdump",
+    ],
 )
 
 filegroup(
-  name = 'strip',
-  srcs = [
-    'bin/arm-linux-gnueabihf-strip',
-  ],
+    name = "strip",
+    srcs = [
+        "bin/arm-linux-gnueabihf-strip",
+    ],
 )
 
 filegroup(
-  name = 'as',
-  srcs = [
-    'bin/arm-linux-gnueabihf-as',
-  ],
-)
-
-cc_library(
-  name = 'librt',
-  srcs = [
-    'arm-linux-gnueabihf/libc/usr/lib/librt.so',
-  ],
-)
-
-cc_library(
-  name = 'libdl',
-  srcs = [
-    'arm-linux-gnueabihf/libc/usr/lib/libdl.so',
-  ],
-)
-
-cc_library(
-  name = 'libm',
-  srcs = [
-    'arm-linux-gnueabihf/libc/usr/lib/libm.so',
-  ],
-)
-
-cc_library(
-  name = 'libpthread',
-  deps = [
-    '@//tools/cpp/linaro_linux_gcc:libpthread',
-  ],
+    name = "as",
+    srcs = [
+        "bin/arm-linux-gnueabihf-as",
+    ],
 )
 
 filegroup(
-  name = 'compiler_pieces',
-  srcs = glob([
-    'arm-linux-gnueabihf/**',
-    'libexec/**',
-    'lib/gcc/arm-linux-gnueabihf/**',
-    'include/**',
-  ],
-  exclude=[
-    # Exclude empty files so Bazel's caching works.
-    # TODO(Brian): remove this once the Bazel bug is fixed.
-    '**/.install',
-  ]),
+    name = "compiler_pieces",
+    srcs = glob([
+        "arm-linux-gnueabihf/**",
+        "libexec/**",
+        "lib/gcc/arm-linux-gnueabihf/**",
+        "include/**",
+    ]),
 )
 
 filegroup(
-  name = 'compiler_components',
-  srcs = [
-    ':gcc',
-    ':ar',
-    ':ld',
-    ':nm',
-    ':objcopy',
-    ':objdump',
-    ':strip',
-    ':as',
-  ],
+    name = "compiler_components",
+    srcs = [
+        ":ar",
+        ":as",
+        ":gcc",
+        ":ld",
+        ":nm",
+        ":objcopy",
+        ":objdump",
+        ":strip",
+    ],
 )
diff --git a/debian/clapack.BUILD b/debian/clapack.BUILD
index 9648bab..8d805c3 100644
--- a/debian/clapack.BUILD
+++ b/debian/clapack.BUILD
@@ -1,6 +1,7 @@
 licenses(["notice"])
 
 load("@//tools/build_rules:fortran.bzl", "f2c_copts")
+load("@//tools/build_rules:select.bzl", "compiler_select")
 
 genrule(
     name = "create_sysdep1",
@@ -280,7 +281,6 @@
         "-Wno-sign-compare",
         "-Wno-cast-qual",
         "-Wno-cast-align",
-        "-Wno-self-assign",
 
         # Some files don't #include system headers when they should. sysdep1.h
         # messes with feature test macros, so it always has to come first.
@@ -292,7 +292,14 @@
         # Don't mangle the names of all the BLAS symbols, because slicot needs to
         # call them directly.
         "-DNO_BLAS_WRAP",
-    ],
+    ] + compiler_select({
+        "clang": [
+            "-Wno-self-assign",
+        ],
+        "gcc": [
+            "-Wno-discarded-qualifiers",
+        ],
+    }),
     includes = [
         "F2CLIBS/libf2c",
         "INCLUDE",
diff --git a/debian/slycot.BUILD b/debian/slycot.BUILD
index 368b87d..7463173 100644
--- a/debian/slycot.BUILD
+++ b/debian/slycot.BUILD
@@ -2,6 +2,7 @@
 licenses(["restricted"])
 
 load("@//tools/build_rules:fortran.bzl", "f2c_library")
+load("@//tools/build_rules:select.bzl", "compiler_select")
 
 # We can't create _wrapper.so in the slycot folder, and can't move it.
 # The best way I found to do this is to modify _wrapper.pyf to instead generate
@@ -135,7 +136,13 @@
         # This gets triggered because it doesn't realize xerbla doesn't return.
         # TODO(Brian): Try and get __attribute__((noreturn)) on xerbla somehow.
         "-Wno-uninitialized",
-    ],
+    ] + compiler_select({
+        "clang": [
+        ],
+        "gcc": [
+            "-Wno-discarded-qualifiers",
+        ],
+    }),
     visibility = ["//visibility:public"],
     deps = [
         "@clapack",
diff --git a/frc971/BUILD b/frc971/BUILD
index 563f05e..b9987a4 100644
--- a/frc971/BUILD
+++ b/frc971/BUILD
@@ -7,7 +7,9 @@
     hdrs = [
         "shifter_hall_effect.h",
     ],
-    compatible_with = mcu_cpus,
+    compatible_with = mcu_cpus + [
+        "//tools:armhf-debian",
+    ],
 )
 
 cc_library(
@@ -15,6 +17,9 @@
     hdrs = [
         "constants.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
 )
 
 py_library(
diff --git a/frc971/control_loops/BUILD b/frc971/control_loops/BUILD
index 7c39a85..16673df 100644
--- a/frc971/control_loops/BUILD
+++ b/frc971/control_loops/BUILD
@@ -44,6 +44,9 @@
     srcs = [
         "control_loops.q",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
 )
 
 cc_test(
@@ -142,6 +145,9 @@
     hdrs = [
         "state_feedback_loop.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     deps = [
         "//aos/common:macros",
         "//aos/common/logging",
diff --git a/frc971/control_loops/drivetrain/BUILD b/frc971/control_loops/drivetrain/BUILD
index 90385e0..64d1d9d 100644
--- a/frc971/control_loops/drivetrain/BUILD
+++ b/frc971/control_loops/drivetrain/BUILD
@@ -21,6 +21,9 @@
     srcs = [
         "drivetrain.q",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     deps = [
         "//aos/common/controls:control_loop_queues",
         "//frc971/control_loops:queues",
diff --git a/frc971/control_loops/drivetrain/polydrivetrain.h b/frc971/control_loops/drivetrain/polydrivetrain.h
index d16e8a1..b93c1de 100644
--- a/frc971/control_loops/drivetrain/polydrivetrain.h
+++ b/frc971/control_loops/drivetrain/polydrivetrain.h
@@ -57,10 +57,16 @@
 
   // Returns the current estimated velocity in m/s.
   Scalar velocity() const {
-    return (loop_->mutable_X_hat()(0) + loop_->mutable_X_hat()(1)) / 2.0;
+    return (loop_->mutable_X_hat()(0) + loop_->mutable_X_hat()(1)) * kHalf;
   }
 
  private:
+  static constexpr Scalar kZero = static_cast<Scalar>(0.0);
+  static constexpr Scalar kHalf = static_cast<Scalar>(0.5);
+  static constexpr Scalar kOne = static_cast<Scalar>(1.0);
+  static constexpr Scalar kTwo = static_cast<Scalar>(2.0);
+  static constexpr Scalar kTwelve = static_cast<Scalar>(12.0);
+
   StateFeedbackLoop<7, 2, 4, Scalar> *kf_;
 
   const ::aos::controls::HVPolytope<2, 4, 4, Scalar> U_Poly_;
@@ -127,14 +133,16 @@
     const constants::ShifterHallEffect &hall_effect, Scalar shifter_position,
     Scalar velocity, Gear gear) {
   const Scalar high_gear_speed =
-      velocity / dt_config_.high_gear_ratio / dt_config_.wheel_radius;
+      velocity /
+      static_cast<Scalar>(dt_config_.high_gear_ratio / dt_config_.wheel_radius);
   const Scalar low_gear_speed =
-      velocity / dt_config_.low_gear_ratio / dt_config_.wheel_radius;
+      velocity /
+      static_cast<Scalar>(dt_config_.low_gear_ratio / dt_config_.wheel_radius);
 
-  if (shifter_position < hall_effect.clear_low) {
+  if (shifter_position < static_cast<Scalar>(hall_effect.clear_low)) {
     // We're in low gear, so return speed for that gear.
     return low_gear_speed;
-  } else if (shifter_position > hall_effect.clear_high) {
+  } else if (shifter_position > static_cast<Scalar>(hall_effect.clear_high)) {
     // We're in high gear, so return speed for that gear.
     return high_gear_speed;
   }
@@ -195,11 +203,12 @@
   const bool highgear = goal.highgear;
 
   // Apply a sin function that's scaled to make it feel better.
-  const Scalar angular_range = M_PI_2 * dt_config_.wheel_non_linearity;
+  const Scalar angular_range =
+      static_cast<Scalar>(M_PI_2) * dt_config_.wheel_non_linearity;
 
   wheel_ = sin(angular_range * wheel) / sin(angular_range);
   wheel_ = sin(angular_range * wheel_) / sin(angular_range);
-  wheel_ = 2.0 * wheel - wheel_;
+  wheel_ = kTwo * wheel - wheel_;
   quickturn_ = quickturn;
 
   if (quickturn_) {
@@ -208,12 +217,12 @@
     wheel_ *= dt_config_.wheel_multiplier;
   }
 
-  static const Scalar kThrottleDeadband = 0.05;
+  static constexpr Scalar kThrottleDeadband = static_cast<Scalar>(0.05);
   if (::std::abs(throttle) < kThrottleDeadband) {
     throttle_ = 0;
   } else {
     throttle_ = copysign(
-        (::std::abs(throttle) - kThrottleDeadband) / (1.0 - kThrottleDeadband),
+        (::std::abs(throttle) - kThrottleDeadband) / (kOne - kThrottleDeadband),
         throttle);
   }
 
@@ -252,10 +261,10 @@
   const Scalar high_min_FF_sum = FF_high.col(0).sum();
 
   const Scalar adjusted_ff_voltage =
-      ::aos::Clip(throttle * 12.0 * min_FF_sum / high_min_FF_sum, -12.0, 12.0);
+      ::aos::Clip(throttle * kTwelve * min_FF_sum / high_min_FF_sum, -kTwelve, kTwelve);
   return (adjusted_ff_voltage +
-          ttrust_ * min_K_sum * (loop_->X_hat(0, 0) + loop_->X_hat(1, 0)) /
-              2.0) /
+          ttrust_ * min_K_sum * (loop_->X_hat(0, 0) + loop_->X_hat(1, 0)) *
+              kHalf) /
          (ttrust_ * min_K_sum + min_FF_sum);
 }
 
@@ -278,7 +287,7 @@
   const Scalar high_min_FF_sum = FF_high.col(0).sum();
 
   const Scalar adjusted_ff_voltage =
-      ::aos::Clip(12.0 * min_FF_sum / high_min_FF_sum, -12.0, 12.0);
+      ::aos::Clip(kTwelve * min_FF_sum / high_min_FF_sum, -kTwelve, kTwelve);
   return adjusted_ff_voltage / min_FF_sum;
 }
 
@@ -307,7 +316,7 @@
     // and that the plant is the same on the left and right.
     const Scalar fvel = FilterVelocity(throttle_);
 
-    const Scalar sign_svel = wheel_ * ((fvel > 0.0) ? 1.0 : -1.0);
+    const Scalar sign_svel = wheel_ * ((fvel > kZero) ? kOne : -kOne);
     Scalar steering_velocity;
     if (quickturn_) {
       steering_velocity = wheel_ * MaxVelocity();
@@ -327,7 +336,7 @@
       // K * R = w
       Eigen::Matrix<Scalar, 1, 2> equality_k;
       equality_k << 1 + sign_svel, -(1 - sign_svel);
-      const Scalar equality_w = 0.0;
+      const Scalar equality_w = kZero;
 
       // Construct a constraint on R by manipulating the constraint on U
       ::aos::controls::HVPolytope<2, 4, 4, Scalar> R_poly_hv(
@@ -358,10 +367,10 @@
     }
 
     // Housekeeping: set the shifting logging values to zero, because we're not shifting
-    left_motor_speed_ = 0.0;
-    right_motor_speed_ = 0.0;
-    current_left_velocity_ = 0.0;
-    current_right_velocity_ = 0.0;
+    left_motor_speed_ = kZero;
+    right_motor_speed_ = kZero;
+    current_left_velocity_ = kZero;
+    current_right_velocity_ = kZero;
   } else {
     current_left_velocity_ =
         (position_.left_encoder - last_position_.left_encoder) / dt_config_.dt;
@@ -384,17 +393,17 @@
     R_left(0, 0) = left_motor_speed_;
     R_right(0, 0) = right_motor_speed_;
 
-    const Scalar wiggle =
-        (static_cast<Scalar>((counter_ % 30) / 15) - 0.5) * 8.0;
+    const Scalar wiggle = (static_cast<Scalar>((counter_ % 30) / 15) - kHalf) *
+                          static_cast<Scalar>(8.0);
 
     loop_->mutable_U(0, 0) = ::aos::Clip(
         (R_left / dt_config_.v)(0, 0) + (IsInGear(left_gear_) ? 0 : wiggle),
-        -12.0, 12.0);
+        -kTwelve, kTwelve);
     loop_->mutable_U(1, 0) = ::aos::Clip(
         (R_right / dt_config_.v)(0, 0) + (IsInGear(right_gear_) ? 0 : wiggle),
-        -12.0, 12.0);
+        -kTwelve, kTwelve);
 #ifdef __linux__
-    loop_->mutable_U() *= 12.0 / ::aos::robot_state->voltage_battery;
+    loop_->mutable_U() *= kTwelve / ::aos::robot_state->voltage_battery;
 #endif  // __linux__
   }
 }
diff --git a/motors/seems_reasonable/spring.cc b/motors/seems_reasonable/spring.cc
index 1127aa9..4448b33 100644
--- a/motors/seems_reasonable/spring.cc
+++ b/motors/seems_reasonable/spring.cc
@@ -62,6 +62,8 @@
         goal_ = NextGoal(kLoadGoal);
         Load();
       }
+      // TODO(Austin): This should be a break, right?
+      // fallthrough
     case State::STUCK_UNLOAD:
       if (force_move) {
         ForceMove();
diff --git a/third_party/eigen/BUILD b/third_party/eigen/BUILD
index 4a33fd9..8fe7fa6 100644
--- a/third_party/eigen/BUILD
+++ b/third_party/eigen/BUILD
@@ -1,22 +1,28 @@
-licenses(['notice'])
+licenses(["notice"])
 
 load("//tools:environments.bzl", "mcu_cpus")
 
 cc_library(
-  name = 'eigen',
-  visibility = ['//visibility:public'],
-  srcs = glob(['Eigen/src/**/*.h']),
-  includes = ['.'],
-  hdrs = glob(['Eigen/*'], exclude=[
-    # Stuff that we don't have the dependencies for.
-    'Eigen/CholmodSupport',
-    'Eigen/MetisSupport',
-    'Eigen/PaStiXSupport',
-    'Eigen/PardisoSupport',
-    'Eigen/SPQRSupport',
-    'Eigen/SuperLUSupport',
-    'Eigen/UmfPackSupport',
-  ]) + ['unsupported/Eigen/MatrixFunctions'] +
-  glob(['unsupported/Eigen/src/MatrixFunctions/*.h']),
-  compatible_with = mcu_cpus,
+    name = "eigen",
+    srcs = glob(["Eigen/src/**/*.h"]),
+    hdrs = glob(
+        ["Eigen/*"],
+        exclude = [
+            # Stuff that we don't have the dependencies for.
+            "Eigen/CholmodSupport",
+            "Eigen/MetisSupport",
+            "Eigen/PaStiXSupport",
+            "Eigen/PardisoSupport",
+            "Eigen/SPQRSupport",
+            "Eigen/SuperLUSupport",
+            "Eigen/UmfPackSupport",
+        ],
+    ) + ["unsupported/Eigen/MatrixFunctions"] + glob([
+        "unsupported/Eigen/src/MatrixFunctions/*.h",
+    ]),
+    compatible_with = mcu_cpus + [
+        "//tools:armhf-debian",
+    ],
+    includes = ["."],
+    visibility = ["//visibility:public"],
 )
diff --git a/third_party/googletest/BUILD b/third_party/googletest/BUILD
index c082b0c..b0a99a6 100644
--- a/third_party/googletest/BUILD
+++ b/third_party/googletest/BUILD
@@ -27,6 +27,9 @@
     hdrs = glob([
         "googletest/include/gtest/*.h",
     ]),
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     copts = [
         "-g",
         "-Wall",
@@ -71,6 +74,9 @@
     hdrs = glob([
         "googlemock/include/gmock/*.h",
     ]),
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     copts = [
         "-std=c++11",
         "-g",
diff --git a/third_party/libjpeg/BUILD b/third_party/libjpeg/BUILD
index a139773..469de52 100644
--- a/third_party/libjpeg/BUILD
+++ b/third_party/libjpeg/BUILD
@@ -1,69 +1,74 @@
-licenses(['notice'])
+licenses(["notice"])
 
 cc_library(
-  name = 'libjpeg',
-  visibility = ['//visibility:public'],
-  srcs = glob([
-    'jaricom.c',
-    'jcapimin.c',
-    'jcapistd.c',
-    'jcarith.c',
-    'jccoefct.c',
-    'jccolor.c',
-    'jcdctmgr.c',
-    'jchuff.c',
-    'jcinit.c',
-    'jcmainct.c',
-    'jcmarker.c',
-    'jcmaster.c',
-    'jcomapi.c',
-    'jcparam.c',
-    'jcprepct.c',
-    'jcsample.c',
-    'jctrans.c',
-    'jdapimin.c',
-    'jdapistd.c',
-    'jdarith.c',
-    'jdatadst.c',
-    'jdatasrc.c',
-    'jdcoefct.c',
-    'jdcolor.c',
-    'jddctmgr.c',
-    'jdhuff.c',
-    'jdinput.c',
-    'jdmainct.c',
-    'jdmarker.c',
-    'jdmaster.c',
-    'jdmerge.c',
-    'jdpostct.c',
-    'jdsample.c',
-    'jdtrans.c',
-    'jerror.c',
-    'jfdctflt.c',
-    'jfdctfst.c',
-    'jfdctint.c',
-    'jidctflt.c',
-    'jidctfst.c',
-    'jidctint.c',
-    'jquant1.c',
-    'jquant2.c',
-    'jutils.c',
-    'jmemmgr.c',
-    'jmemnobs.c',
-  ]),
-  hdrs = glob([
-    '*.h',
-  ], exclude=[
-    'jmemdos.h',
-    'jmemmac.h',
-  ]),
-  includes = ['src/main/c'],
-  copts = [
-    '-Wno-cast-align',
-    '-Wno-cast-qual',
-
-    '-Wno-switch-enum',
-    '-Wno-format-nonliteral',
-    '-Wno-unused-parameter',
-  ],
+    name = "libjpeg",
+    srcs = glob([
+        "jaricom.c",
+        "jcapimin.c",
+        "jcapistd.c",
+        "jcarith.c",
+        "jccoefct.c",
+        "jccolor.c",
+        "jcdctmgr.c",
+        "jchuff.c",
+        "jcinit.c",
+        "jcmainct.c",
+        "jcmarker.c",
+        "jcmaster.c",
+        "jcomapi.c",
+        "jcparam.c",
+        "jcprepct.c",
+        "jcsample.c",
+        "jctrans.c",
+        "jdapimin.c",
+        "jdapistd.c",
+        "jdarith.c",
+        "jdatadst.c",
+        "jdatasrc.c",
+        "jdcoefct.c",
+        "jdcolor.c",
+        "jddctmgr.c",
+        "jdhuff.c",
+        "jdinput.c",
+        "jdmainct.c",
+        "jdmarker.c",
+        "jdmaster.c",
+        "jdmerge.c",
+        "jdpostct.c",
+        "jdsample.c",
+        "jdtrans.c",
+        "jerror.c",
+        "jfdctflt.c",
+        "jfdctfst.c",
+        "jfdctint.c",
+        "jidctflt.c",
+        "jidctfst.c",
+        "jidctint.c",
+        "jquant1.c",
+        "jquant2.c",
+        "jutils.c",
+        "jmemmgr.c",
+        "jmemnobs.c",
+    ]),
+    hdrs = glob(
+        [
+            "*.h",
+        ],
+        exclude = [
+            "jmemdos.h",
+            "jmemmac.h",
+        ],
+    ),
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    copts = [
+        "-Wno-cast-align",
+        "-Wno-cast-qual",
+        "-Wno-switch-enum",
+        "-Wno-format-nonliteral",
+        "-Wno-unused-parameter",
+    ],
+    includes = ["src/main/c"],
+    visibility = ["//visibility:public"],
 )
diff --git a/third_party/protobuf/BUILD b/third_party/protobuf/BUILD
index b6f988a..619bbee 100644
--- a/third_party/protobuf/BUILD
+++ b/third_party/protobuf/BUILD
@@ -71,6 +71,9 @@
         "src/google/protobuf/wire_format_lite.cc",
     ],
     hdrs = glob(["src/google/protobuf/**/*.h"]),
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     copts = COPTS,
     includes = ["src/"],
     linkopts = LINK_OPTS,
@@ -136,6 +139,9 @@
         "src/google/protobuf/wrappers.pb.cc",
     ],
     hdrs = glob(["src/**/*.h"]),
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     copts = COPTS,
     includes = ["src/"],
     linkopts = LINK_OPTS,
diff --git a/tools/BUILD b/tools/BUILD
index bab0b6e..3f3d4b2 100644
--- a/tools/BUILD
+++ b/tools/BUILD
@@ -1,51 +1,71 @@
-package(default_visibility = ['//visibility:public'])
+package(default_visibility = ["//visibility:public"])
 
-exports_files(['test_sharding_compliant'])
+exports_files(["test_sharding_compliant"])
 
 # Don't use these directly! Use //tools/build_rules/*.bzl instead.
 config_setting(
-  name = 'compiler_clang',
-  values = {'compiler': 'clang'}
+    name = "compiler_clang",
+    values = {"compiler": "clang"},
 )
+
 config_setting(
-  name = 'compiler_gcc',
-  values = {'compiler': 'gcc'}
+    name = "compiler_gcc",
+    values = {"compiler": "gcc"},
 )
+
 config_setting(
-  name = 'cpu_k8',
-  values = {'cpu': 'k8'},
+    name = "cpu_k8",
+    values = {"cpu": "k8"},
 )
+
 config_setting(
-  name = 'cpu_roborio',
-  values = {'cpu': 'roborio'},
+    name = "cpu_roborio",
+    values = {"cpu": "roborio"},
 )
+
 config_setting(
-  name = 'cpu_cortex_m4f',
-  values = {'cpu': 'cortex-m4f'},
+    name = "cpu_cortex_m4f",
+    values = {"cpu": "cortex-m4f"},
 )
+
 config_setting(
-  name = 'cpu_armhf',
-  values = {'cpu': 'armhf-debian'},
+    name = "cpu_armhf",
+    values = {"cpu": "armhf-debian"},
 )
+
 config_setting(
-  name = 'has_asan',
-  values = {'define': 'have_asan=true'},
+    name = "has_asan",
+    values = {"define": "have_asan=true"},
 )
+
 config_setting(
-  name = 'has_tsan',
-  values = {'define': 'have_tsan=true'},
+    name = "has_tsan",
+    values = {"define": "have_tsan=true"},
 )
+
 config_setting(
-  name = 'has_ubsan',
-  values = {'define': 'have_ubsan=true'},
+    name = "has_ubsan",
+    values = {"define": "have_ubsan=true"},
 )
 
 environment(name = "k8")
+
 environment(name = "armhf-debian")
+
 environment(name = "roborio")
+
 environment(name = "cortex-m4f")
+
 environment_group(
     name = "cpus",
-    environments = [":k8", ":roborio", ":armhf-debian", ":cortex-m4f"],
-    defaults = [":k8", ":roborio", ":armhf-debian"],
+    defaults = [
+        ":k8",
+        ":roborio",
+    ],
+    environments = [
+        ":k8",
+        ":roborio",
+        ":armhf-debian",
+        ":cortex-m4f",
+    ],
 )
diff --git a/tools/build_rules/BUILD b/tools/build_rules/BUILD
index e69de29..f96fb3a 100644
--- a/tools/build_rules/BUILD
+++ b/tools/build_rules/BUILD
@@ -0,0 +1,5 @@
+sh_binary(
+    name = "quiet_success",
+    srcs = ["quiet_success.sh"],
+    visibility = ["//visibility:public"],
+)
diff --git a/tools/build_rules/fortran.bzl b/tools/build_rules/fortran.bzl
index e8b25c1..cbd4447 100644
--- a/tools/build_rules/fortran.bzl
+++ b/tools/build_rules/fortran.bzl
@@ -1,4 +1,4 @@
-load('@//tools/build_rules:select.bzl', 'compiler_select')
+load("@//tools/build_rules:select.bzl", "compiler_select")
 
 def _single_fortran_object_impl(ctx):
   toolchain_cflags = (ctx.fragments.cpp.compiler_options([]) +
@@ -47,22 +47,24 @@
     'pic_o': fortran_file_base + '.pic.o',
   }
 
-
 _single_fortran_object = rule(
-  implementation = _single_fortran_object_impl,
-  attrs = {
-    'src': attr.label(single_file=True, allow_files=FileType(['.f'])),
-    'cc_libs': attr.label_list(providers=['cc']),
-    # TODO(Brian): Replace this with something more fine-grained from the
-    # configuration fragment or something.
-    '_cc_toolchain': attr.label(
-      default = Label('@//tools/cpp:toolchain'),
-    ),
-  },
-  outputs = _define_fortran_output,
-  fragments = [
-    'cpp',
-  ],
+    attrs = {
+        "src": attr.label(
+            single_file = True,
+            allow_files = FileType([".f"]),
+        ),
+        "cc_libs": attr.label_list(providers = ["cc"]),
+        # TODO(Brian): Replace this with something more fine-grained from the
+        # configuration fragment or something.
+        "_cc_toolchain": attr.label(
+            default = Label("@//tools/cpp:toolchain"),
+        ),
+    },
+    fragments = [
+        "cpp",
+    ],
+    outputs = _define_fortran_output,
+    implementation = _single_fortran_object_impl,
 )
 
 def fortran_library(name, srcs, deps = [], visibility = None):
@@ -95,28 +97,28 @@
   )
 
 f2c_copts = compiler_select({
-  'clang': [
-    '-Wno-incompatible-pointer-types-discards-qualifiers',
-    # Clang appears to be a bit over-eager about this and the comma operator.
-    '-Wno-sometimes-uninitialized',
-  ],
-  'gcc': [
-    # TODO(Brian): Remove this once we can actually disable all the warnings.
-    # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43245 isn't fixed in our
-    # roborio toolchain yet, so we can't for now.
-    '-Wno-error',
-  ],
+    "clang": [
+        "-Wno-incompatible-pointer-types-discards-qualifiers",
+        # Clang appears to be a bit over-eager about this and the comma operator.
+        "-Wno-sometimes-uninitialized",
+    ],
+    "gcc": [
+        # TODO(Brian): Remove this once we can actually disable all the warnings.
+        # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43245 isn't fixed in our
+        # roborio toolchain yet, so we can't for now.
+        "-Wno-error",
+    ],
 }) + [
-  # f2c appears to know what it's doing without adding extra ().
-  '-Wno-parentheses',
-
-  '-Wno-unused-parameter',
-  '-Wno-missing-field-initializers',
-  '-Wno-unused-variable',
+    # f2c appears to know what it's doing without adding extra ().
+    "-Wno-parentheses",
+    "-Wno-unused-parameter",
+    "-Wno-missing-field-initializers",
+    "-Wno-unused-variable",
 ]
-'''Copts to use when compiling f2c-generated files.
 
-This is useful when building externally-f2ced files.'''
+"""Copts to use when compiling f2c-generated files.
+
+This is useful when building externally-f2ced files."""
 
 def f2c_library(name, srcs, copts = [], **kwargs):
   '''Converts Fortran code to C and then compiles it.
@@ -141,8 +143,14 @@
     outs = c_srcs,
     tools = [
       '@f2c',
+      '@//tools/build_rules:quiet_success',
     ],
-    cmd = '$(location @f2c) -d$(@D)/%s $(SRCS)' % ('/'.join(out_dir),),
+    cmd = ' '.join([
+      '$(location @//tools/build_rules:quiet_success)',
+      '$(location @f2c)',
+      '-d$(@D)/%s' % ('/'.join(out_dir),),
+      '$(SRCS)',
+    ]),
   )
   native.cc_library(
     name = name,
diff --git a/tools/build_rules/protobuf.bzl b/tools/build_rules/protobuf.bzl
index 11753c2..9c92158 100644
--- a/tools/build_rules/protobuf.bzl
+++ b/tools/build_rules/protobuf.bzl
@@ -38,28 +38,30 @@
   }
 
 _do_proto_cc_library = rule(
-  implementation = _do_proto_cc_library_impl,
-  attrs = {
-    'src': attr.label(
-      allow_files = FileType(['.proto']),
-      mandatory = True,
-      single_file = True,
-    ),
-    'deps': attr.label_list(providers = ["proto"]),
-    '_protoc': attr.label(
-      default = Label('//third_party/protobuf:protoc'),
-      executable = True,
-      cfg = 'host',
-    ),
-    '_well_known_protos': attr.label(
-      default = Label('//third_party/protobuf:well_known_protos'),
-    ),
-  },
-  outputs = _do_proto_cc_library_outputs,
-  output_to_genfiles = True,
+    attrs = {
+        "src": attr.label(
+            allow_files = FileType([".proto"]),
+            mandatory = True,
+            single_file = True,
+        ),
+        "deps": attr.label_list(providers = ["proto"]),
+        "_protoc": attr.label(
+            default = Label("//third_party/protobuf:protoc"),
+            executable = True,
+            cfg = "host",
+        ),
+        "_well_known_protos": attr.label(
+            default = Label("//third_party/protobuf:well_known_protos"),
+        ),
+    },
+    output_to_genfiles = True,
+    outputs = _do_proto_cc_library_outputs,
+    implementation = _do_proto_cc_library_impl,
 )
 
-def proto_cc_library(name, src, deps = [], visibility = None):
+def proto_cc_library(name, src, deps = [],
+                     compatible_with = None, restricted_to = None,
+                     visibility = None):
   '''Generates a cc_library from a single .proto file. Does not support
   dependencies on any .proto files except the well-known ones protobuf comes
   with (which are unconditionally depended on).
@@ -73,6 +75,8 @@
     src = src,
     deps = [('%s__proto_srcs' % o_name) for o_name in deps],
     visibility = visibility,
+    compatible_with = compatible_with,
+    restricted_to = restricted_to,
   )
   basename = src[:-len('.proto')]
   native.cc_library(
@@ -81,4 +85,6 @@
     hdrs = [ '%s.pb.h' % basename ],
     deps = [ '//third_party/protobuf' ] + deps,
     visibility = visibility,
+    compatible_with = compatible_with,
+    restricted_to = restricted_to,
   )
diff --git a/tools/build_rules/quiet_success.sh b/tools/build_rules/quiet_success.sh
new file mode 100755
index 0000000..6020cef
--- /dev/null
+++ b/tools/build_rules/quiet_success.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+# This program hides all the output on stderr from the called command, unless it
+# fails, in which case all the output is printed at the end.
+
+set -e
+set -u
+
+readonly STDERR_FILE="$(mktemp)"
+
+if ! "$@" 2>"${STDERR_FILE}" ; then
+  cat "${STDERR_FILE}"
+  exit 1
+fi
diff --git a/tools/build_rules/select.bzl b/tools/build_rules/select.bzl
index 994e775..2d0bce5 100644
--- a/tools/build_rules/select.bzl
+++ b/tools/build_rules/select.bzl
@@ -3,10 +3,15 @@
 # quickly find issues where something new isn't handled.
 # It will also make adding ORs when it makes sense easy to do nicely.
 
-all_cpus = ['amd64', 'roborio', 'armhf']
-'''All of the CPUs we know about.'''
+all_cpus = [
+    "amd64",
+    "roborio",
+    "armhf",
+]
 
-'''A select wrapper for CPU architectures.
+"""All of the CPUs we know about."""
+
+"""A select wrapper for CPU architectures.
 
 Args:
   values: A mapping from architecture names (as strings) to other things.
@@ -14,7 +19,8 @@
           'else' is also allowed as a default.
           'arm' is allowed instead of roborio and armhf.
 Returns a select which evaluates to the correct element of values.
-'''
+"""
+
 def cpu_select(values):
   if 'arm' in values:
     new_values = {}
@@ -39,12 +45,13 @@
     '//tools:cpu_armhf': values['armhf'],
   })
 
-'''A select wrapper for address space sizes.
+"""A select wrapper for address space sizes.
 
 Args:
   values: A mapping from address space sizes (as strings) to other things.
 Returns a select which evaluates to the correct element of values.
-'''
+"""
+
 def address_size_select(values):
   if '32' not in values:
     fail('Need to handle 32 bit addresses!', 'values')
@@ -53,15 +60,17 @@
   return select({
     '//tools:cpu_k8': values['64'],
     '//tools:cpu_roborio': values['32'],
+    '//tools:cpu_armhf': values['32'],
   })
 
-'''A select wrapper for compilers.
+"""A select wrapper for compilers.
 
 Args:
   values: A mapping from compiler names (as strings) to other things.
           Currently 'gcc' and 'clang' are recognized.
 Returns a select which evaluates to the correct element of values.
-'''
+"""
+
 def compiler_select(values):
   if 'gcc' not in values:
     fail('Need to handle gcc!', 'values')
diff --git a/tools/ci/run-tests.sh b/tools/ci/run-tests.sh
index 5e31caa..bcb4c2a 100755
--- a/tools/ci/run-tests.sh
+++ b/tools/ci/run-tests.sh
@@ -2,6 +2,7 @@
 set -e
 set -x
 
-bazel --batch test -c opt --curses=no --color=no //...
-bazel --batch build -c opt --curses=no --color=no //... --cpu=roborio
-bazel --batch build -c opt --curses=no --color=no //motors/... --cpu=cortex-m4f
+bazel test -c opt --curses=no --color=no //...
+bazel build -c opt --curses=no --color=no //... --cpu=roborio
+bazel build -c opt --curses=no --color=no //motors/... --cpu=cortex-m4f
+bazel build --curses=no --color=no //... --cpu=armhf-debian
diff --git a/tools/cpp/BUILD b/tools/cpp/BUILD
index b731e0e..183d830 100644
--- a/tools/cpp/BUILD
+++ b/tools/cpp/BUILD
@@ -159,6 +159,7 @@
 filegroup(
     name = "linaro-gcc-files",
     srcs = [
+        ":clang_3p6_all_files",
         "//tools/cpp/linaro_linux_gcc:clang-symlinks",
         "//tools/cpp/linaro_linux_gcc:tool-wrappers",
         "@linaro_linux_gcc_4_9_repo//:compiler_pieces",
@@ -168,6 +169,7 @@
 filegroup(
     name = "linaro_linux_linker_files",
     srcs = [
+        ":clang_3p6_linker_files",
         "//tools/cpp/linaro_linux_gcc:ar",
         "//tools/cpp/linaro_linux_gcc:clang",
         "//tools/cpp/linaro_linux_gcc:clang-ld",
@@ -181,10 +183,20 @@
 filegroup(
     name = "linaro_linux_compiler_files",
     srcs = [
+        ":clang_3p6_compiler_files",
         "//tools/cpp/linaro_linux_gcc:as",
         "//tools/cpp/linaro_linux_gcc:clang",
         "//tools/cpp/linaro_linux_gcc:gcc",
         "//tools/cpp/linaro_linux_gcc:ld",
+        "@linaro_linux_gcc_4_9_repo//:compiler_pieces",
+    ],
+)
+
+filegroup(
+    name = "linaro_linux_strip_files",
+    srcs = [
+        "//tools/cpp/linaro_linux_gcc:strip",
+        "@linaro_linux_gcc_4_9_repo//:compiler_pieces",
     ],
 )
 
@@ -198,7 +210,7 @@
     linker_files = ":linaro_linux_linker_files",
     objcopy_files = "//tools/cpp/linaro_linux_gcc:objcopy",
     static_runtime_libs = [":empty"],
-    strip_files = "//tools/cpp/linaro_linux_gcc:strip",
+    strip_files = ":linaro_linux_strip_files",
     supports_param_files = 1,
 )
 
diff --git a/tools/cpp/linaro_linux_gcc/BUILD b/tools/cpp/linaro_linux_gcc/BUILD
index 2c79142..4800436 100644
--- a/tools/cpp/linaro_linux_gcc/BUILD
+++ b/tools/cpp/linaro_linux_gcc/BUILD
@@ -1,113 +1,113 @@
-package(default_visibility = ['//tools/cpp:__pkg__'])
+package(default_visibility = ["//tools/cpp:__pkg__"])
 
 cc_library(
-  name = 'libpthread',
-  visibility = ['//visibility:public'],
-  srcs = [
-    'clang_more_libs/libpthread.so',
-  ],
+    name = "libpthread",
+    srcs = [
+        "clang_more_libs/libpthread.so",
+    ],
+    visibility = ["//visibility:public"],
 )
 
 filegroup(
-  name = 'gcc',
-  srcs = [
-    '@linaro_linux_gcc_4_9_repo//:gcc',
-    'arm-linux-gnueabihf-gcc',
-  ],
+    name = "gcc",
+    srcs = [
+        "arm-linux-gnueabihf-gcc",
+        "@linaro_linux_gcc_4_9_repo//:gcc",
+    ],
 )
 
 filegroup(
-  name = 'ar',
-  srcs = [
-    '@linaro_linux_gcc_4_9_repo//:ar',
-    'arm-linux-gnueabihf-ar',
-  ],
+    name = "ar",
+    srcs = [
+        "arm-linux-gnueabihf-ar",
+        "@linaro_linux_gcc_4_9_repo//:ar",
+    ],
 )
 
 filegroup(
-  name = 'ld',
-  srcs = [
-    '@linaro_linux_gcc_4_9_repo//:ld',
-    'arm-linux-gnueabihf-ld',
-  ],
+    name = "ld",
+    srcs = [
+        "arm-linux-gnueabihf-ld",
+        "@linaro_linux_gcc_4_9_repo//:ld",
+    ],
 )
 
 filegroup(
-  name = 'nm',
-  srcs = [
-    '@linaro_linux_gcc_4_9_repo//:nm',
-    'arm-linux-gnueabihf-nm',
-  ],
+    name = "nm",
+    srcs = [
+        "arm-linux-gnueabihf-nm",
+        "@linaro_linux_gcc_4_9_repo//:nm",
+    ],
 )
 
 filegroup(
-  name = 'objcopy',
-  srcs = [
-    '@linaro_linux_gcc_4_9_repo//:objcopy',
-    'arm-linux-gnueabihf-objcopy',
-  ],
+    name = "objcopy",
+    srcs = [
+        "arm-linux-gnueabihf-objcopy",
+        "@linaro_linux_gcc_4_9_repo//:objcopy",
+    ],
 )
 
 filegroup(
-  name = 'objdump',
-  srcs = [
-    '@linaro_linux_gcc_4_9_repo//:objdump',
-    'arm-linux-gnueabihf-objdump',
-  ],
+    name = "objdump",
+    srcs = [
+        "arm-linux-gnueabihf-objdump",
+        "@linaro_linux_gcc_4_9_repo//:objdump",
+    ],
 )
 
 filegroup(
-  name = 'strip',
-  srcs = [
-    '@linaro_linux_gcc_4_9_repo//:strip',
-    'arm-linux-gnueabihf-strip',
-  ],
+    name = "strip",
+    srcs = [
+        "arm-linux-gnueabihf-strip",
+        "@linaro_linux_gcc_4_9_repo//:strip",
+    ],
 )
 
 filegroup(
-  name = 'as',
-  srcs = [
-    '@linaro_linux_gcc_4_9_repo//:as',
-    'arm-linux-gnueabihf-as',
-  ],
+    name = "as",
+    srcs = [
+        "arm-linux-gnueabihf-as",
+        "@linaro_linux_gcc_4_9_repo//:as",
+    ],
 )
 
 filegroup(
-  name = 'clang',
-  srcs = [
-    'clang_bin/clang',
-  ],
+    name = "clang",
+    srcs = [
+        "clang_bin/clang",
+    ],
 )
 
 filegroup(
-  name = 'clang-ld',
-  srcs = [
-    'clang_bin/ld',
-    ':ld',
-  ],
+    name = "clang-ld",
+    srcs = [
+        "clang_bin/ld",
+        ":ld",
+    ],
 )
 
 filegroup(
-  name = 'tool-wrappers',
-  srcs = [
-    ':gcc',
-    ':ar',
-    ':ld',
-    ':nm',
-    ':objcopy',
-    ':objdump',
-    ':strip',
-    ':as',
-    'clang_bin/as',
-    ':clang',
-    ':clang-ld',
-  ],
+    name = "tool-wrappers",
+    srcs = [
+        "clang_bin/as",
+        ":ar",
+        ":as",
+        ":clang",
+        ":clang-ld",
+        ":gcc",
+        ":ld",
+        ":nm",
+        ":objcopy",
+        ":objdump",
+        ":strip",
+    ],
 )
 
 filegroup(
-  name = 'clang-symlinks',
-  srcs = glob([
-    'clang_more_libs/**',
-    'clang_syroot/**',
-  ]),
+    name = "clang-symlinks",
+    srcs = glob([
+        "clang_more_libs/**",
+        "clang_syroot/**",
+    ]),
 )
diff --git a/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-ar b/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-ar
index 5615844..abdb214 100755
--- a/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-ar
+++ b/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-ar
@@ -1,5 +1,9 @@
 #!/bin/bash --norc
 
+LD_LIBRARY_PATH="${BAZEL_OUTPUT_ROOT}external/linaro_49_deps/usr/lib/x86_64-linux-gnu"
+LD_LIBRARY_PATH+=":${BAZEL_OUTPUT_ROOT}external/linaro_49_deps/lib/x86_64-linux-gnu"
+export LD_LIBRARY_PATH
+
 exec -a arm-linux-gnueabihf-ar \
 	${BAZEL_OUTPUT_ROOT}external/linaro_linux_gcc_4_9_repo/bin/arm-linux-gnueabihf-ar \
 	"$@"
diff --git a/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-as b/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-as
index 7a67c77..6a749b4 100755
--- a/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-as
+++ b/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-as
@@ -1,5 +1,9 @@
 #!/bin/bash --norc
 
+LD_LIBRARY_PATH="${BAZEL_OUTPUT_ROOT}external/linaro_49_deps/usr/lib/x86_64-linux-gnu"
+LD_LIBRARY_PATH+=":${BAZEL_OUTPUT_ROOT}external/linaro_49_deps/lib/x86_64-linux-gnu"
+export LD_LIBRARY_PATH
+
 exec -a arm-linux-gnueabihf-as \
 	${BAZEL_OUTPUT_ROOT}external/linaro_linux_gcc_4_9_repo/bin/arm-linux-gnueabihf-as \
 	"$@"
diff --git a/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-cpp b/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-cpp
index 46d8d42..7d97f51 100755
--- a/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-cpp
+++ b/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-cpp
@@ -1,5 +1,9 @@
 #!/bin/bash --norc
 
+LD_LIBRARY_PATH="${BAZEL_OUTPUT_ROOT}external/linaro_49_deps/usr/lib/x86_64-linux-gnu"
+LD_LIBRARY_PATH+=":${BAZEL_OUTPUT_ROOT}external/linaro_49_deps/lib/x86_64-linux-gnu"
+export LD_LIBRARY_PATH
+
 exec -a arm-linux-gnueabihf-cpp \
 	${BAZEL_OUTPUT_ROOT}external/linaro_linux_gcc_4_9_repo/bin/arm-linux-gnueabihf-cpp \
 	"$@"
diff --git a/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-gcc b/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-gcc
index c70d6b3..71dd060 100755
--- a/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-gcc
+++ b/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-gcc
@@ -1,5 +1,9 @@
 #!/bin/bash --norc
 
+LD_LIBRARY_PATH="${BAZEL_OUTPUT_ROOT}external/linaro_49_deps/usr/lib/x86_64-linux-gnu"
+LD_LIBRARY_PATH+=":${BAZEL_OUTPUT_ROOT}external/linaro_49_deps/lib/x86_64-linux-gnu"
+export LD_LIBRARY_PATH
+
 PATH="${BAZEL_OUTPUT_ROOT}external/linaro_linux_gcc_4_9_repo/libexec/gcc/arm-linux-gnueabihf/4.9.3:$PATH" \
 	exec \
 	${BAZEL_OUTPUT_ROOT}external/linaro_linux_gcc_4_9_repo/bin/arm-linux-gnueabihf-gcc \
diff --git a/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-gcov b/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-gcov
index 4525f95..5e179c4 100755
--- a/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-gcov
+++ b/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-gcov
@@ -1,5 +1,9 @@
 #!/bin/bash --norc
 
+LD_LIBRARY_PATH="${BAZEL_OUTPUT_ROOT}external/linaro_49_deps/usr/lib/x86_64-linux-gnu"
+LD_LIBRARY_PATH+=":${BAZEL_OUTPUT_ROOT}external/linaro_49_deps/lib/x86_64-linux-gnu"
+export LD_LIBRARY_PATH
+
 exec -a arm-linux-gnueabihf-gcov \
 	${BAZEL_OUTPUT_ROOT}external/linaro_linux_gcc_4_9_repo/bin/arm-linux-gnueabihf-gcov \
 	"$@"
diff --git a/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-ld b/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-ld
index 566df55..b4b9fb2 100755
--- a/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-ld
+++ b/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-ld
@@ -1,5 +1,9 @@
 #!/bin/bash --norc
 
+LD_LIBRARY_PATH="${BAZEL_OUTPUT_ROOT}external/linaro_49_deps/usr/lib/x86_64-linux-gnu"
+LD_LIBRARY_PATH+=":${BAZEL_OUTPUT_ROOT}external/linaro_49_deps/lib/x86_64-linux-gnu"
+export LD_LIBRARY_PATH
+
 exec -a arm-linux-gnueabihf-ld \
 	${BAZEL_OUTPUT_ROOT}external/linaro_linux_gcc_4_9_repo/bin/arm-linux-gnueabihf-ld \
 	"$@"
diff --git a/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-nm b/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-nm
index 7dde30a..514dc67 100755
--- a/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-nm
+++ b/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-nm
@@ -1,5 +1,9 @@
 #!/bin/bash --norc
 
+LD_LIBRARY_PATH="${BAZEL_OUTPUT_ROOT}external/linaro_49_deps/usr/lib/x86_64-linux-gnu"
+LD_LIBRARY_PATH+=":${BAZEL_OUTPUT_ROOT}external/linaro_49_deps/lib/x86_64-linux-gnu"
+export LD_LIBRARY_PATH
+
 exec -a arm-linux-gnueabihf-nm \
 	${BAZEL_OUTPUT_ROOT}external/linaro_linux_gcc_4_9_repo/bin/arm-linux-gnueabihf-nm \
 	"$@"
diff --git a/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-objcopy b/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-objcopy
index 97d912f..d435e92 100755
--- a/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-objcopy
+++ b/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-objcopy
@@ -1,5 +1,9 @@
 #!/bin/bash --norc
 
+LD_LIBRARY_PATH="${BAZEL_OUTPUT_ROOT}external/linaro_49_deps/usr/lib/x86_64-linux-gnu"
+LD_LIBRARY_PATH+=":${BAZEL_OUTPUT_ROOT}external/linaro_49_deps/lib/x86_64-linux-gnu"
+export LD_LIBRARY_PATH
+
 exec -a arm-linux-gnueabihf-objcopy \
 	${BAZEL_OUTPUT_ROOT}external/linaro_linux_gcc_4_9_repo/bin/arm-linux-gnueabihf-objcopy \
 	"$@"
diff --git a/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-objdump b/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-objdump
index 561dc89..260d9c0 100755
--- a/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-objdump
+++ b/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-objdump
@@ -1,5 +1,9 @@
 #!/bin/bash --norc
 
+LD_LIBRARY_PATH="${BAZEL_OUTPUT_ROOT}external/linaro_49_deps/usr/lib/x86_64-linux-gnu"
+LD_LIBRARY_PATH+=":${BAZEL_OUTPUT_ROOT}external/linaro_49_deps/lib/x86_64-linux-gnu"
+export LD_LIBRARY_PATH
+
 exec -a arm-linux-gnueabihf-objdump \
 	${BAZEL_OUTPUT_ROOT}external/linaro_linux_gcc_4_9_repo/bin/arm-linux-gnueabihf-objdump \
 	"$@"
diff --git a/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-strip b/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-strip
index 45024d3..2942227 100755
--- a/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-strip
+++ b/tools/cpp/linaro_linux_gcc/arm-linux-gnueabihf-strip
@@ -1,5 +1,9 @@
 #!/bin/bash --norc
 
+LD_LIBRARY_PATH="${BAZEL_OUTPUT_ROOT}external/linaro_49_deps/usr/lib/x86_64-linux-gnu"
+LD_LIBRARY_PATH+=":${BAZEL_OUTPUT_ROOT}external/linaro_49_deps/lib/x86_64-linux-gnu"
+export LD_LIBRARY_PATH
+
 exec -a arm-linux-gnueabihf-strip \
 	${BAZEL_OUTPUT_ROOT}external/linaro_linux_gcc_4_9_repo/bin/arm-linux-gnueabihf-strip \
 	"$@"
diff --git a/tools/cpp/linaro_linux_gcc/clang_bin/clang b/tools/cpp/linaro_linux_gcc/clang_bin/clang
index 2ed616a..99f6067 100755
--- a/tools/cpp/linaro_linux_gcc/clang_bin/clang
+++ b/tools/cpp/linaro_linux_gcc/clang_bin/clang
@@ -1,4 +1,4 @@
 #!/bin/bash --norc
 
 exec -a "$0" \
-  "/usr/bin/clang-3.6" "$@"
+  "tools/cpp/clang_3p6/x86_64-linux-gnu-clang-3.6" "$@"
diff --git a/y2016/BUILD b/y2016/BUILD
index e10be44..24f83e1 100644
--- a/y2016/BUILD
+++ b/y2016/BUILD
@@ -8,6 +8,9 @@
     hdrs = [
         "constants.h",
     ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
     visibility = ["//visibility:public"],
     deps = [
         "//aos:once",
diff --git a/y2016/control_loops/drivetrain/BUILD b/y2016/control_loops/drivetrain/BUILD
index 13c1ba3..f798681 100644
--- a/y2016/control_loops/drivetrain/BUILD
+++ b/y2016/control_loops/drivetrain/BUILD
@@ -1,78 +1,87 @@
-package(default_visibility = ['//visibility:public'])
+package(default_visibility = ["//visibility:public"])
 
-load('//aos/build:queues.bzl', 'queue_library')
+load("//aos/build:queues.bzl", "queue_library")
 
 genrule(
-  name = 'genrule_drivetrain',
-  visibility = ['//visibility:private'],
-  cmd = '$(location //y2016/control_loops/python:drivetrain) $(OUTS)',
-  tools = [
-    '//y2016/control_loops/python:drivetrain',
-  ],
-  outs = [
-    'drivetrain_dog_motor_plant.h',
-    'drivetrain_dog_motor_plant.cc',
-    'kalman_drivetrain_motor_plant.h',
-    'kalman_drivetrain_motor_plant.cc',
-  ],
+    name = "genrule_drivetrain",
+    outs = [
+        "drivetrain_dog_motor_plant.h",
+        "drivetrain_dog_motor_plant.cc",
+        "kalman_drivetrain_motor_plant.h",
+        "kalman_drivetrain_motor_plant.cc",
+    ],
+    cmd = "$(location //y2016/control_loops/python:drivetrain) $(OUTS)",
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    tools = [
+        "//y2016/control_loops/python:drivetrain",
+    ],
+    visibility = ["//visibility:private"],
 )
 
 genrule(
-  name = 'genrule_polydrivetrain',
-  visibility = ['//visibility:private'],
-  cmd = '$(location //y2016/control_loops/python:polydrivetrain) $(OUTS)',
-  tools = [
-    '//y2016/control_loops/python:polydrivetrain',
-  ],
-  outs = [
-    'polydrivetrain_dog_motor_plant.h',
-    'polydrivetrain_dog_motor_plant.cc',
-    'polydrivetrain_cim_plant.h',
-    'polydrivetrain_cim_plant.cc',
-  ],
+    name = "genrule_polydrivetrain",
+    outs = [
+        "polydrivetrain_dog_motor_plant.h",
+        "polydrivetrain_dog_motor_plant.cc",
+        "polydrivetrain_cim_plant.h",
+        "polydrivetrain_cim_plant.cc",
+    ],
+    cmd = "$(location //y2016/control_loops/python:polydrivetrain) $(OUTS)",
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    tools = [
+        "//y2016/control_loops/python:polydrivetrain",
+    ],
+    visibility = ["//visibility:private"],
 )
 
 cc_library(
-  name = 'polydrivetrain_plants',
-  srcs = [
-    'polydrivetrain_dog_motor_plant.cc',
-    'drivetrain_dog_motor_plant.cc',
-    'kalman_drivetrain_motor_plant.cc',
-  ],
-  hdrs = [
-    'polydrivetrain_dog_motor_plant.h',
-    'drivetrain_dog_motor_plant.h',
-    'kalman_drivetrain_motor_plant.h',
-  ],
-  deps = [
-    '//frc971/control_loops:state_feedback_loop',
-  ],
+    name = "polydrivetrain_plants",
+    srcs = [
+        "drivetrain_dog_motor_plant.cc",
+        "kalman_drivetrain_motor_plant.cc",
+        "polydrivetrain_dog_motor_plant.cc",
+    ],
+    hdrs = [
+        "drivetrain_dog_motor_plant.h",
+        "kalman_drivetrain_motor_plant.h",
+        "polydrivetrain_dog_motor_plant.h",
+    ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        "//frc971/control_loops:state_feedback_loop",
+    ],
 )
 
 cc_library(
-  name = 'drivetrain_base',
-  srcs = [
-    'drivetrain_base.cc',
-  ],
-  hdrs = [
-    'drivetrain_base.h',
-  ],
-  deps = [
-    ':polydrivetrain_plants',
-    '//frc971/control_loops/drivetrain:drivetrain_config',
-    '//frc971:shifter_hall_effect',
-    '//y2016:constants',
-  ],
+    name = "drivetrain_base",
+    srcs = [
+        "drivetrain_base.cc",
+    ],
+    hdrs = [
+        "drivetrain_base.h",
+    ],
+    deps = [
+        ":polydrivetrain_plants",
+        "//frc971:shifter_hall_effect",
+        "//frc971/control_loops/drivetrain:drivetrain_config",
+        "//y2016:constants",
+    ],
 )
 
 cc_binary(
-  name = 'drivetrain',
-  srcs = [
-    'drivetrain_main.cc',
-  ],
-  deps = [
-    ':drivetrain_base',
-    '//aos/linux_code:init',
-    '//frc971/control_loops/drivetrain:drivetrain_lib',
-  ],
+    name = "drivetrain",
+    srcs = [
+        "drivetrain_main.cc",
+    ],
+    deps = [
+        ":drivetrain_base",
+        "//aos/linux_code:init",
+        "//frc971/control_loops/drivetrain:drivetrain_lib",
+    ],
 )
diff --git a/y2016/vision/BUILD b/y2016/vision/BUILD
index 3ba7786..1220946 100644
--- a/y2016/vision/BUILD
+++ b/y2016/vision/BUILD
@@ -1,26 +1,35 @@
-load('//tools/build_rules:protobuf.bzl', 'proto_cc_library')
-load('//aos/build:queues.bzl', 'queue_library')
-load('//tools/build_rules:gtk_dependent.bzl', 'gtk_dependent_cc_binary', 'gtk_dependent_cc_library')
+load("//tools/build_rules:protobuf.bzl", "proto_cc_library")
+load("//aos/build:queues.bzl", "queue_library")
+load("//tools/build_rules:gtk_dependent.bzl", "gtk_dependent_cc_binary", "gtk_dependent_cc_library")
 
 queue_library(
-  name = 'vision_queue',
-  visibility = ['//visibility:public'],
-  srcs = [
-    'vision.q',
-  ],
+    name = "vision_queue",
+    srcs = [
+        "vision.q",
+    ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    visibility = ["//visibility:public"],
 )
 
 proto_cc_library(
-  name = 'vision_data',
-  src = 'vision_data.proto',
+    name = "vision_data",
+    src = "vision_data.proto",
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
 )
 
 proto_cc_library(
-  name = 'calibration',
-  src = 'calibration.proto',
+    name = "calibration",
+    src = "calibration.proto",
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
 )
 
-_calibration_values_embedded_before = '''
+_calibration_values_embedded_before = """
 #include "y2016/vision/stereo_geometry.h"
 
 #include <string>
@@ -31,9 +40,9 @@
 namespace vision {
 namespace {
 
-const ::std::string kEmbeddedContents ='''
+const ::std::string kEmbeddedContents ="""
 
-_calibration_values_embedded_after = ''';
+_calibration_values_embedded_after = """;
 
 }  // namespace
 
@@ -44,116 +53,134 @@
 }
 
 }  // namespace vision
-}  // namespace y2016'''
+}  // namespace y2016"""
 
 genrule(
-  name = 'embed_calibration_pb',
-  srcs = [
-    'calibration.pb',
-  ],
-  outs = [
-    'stereo_geometry_embedded.cc',
-  ],
-  cmd = '\n'.join([
-    'echo \'%s\' > $@' % _calibration_values_embedded_before,
-    'cat $(location :calibration.pb) | sed \'s/"/\\\\"/g ; s/^/"/g ; s/$$/\\\\n"/g\' >> $@',
-    'echo \'%s\' >> $@' % _calibration_values_embedded_after,
-  ]),
+    name = "embed_calibration_pb",
+    srcs = [
+        "calibration.pb",
+    ],
+    outs = [
+        "stereo_geometry_embedded.cc",
+    ],
+    cmd = "\n".join([
+        "echo '%s' > $@" % _calibration_values_embedded_before,
+        "cat $(location :calibration.pb) | sed 's/\"/\\\\\"/g ; s/^/\"/g ; s/$$/\\\\n\"/g' >> $@",
+        "echo '%s' >> $@" % _calibration_values_embedded_after,
+    ]),
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
 )
 
 cc_library(
-  name = 'stereo_geometry',
-  hdrs = [
-    'stereo_geometry.h',
-  ],
-  srcs = [
-    'stereo_geometry.cc',
-    'stereo_geometry_embedded.cc',
-  ],
-  deps = [
-    ':calibration',
-    '//aos/common/logging',
-    '//aos/vision/math:vector',
-  ],
+    name = "stereo_geometry",
+    srcs = [
+        "stereo_geometry.cc",
+        "stereo_geometry_embedded.cc",
+    ],
+    hdrs = [
+        "stereo_geometry.h",
+    ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        ":calibration",
+        "//aos/common/logging",
+        "//aos/vision/math:vector",
+    ],
 )
 
 cc_binary(
-  name = 'target_sender',
-  srcs = ['target_sender.cc'],
-  deps = [
-    '//aos/common:time',
-    '//aos/common/logging:logging',
-    '//aos/common/logging:implementations',
-    '//aos/vision/image:reader',
-    '//aos/vision/image:jpeg_routines',
-    '//aos/vision/image:image_stream',
-    '//y2016/vision:blob_filters',
-    '//aos/vision/events:udp',
-    '//aos/vision/events:epoll_events',
-    '//aos/vision/events:socket_types',
-    ':stereo_geometry',
-    ':vision_data',
-    ':calibration',
-  ],
-  restricted_to = ['//tools:k8', '//tools:armhf-debian'],
+    name = "target_sender",
+    srcs = ["target_sender.cc"],
+    restricted_to = [
+        "//tools:k8",
+        "//tools:armhf-debian",
+    ],
+    deps = [
+        ":calibration",
+        ":stereo_geometry",
+        ":vision_data",
+        "//aos/common:time",
+        "//aos/common/logging",
+        "//aos/common/logging:implementations",
+        "//aos/vision/events:epoll_events",
+        "//aos/vision/events:socket_types",
+        "//aos/vision/events:udp",
+        "//aos/vision/image:image_stream",
+        "//aos/vision/image:jpeg_routines",
+        "//aos/vision/image:reader",
+        "//y2016/vision:blob_filters",
+    ],
 )
 
 cc_library(
-  name = "blob_filters",
-  srcs = ["blob_filters.cc"],
-  hdrs = ["blob_filters.h"],
-  deps = [
-    "//aos/vision/math:vector",
-    "//aos/vision/math:segment",
-    "//aos/vision/blob:range_image",
-    "//aos/vision/blob:threshold",
-    "//aos/vision/blob:find_blob",
-    "//aos/vision/blob:hierarchical_contour_merge",
-    "//aos/vision/blob:codec",
-  ],
-  visibility = ['//visibility:public'],
-  restricted_to = ['//tools:k8', '//tools:armhf-debian'],
+    name = "blob_filters",
+    srcs = ["blob_filters.cc"],
+    hdrs = ["blob_filters.h"],
+    restricted_to = [
+        "//tools:k8",
+        "//tools:armhf-debian",
+    ],
+    visibility = ["//visibility:public"],
+    deps = [
+        "//aos/vision/blob:codec",
+        "//aos/vision/blob:find_blob",
+        "//aos/vision/blob:hierarchical_contour_merge",
+        "//aos/vision/blob:range_image",
+        "//aos/vision/blob:threshold",
+        "//aos/vision/math:segment",
+        "//aos/vision/math:vector",
+    ],
 )
 
 cc_binary(
-  name = 'target_receiver',
-  srcs = [
-    'target_receiver.cc',
-  ],
-  visibility = ['//visibility:public'],
-  deps = [
-    '//aos/common/logging',
-    '//aos/common/logging:queue_logging',
-    '//aos/linux_code:init',
-    '//aos/common:time',
-    '//aos/vision/events:udp',
-    ':vision_queue',
-    ':vision_data',
-    ':stereo_geometry',
-    '//y2016:constants',
-    '//frc971/control_loops/drivetrain:drivetrain_queue',
-    '//aos/common:mutex',
-  ],
+    name = "target_receiver",
+    srcs = [
+        "target_receiver.cc",
+    ],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    visibility = ["//visibility:public"],
+    deps = [
+        ":stereo_geometry",
+        ":vision_data",
+        ":vision_queue",
+        "//aos/common:mutex",
+        "//aos/common:time",
+        "//aos/common/logging",
+        "//aos/common/logging:queue_logging",
+        "//aos/linux_code:init",
+        "//aos/vision/events:udp",
+        "//frc971/control_loops/drivetrain:drivetrain_queue",
+        "//y2016:constants",
+    ],
 )
 
 gtk_dependent_cc_binary(
-  name = "debug_receiver",
-  srcs = ["debug_receiver.cc"],
-  visibility = ['//visibility:public'],
-  deps = [
-    "//aos/vision/image:image_types",
-    "//aos/vision/image:jpeg_routines",
-    "//aos/vision/events:socket_types",
-    "//aos/vision/events:tcp_client",
-    "//aos/vision/events:epoll_events",
-    "//aos/vision/events:gtk_event",
-    "//aos/vision/debug:debug_window",
-    "//aos/vision/blob:range_image",
-    "//aos/vision/blob:codec",
-    "//aos/vision/blob:stream_view",
-    ":stereo_geometry",
-    ":blob_filters",
-    ":vision_data",
-    ":calibration",
-  ],
+    name = "debug_receiver",
+    srcs = ["debug_receiver.cc"],
+    compatible_with = [
+        "//tools:armhf-debian",
+    ],
+    visibility = ["//visibility:public"],
+    deps = [
+        ":blob_filters",
+        ":calibration",
+        ":stereo_geometry",
+        ":vision_data",
+        "//aos/vision/blob:codec",
+        "//aos/vision/blob:range_image",
+        "//aos/vision/blob:stream_view",
+        "//aos/vision/debug:debug_window",
+        "//aos/vision/events:epoll_events",
+        "//aos/vision/events:gtk_event",
+        "//aos/vision/events:socket_types",
+        "//aos/vision/events:tcp_client",
+        "//aos/vision/image:image_types",
+        "//aos/vision/image:jpeg_routines",
+    ],
 )