• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2016 The Bazel Authors. All rights reserved.
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
15# This becomes the BUILD file for @local_config_cc// under non-FreeBSD unixes.
16
17package(default_visibility = ["//visibility:public"])
18
19load(":cc_toolchain_config.bzl", "cc_toolchain_config")
20
21licenses(["notice"])  # Apache 2.0
22
23cc_library(
24    name = "malloc",
25)
26
27filegroup(
28    name = "empty",
29    srcs = [],
30)
31
32filegroup(
33    name = "cc_wrapper",
34    srcs = ["cc_wrapper.sh"],
35)
36
37filegroup(
38    name = "compiler_deps",
39    srcs = glob(["extra_tools/**"]) + [":empty"],
40)
41
42# This is the entry point for --crosstool_top.  Toolchains are found
43# by lopping off the name of --crosstool_top and searching for
44# the "${CPU}" entry in the toolchains attribute.
45cc_toolchain_suite(
46    name = "toolchain",
47    toolchains = {
48        "k8|clang": ":cc-compiler-k8",
49        "k8": ":cc-compiler-k8",
50        "armeabi-v7a|compiler": ":cc-compiler-armeabi-v7a",
51        "armeabi-v7a": ":cc-compiler-armeabi-v7a",
52    },
53)
54
55cc_toolchain(
56    name = "cc-compiler-k8",
57    all_files = ":compiler_deps",
58    ar_files = ":empty",
59    as_files = ":empty",
60    compiler_files = ":compiler_deps",
61    dwp_files = ":empty",
62    linker_files = ":compiler_deps",
63    objcopy_files = ":empty",
64    strip_files = ":empty",
65    supports_param_files = 1,
66    toolchain_config = ":linux_gnu_x86",
67    toolchain_identifier = "linux_gnu_x86",
68)
69
70cc_toolchain_config(
71    name = "linux_gnu_x86",
72    compiler = "clang",
73    cpu = "k8",
74)
75
76toolchain(
77    name = "cc-toolchain-k8",
78    exec_compatible_with = [
79        # TODO(katre): add autodiscovered constraints for host CPU and OS.
80    ],
81    target_compatible_with = [
82        # TODO(katre): add autodiscovered constraints for host CPU and OS.
83    ],
84    toolchain = ":cc-compiler-k8",
85    toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
86)
87
88# Android tooling requires a default toolchain for the armeabi-v7a cpu.
89cc_toolchain(
90    name = "cc-compiler-armeabi-v7a",
91    all_files = ":empty",
92    ar_files = ":empty",
93    as_files = ":empty",
94    compiler_files = ":empty",
95    dwp_files = ":empty",
96    linker_files = ":empty",
97    objcopy_files = ":empty",
98    strip_files = ":empty",
99    supports_param_files = 1,
100    toolchain_config = ":stub_armeabi-v7a",
101    toolchain_identifier = "stub_armeabi-v7a",
102)
103
104cc_toolchain_config(
105    name = "stub_armeabi-v7a",
106    compiler = "compiler",
107    cpu = "armeabi-v7a",
108)
109
110toolchain(
111    name = "cc-toolchain-armeabi-v7a",
112    exec_compatible_with = [
113        # TODO(katre): add autodiscovered constraints for host CPU and OS.
114    ],
115    target_compatible_with = [
116        "@bazel_tools//platforms:arm",
117        "@bazel_tools//platforms:android",
118    ],
119    toolchain = ":cc-compiler-armabi-v7a",
120    toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
121)
122