diff --git a/BUILD b/BUILD index fb7df78..c61178b 100644 --- a/BUILD +++ b/BUILD @@ -21,36 +21,102 @@ genrule( ) cc_library( - name = "libhoth_transports_headers", + name = "libhoth_protocol", hdrs = [ - "//transports:headers", + "//protocol:headers", ], - include_prefix = "libhoth/transports", - strip_include_prefix = "transports", + include_prefix = "libhoth/protocol", + strip_include_prefix = "protocol", + deps = [ + "//protocol:authz_record", + "//protocol:chipinfo", + "//protocol:console", + "//protocol:controlled_storage", + "//protocol:dfu_check", + "//protocol:dfu_hostcmd", + "//protocol:firmware_update", + "//protocol:gpio_drive_strength", + "//protocol:hello", + "//protocol:host_cmd", + "//protocol:i2c", + "//protocol:jtag", + "//protocol:key_rotation", + "//protocol:libhoth_status", + "//protocol:mauv", + "//protocol:opentitan_version", + "//protocol:panic", + "//protocol:payload_info", + "//protocol:payload_status", + "//protocol:payload_update", + "//protocol:progress", + "//protocol:reboot", + "//protocol:rot_firmware_version", + "//protocol:secure_boot", + "//protocol:spi_proxy", + "//protocol:statistics", + "//protocol:util", + "//transports:libhoth_device", + "//transports:libhoth_device_headers_legacy", + ], + visibility = ["//visibility:public"], ) cc_library( - name = "libhoth_transports_headers_legacy", - hdrs = [ - "//transports:headers", + name = "libhoth_usb", + deps = [ + "//transports:libhoth_usb", + "//transports:libhoth_usb_device", + "//transports:libhoth_usb_headers_legacy", + "//transports:libhoth_device_headers_legacy", + "@libusb//:libusb", ], - include_prefix = "transports", - strip_include_prefix = "transports", + visibility = ["//visibility:public"], ) cc_library( - name = "libhoth", + name = "libhoth_spi", deps = [ - "//transports:libhoth_device", - "//transports:libhoth_usb", "//transports:libhoth_spi", + "//transports:libhoth_spi_headers_legacy", + "//transports:libhoth_device_headers_legacy", + ], + visibility = ["//visibility:public"], +) + +cc_library( + name = "libhoth_mtd", + deps = [ "//transports:libhoth_mtd", - ":libhoth_transports_headers", - ":libhoth_transports_headers_legacy", + "//transports:libhoth_mtd_headers_legacy", + "//transports:libhoth_device_headers_legacy", + ], + visibility = ["//visibility:public"], +) + +cc_library( + name = "libhoth_dbus", + deps = [ + "//transports:libhoth_dbus", + "//transports:libhoth_dbus_headers_legacy", + "//transports:libhoth_device_headers_legacy", ], visibility = ["//visibility:public"], ) +cc_library( + name = "libhoth", + deps = [ + ":libhoth_protocol", + ":libhoth_usb", + ":libhoth_spi", + ":libhoth_mtd", + ] + select({ + "//examples:dbus_backend": [":libhoth_dbus"], + "//conditions:default": [], + }), + visibility = ["//visibility:public"], +) + alias( name = "libusb", actual = "@libusb//:libusb", diff --git a/examples/BUILD b/examples/BUILD index 31df79f..4d1db4f 100644 --- a/examples/BUILD +++ b/examples/BUILD @@ -244,43 +244,8 @@ cc_binary( ":host_commands", ":srtm", "//:git_version", - "//protocol:authz_record", - "//protocol:chipinfo", - "//protocol:console", - "//protocol:gpio_drive_strength", - "//protocol:controlled_storage", - "//protocol:dfu_check", - "//protocol:dfu_hostcmd", - "//protocol:firmware_update", - "//protocol:hello", - "//protocol:host_cmd", - "//protocol:i2c", - "//protocol:jtag", - "//protocol:key_rotation", - "//protocol:libhoth_status", - "//protocol:mauv", - "//protocol:opentitan_version", - "//protocol:panic", - "//protocol:payload_info", - "//protocol:payload_status", - "//protocol:payload_update", - "//protocol:progress", - "//protocol:reboot", - "//protocol:rot_firmware_version", - "//protocol:secure_boot", - "//protocol:spi_proxy", - "//protocol:statistics", - "//protocol:util", - "//transports:libhoth_device", - "//transports:libhoth_mtd", - "//transports:libhoth_spi", - "//transports:libhoth_usb", - "//transports:libhoth_usb_device", - "@libusb", - ] + select({ - ":dbus_backend": ["//transports:libhoth_dbus"], - "//conditions:default": [], - }), + "//:libhoth", + ], ) cc_test( diff --git a/protocol/BUILD b/protocol/BUILD index ef1d1b5..555451e 100644 --- a/protocol/BUILD +++ b/protocol/BUILD @@ -622,3 +622,7 @@ cc_test( ], ) +filegroup( + name = "headers", + srcs = glob(["*.h"]) +) diff --git a/transports/BUILD b/transports/BUILD index 9424ef1..7d2701c 100644 --- a/transports/BUILD +++ b/transports/BUILD @@ -6,40 +6,74 @@ cc_library( name = "libhoth_device", srcs = ["libhoth_device.c"], hdrs = ["libhoth_device.h"], + include_prefix = "libhoth/transports", + strip_include_prefix = ".", deps = [ "//protocol:libhoth_status", ], ) +cc_library( + name = "libhoth_device_headers_legacy", + hdrs = [ + "libhoth_device.h", + "libhoth_ec.h", + ], + include_prefix = "transports", + strip_include_prefix = ".", +) + cc_library( name = "libhoth_ec", hdrs = ["libhoth_ec.h"], + include_prefix = "libhoth/transports", + strip_include_prefix = ".", ) cc_library( name = "libhoth_mtd", srcs = ["libhoth_mtd.c"], hdrs = ["libhoth_mtd.h"], + include_prefix = "libhoth/transports", + strip_include_prefix = ".", deps = [ ":libhoth_device", ":libhoth_ec", ], ) +cc_library( + name = "libhoth_mtd_headers_legacy", + hdrs = ["libhoth_mtd.h"], + include_prefix = "transports", + strip_include_prefix = ".", +) + cc_library( name = "libhoth_spi", srcs = ["libhoth_spi.c"], hdrs = ["libhoth_spi.h"], + include_prefix = "libhoth/transports", + strip_include_prefix = ".", deps = [ ":libhoth_device", ":libhoth_ec", ], ) +cc_library( + name = "libhoth_spi_headers_legacy", + hdrs = ["libhoth_spi.h"], + include_prefix = "transports", + strip_include_prefix = ".", +) + cc_library( name = "libhoth_usb", srcs = ["libhoth_usb.c"], hdrs = ["libhoth_usb.h"], + include_prefix = "libhoth/transports", + strip_include_prefix = ".", deps = [ ":libhoth_device", ":libhoth_usb_device", @@ -48,15 +82,34 @@ cc_library( ], ) +cc_library( + name = "libhoth_usb_headers_legacy", + hdrs = [ + "libhoth_usb.h", + "libhoth_usb_device.h", + ], + include_prefix = "transports", + strip_include_prefix = ".", +) + cc_library( name = "libhoth_dbus", srcs = ["libhoth_dbus.c"], hdrs = ["libhoth_dbus.h"], + include_prefix = "libhoth/transports", + strip_include_prefix = ".", defines = ["DBUS_BACKEND"], linkopts = ["-lsystemd"], deps = [":libhoth_device"], ) +cc_library( + name = "libhoth_dbus_headers_legacy", + hdrs = ["libhoth_dbus.h"], + include_prefix = "transports", + strip_include_prefix = ".", +) + cc_library( name = "libhoth_usb_device", srcs = [ @@ -64,6 +117,8 @@ cc_library( "libhoth_usb_mailbox.c", ], hdrs = ["libhoth_usb_device.h"], + include_prefix = "libhoth/transports", + strip_include_prefix = ".", deps = [ ":libhoth_device", ":libhoth_ec", @@ -72,6 +127,6 @@ cc_library( ) filegroup( - name = "headers", - srcs = glob(["*.h"]) + name = "headers", + srcs = glob(["*.h"]), )