 +sgx_enclave_configuration(name = "enclave_debug_config")
 +
 +
-+# genrule is needed to compile third_party protobufs.
-+genrule(
++proto_library(
 +    name = "ipc_common_proto",
 +    srcs = ["psw/ae/common/proto/messages.proto"],
-+    outs = [
-+        "psw/ae/common/proto/messages.pb.h",
-+        "psw/ae/common/proto/messages.pb.cc",
-+    ],
-+    cmd = ("$(location @com_google_protobuf//:protoc) " +
-+           "--cpp_out=$(GENDIR) $(SRCS)"),
-+    tools = ["@com_google_protobuf//:protoc"],
++)
++cc_proto_library(
++    name = "ipc_common_proto_cc",
++    deps = [":ipc_common_proto"],
 +)
 +
 +cc_library(

             *output = (char)(input | FIRST_BYTE_MARK[*length]);
--- /dev/null
+++ BUILD
@@ -0,0 +1,531 @@
+# linux-sgx is the Intel SGX SDK
+
+package(default_visibility = ["//visibility:public"])

+        "common/inc/internal/se_*.h",
+    ]) + [
+        "external/epid/epid/common/types.h",
+    ],
+    hdrs = [
+        "common/inc/internal/arch.h",
