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 15package( 16 default_visibility = ["//visibility:public"], 17) 18 19cc_library( 20 name = "libufdt_c", 21 srcs = [ 22 "ufdt_convert.c", 23 "ufdt_node.c", 24 "ufdt_node_pool.c", 25 "ufdt_overlay.c", 26 "ufdt_prop_dict.c", 27 ] + select({ 28 "@gbl//toolchain:gbl_rust_host_x86_64": ["sysdeps/libufdt_sysdeps_posix.c"], 29 "//conditions:default": [ 30 "sysdeps/libufdt_sysdeps_vendor.c", 31 # Contains noop placeholder for dto_print from libufdt_sysdeps_vendor.c 32 "@gbl//libfdt:deps/print.c", 33 ], 34 }), 35 hdrs = [ 36 "include/libufdt.h", 37 "include/ufdt_node_pool.h", 38 "include/ufdt_overlay.h", 39 "include/ufdt_overlay_internal.h", 40 "include/ufdt_types.h", 41 "sysdeps/include/libufdt_sysdeps.h", 42 "ufdt_prop_dict.h", 43 ], 44 copts = [ 45 # Disable default dto_print implementation to include libufdt_sysdeps_vendor.c 46 "-DDTO_DISABLE_DEFAULT_VENDOR_LIBC_PRINT", 47 # Disable default dto_malloc, dto_free implementations to include libufdt_sysdeps_vendor.c 48 "-DDTO_DISABLE_DEFAULT_VENDOR_LIBC_ALLOCATION", 49 # Disable default dto_malloc, dto_free implementations to include libufdt_sysdeps_posix.c 50 "-DDTO_DISABLE_DEFAULT_POSIX_LIBC_ALLOCATION", 51 ], 52 includes = [ 53 ".", 54 "include", 55 "sysdeps/include", 56 ], 57 deps = [ 58 "@gbl//libc:headers", 59 "@libfdt_c", 60 ], 61) 62