1load("//bazel:defs.bzl", "compatible_with_rp2") 2 3package(default_visibility = ["//visibility:public"]) 4 5alias( 6 name = "pico_printf", 7 actual = select({ 8 "//bazel/constraint:pico_printf_pico_enabled": ":pico_printf_pico", 9 "//bazel/constraint:pico_printf_compiler_enabled": ":pico_printf_compiler", 10 "//conditions:default": ":pico_printf_none", 11 }), 12) 13 14cc_library( 15 name = "pico_printf_pico", 16 srcs = ["printf.c"], 17 hdrs = ["include/pico/printf.h"], 18 defines = ["LIB_PICO_PRINTF_PICO=1"], 19 includes = ["include"], 20 linkopts = [ 21 "-Wl,--wrap=sprintf", 22 "-Wl,--wrap=snprintf", 23 "-Wl,--wrap=vsnprintf", 24 ], 25 target_compatible_with = compatible_with_rp2(), 26 deps = [ 27 "//src/common/pico_base_headers", 28 "//src/rp2_common:pico_platform_internal", 29 ], 30 alwayslink = True, # Ensures the wrapped symbols are linked in. 31) 32 33cc_library( 34 name = "pico_printf_compiler", 35 hdrs = ["include/pico/printf.h"], 36 includes = ["include"], 37 target_compatible_with = compatible_with_rp2(), 38 deps = [ 39 "//src/common/pico_base_headers", 40 "//src/rp2_common:pico_platform_internal", 41 ], 42) 43 44cc_library( 45 name = "pico_printf_none", 46 srcs = ["printf_none.S"], 47 hdrs = ["include/pico/printf.h"], 48 defines = [ 49 "LIB_PICO_PRINTF_PICO=0", 50 "LIB_PICO_PRINTF_NONE=1", 51 ], 52 includes = ["include"], 53 linkopts = [ 54 "-Wl,--wrap=sprintf", 55 "-Wl,--wrap=snprintf", 56 "-Wl,--wrap=vsnprintf", 57 ], 58 target_compatible_with = compatible_with_rp2(), 59 deps = [ 60 "//src/common/pico_base_headers", 61 "//src/rp2_common:pico_platform_internal", 62 "//src/rp2_common/pico_bootrom", 63 ], 64 alwayslink = True, # Ensures the wrapped symbols are linked in. 65) 66