1load("@bazel_skylib//rules/directory:directory.bzl", "directory") 2load("@bazel_skylib//rules/directory:subdirectory.bzl", "subdirectory") 3load("@rules_cc//cc/toolchains:tool.bzl", "cc_tool") 4load("@rules_cc//cc/toolchains:tool_map.bzl", "cc_tool_map") 5load("@rules_cc//cc/toolchains:args.bzl", "cc_args") 6load("@rules_cc//cc/toolchains:args_list.bzl", "cc_args_list") 7 8 9package(default_visibility = ["//visibility:public"]) 10 11cc_tool_map( 12 name = "all_tools", 13 tools = { 14 "@rules_cc//cc/toolchains/actions:assembly_actions": ":asm", 15 "@rules_cc//cc/toolchains/actions:c_compile": ":arm-none-eabi-gcc", 16 "@rules_cc//cc/toolchains/actions:cpp_compile_actions": ":arm-none-eabi-g++", 17 "@rules_cc//cc/toolchains/actions:link_actions": ":arm-none-eabi-ld", 18 "@rules_cc//cc/toolchains/actions:objcopy_embed_data": ":arm-none-eabi-objcopy", 19 "@rules_cc//cc/toolchains/actions:strip": ":arm-none-eabi-strip", 20 "@rules_cc//cc/toolchains/actions:ar_actions": ":arm-none-eabi-ar", 21 }, 22) 23 24# TODO: https://github.com/bazelbuild/rules_cc/issues/235 - Workaround until 25# Bazel has a more robust way to implement `cc_tool_map`. 26alias( 27 name = "asm", 28 actual = ":arm-none-eabi-gcc", 29) 30 31cc_tool( 32 name = "arm-none-eabi-ar", 33 src = select({ 34 "@platforms//os:windows": "//:bin/arm-none-eabi-ar.exe", 35 "//conditions:default": "//:bin/arm-none-eabi-ar", 36 }), 37) 38 39cc_tool( 40 name = "arm-none-eabi-g++", 41 src = select({ 42 "@platforms//os:windows": "//:bin/arm-none-eabi-g++.exe", 43 "//conditions:default": "//:bin/arm-none-eabi-g++", 44 }), 45 data = glob([ 46 "**/*.spec", 47 "**/*.specs", 48 "arm-none-eabi/include/**", 49 "lib/gcc/arm-none-eabi/*/include/**", 50 "lib/gcc/arm-none-eabi/*/include-fixed/**", 51 "libexec/**", 52 ]), 53) 54 55cc_tool( 56 name = "arm-none-eabi-gcc", 57 src = select({ 58 "@platforms//os:windows": "//:bin/arm-none-eabi-gcc.exe", 59 "//conditions:default": "//:bin/arm-none-eabi-gcc", 60 }), 61 data = glob([ 62 "**/*.spec", 63 "**/*.specs", 64 "arm-none-eabi/include/**", 65 "lib/gcc/arm-none-eabi/*/include/**", 66 "lib/gcc/arm-none-eabi/*/include-fixed/**", 67 "libexec/**", 68 ]) + 69 # The assembler needs to be explicitly added. Note that the path is 70 # intentionally different here as `as` is called from arm-none-eabi-gcc. 71 # `arm-none-eabi-as` will not suffice for this context. 72 select({ 73 "@platforms//os:windows": ["//:arm-none-eabi/bin/as.exe"], 74 "//conditions:default": ["//:arm-none-eabi/bin/as"], 75 }), 76) 77 78# This tool is actually just g++ under the hood, but this specifies a 79# different set of data files to pull into the sandbox at runtime. 80cc_tool( 81 name = "arm-none-eabi-ld", 82 src = select({ 83 "@platforms//os:windows": "//:bin/arm-none-eabi-g++.exe", 84 "//conditions:default": "//:bin/arm-none-eabi-g++", 85 }), 86 data = glob([ 87 "**/*.a", 88 "**/*.ld", 89 "**/*.o", 90 "**/*.spec", 91 "**/*.specs", 92 "**/*.so", 93 "libexec/**", 94 ]), 95) 96 97cc_tool( 98 name = "arm-none-eabi-objcopy", 99 src = select({ 100 "@platforms//os:windows": "//:bin/arm-none-eabi-objcopy.exe", 101 "//conditions:default": "//:bin/arm-none-eabi-objcopy", 102 }), 103) 104 105cc_tool( 106 name = "arm-none-eabi-strip", 107 src = select({ 108 "@platforms//os:windows": "//:bin/arm-none-eabi-strip.exe", 109 "//conditions:default": "//:bin/arm-none-eabi-strip", 110 }), 111) 112 113cc_tool( 114 name = "arm-none-eabi-objdump", 115 src = select({ 116 "@platforms//os:windows": "//:bin/arm-none-eabi-objdump.exe", 117 "//conditions:default": "//:bin/arm-none-eabi-objdump", 118 }), 119) 120 121# There is not yet a well-known action type for objdump. 122 123cc_tool( 124 name = "arm-none-eabi-gcov", 125 src = select({ 126 "@platforms//os:windows": "//:bin/arm-none-eabi-gcov.exe", 127 "//conditions:default": "//:bin/arm-none-eabi-gcov", 128 }), 129) 130 131# There is not yet a well-known action type for gcov. 132