blob: 459c89bdcb3d36624b8160a6361b75eb9f1f7146 [file] [log] [blame]
Lorenz Brun40025ff2021-08-31 13:06:02 +02001# Copyright 2021 The Monogon Project Authors.
2#
3# SPDX-License-Identifier: Apache-2.0
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17load("@rules_cc//cc:defs.bzl", "cc_library")
18load("@io_bazel_rules_go//go:def.bzl", "go_binary")
19
20cc_library(
21 name = "cap",
22 srcs = [
23 "cap_alloc.c",
24 "cap_extint.c",
25 "cap_file.c",
26 "cap_flag.c",
27 "cap_proc.c",
28 "cap_text.c",
29 ] + glob(["include/sys/*.h"]), # UAPI is intentionally excluded as we want it from our own kernel headers
30 hdrs = ["libcap.h", ":cap_names.h"],
31 visibility = ["//visibility:public"],
32 includes = [".", "include"],
33)
34
35go_binary(
36 name = "makenames",
37 srcs = ["makenames.go"],
38)
39
40genrule(
41 name = "cap_names_hdr",
42 srcs = [
43 "include/uapi/linux/capability.h",
44 ],
45 outs = [
46 "cap_names.h",
47 ],
48 cmd = "$(location :makenames) \"$(location include/uapi/linux/capability.h)\" \"$@\"",
49 tools = [
50 ":makenames",
51 ],
52)