# Copyright (C) 2024 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. package( default_visibility = ["//visibility:public"], ) cc_library( name = "libufdt_c", srcs = [ "ufdt_convert.c", "ufdt_node.c", "ufdt_node_pool.c", "ufdt_overlay.c", "ufdt_prop_dict.c", ] + select({ "@gbl//toolchain:gbl_rust_host_x86_64": ["sysdeps/libufdt_sysdeps_posix.c"], "//conditions:default": [ "sysdeps/libufdt_sysdeps_vendor.c", # Contains noop placeholder for dto_print from libufdt_sysdeps_vendor.c "@gbl//libfdt:deps/print.c", ], }), hdrs = [ "include/libufdt.h", "include/ufdt_node_pool.h", "include/ufdt_overlay.h", "include/ufdt_overlay_internal.h", "include/ufdt_types.h", "sysdeps/include/libufdt_sysdeps.h", "ufdt_prop_dict.h", ], copts = [ # Disable default dto_print implementation to include libufdt_sysdeps_vendor.c "-DDTO_DISABLE_DEFAULT_VENDOR_LIBC_PRINT", # Disable default dto_malloc, dto_free implementations to include libufdt_sysdeps_vendor.c "-DDTO_DISABLE_DEFAULT_VENDOR_LIBC_ALLOCATION", # Disable default dto_malloc, dto_free implementations to include libufdt_sysdeps_posix.c "-DDTO_DISABLE_DEFAULT_POSIX_LIBC_ALLOCATION", ], includes = [ ".", "include", "sysdeps/include", ], deps = [ "@gbl//libc:headers", "@libfdt_c", ], )