1# Copyright (C) 2024 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15load("@rules_cc//cc:defs.bzl", "cc_library") 16 17package( 18 default_visibility = ["//visibility:public"], 19) 20 21cc_library( 22 name = "libufdt_c", 23 srcs = [ 24 "ufdt_convert.c", 25 "ufdt_node.c", 26 "ufdt_node_pool.c", 27 "ufdt_overlay.c", 28 "ufdt_prop_dict.c", 29 "@gbl//libfdt:deps/print.c", 30 ] + select({ 31 "@gbl//toolchain:gbl_rust_host_x86_64": ["sysdeps/libufdt_sysdeps_posix.c"], 32 "//conditions:default": [ 33 "sysdeps/libufdt_sysdeps_vendor.c", 34 ], 35 }), 36 hdrs = [ 37 "include/libufdt.h", 38 "include/ufdt_node_pool.h", 39 "include/ufdt_overlay.h", 40 "include/ufdt_overlay_internal.h", 41 "include/ufdt_types.h", 42 "sysdeps/include/libufdt_sysdeps.h", 43 "ufdt_prop_dict.h", 44 ], 45 copts = [ 46 # Disable default dto_print implementation to include libufdt_sysdeps_vendor.c 47 "-DDTO_DISABLE_DEFAULT_VENDOR_LIBC_PRINT", 48 # Disable default dto_malloc, dto_free implementations to include libufdt_sysdeps_vendor.c 49 "-DDTO_DISABLE_DEFAULT_VENDOR_LIBC_ALLOCATION", 50 # Disable default dto_print implementation to include libufdt_sysdeps_posix.c 51 "-DDTO_DISABLE_DEFAULT_POSIX_LIBC_PRINT", 52 # Disable default dto_malloc, dto_free implementations to include libufdt_sysdeps_posix.c 53 "-DDTO_DISABLE_DEFAULT_POSIX_LIBC_ALLOCATION", 54 ], 55 includes = [ 56 ".", 57 "include", 58 "sysdeps/include", 59 ], 60 deps = [ 61 "@gbl//libc:headers", 62 "@libfdt_c", 63 ], 64) 65