load("@rules_cc//cc:cc_library.bzl", "cc_library")

package(
    default_visibility = [
        "@//:android_cuttlefish",
        "@wmediumd//:__subpackages__",
    ],
)

cc_library(
    name = "libnl",
    srcs = [
        "include/base/nl-base-utils.h",
        "include/config.h",
        "include/nl-default.h",
        "lib/addr.c",
        "lib/attr.c",
        "lib/cache.c",
        "lib/cache_mngr.c",
        "lib/cache_mngt.c",
        "lib/data.c",
        "lib/error.c",
        "lib/fib_lookup/lookup.c",
        "lib/fib_lookup/request.c",
        "lib/genl/ctrl.c",
        "lib/genl/family.c",
        "lib/genl/genl.c",
        "lib/genl/mngt.c",
        "lib/genl/nl-genl.h",
        "lib/handlers.c",
        "lib/hash.c",
        "lib/hashtable.c",
        "lib/mpls.c",
        "lib/mpls.h",
        "lib/msg.c",
        "lib/netfilter/nfnl.c",
        "lib/netfilter/nl-netfilter.h",
        "lib/nl.c",
        "lib/nl-core.h",
        "lib/object.c",
        "lib/route/addr.c",
        "lib/route/link.c",
        "lib/route/link-sriov.h",
        "lib/route/link/api.c",
        "lib/route/link/link-api.h",
        "lib/route/link/macsec.c",
        "lib/route/link/macvlan.c",
        "lib/route/link/sriov.c",
        "lib/route/link/vlan.c",
        "lib/route/nexthop.c",
        "lib/route/nexthop_encap.c",
        "lib/route/nexthop-encap.h",
        "lib/route/nh_encap_mpls.c",
        "lib/route/nl-route.h",
        "lib/route/route.c",
        "lib/route/route_obj.c",
        "lib/route/route_utils.c",
        "lib/route/rtnl.c",
        "lib/route/tc-api.h",
        "lib/socket.c",
        "lib/utils.c",
        "lib/version.c",
    ] + glob(["include/nl-*/*.h"]),
    includes = [
        "include",
        "lib/route",
    ],
    hdrs = glob([
        "include/netlink/**/*.h",
    ]),
    strip_include_prefix = "include",
    defines = [
        "_GNU_SOURCE",
        "_NL_SYSCONFDIR_LIBNL=\"\\\"/etc/libnl\\\"\"",
    ],
    conlyopts = ["-std=gnu11"],
    deps = ["@//linux_headers"],
)
