xingao | 03d52e2 | 2017-11-21 08:20:29 -0800 | [diff] [blame] | 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 | |
aldersondrive | 644b7d41 | 2020-01-10 07:48:15 -0800 | [diff] [blame] | 15 | # This becomes the BUILD file for @local_config_cc// under non-BSD unixes. |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 16 | |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 17 | load(":cc_toolchain_config.bzl", "cc_toolchain_config") |
rosica | beaba92 | 2019-05-20 02:36:26 -0700 | [diff] [blame] | 18 | load(":armeabi_cc_toolchain_config.bzl", "armeabi_cc_toolchain_config") |
oquenchil | 9606887 | 2019-07-08 07:01:39 -0700 | [diff] [blame] | 19 | load("@rules_cc//cc:defs.bzl", "cc_toolchain", "cc_toolchain_suite") |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 20 | |
Xavier Bonaventura | 36116ce | 2021-04-06 02:23:40 -0700 | [diff] [blame] | 21 | package(default_visibility = ["//visibility:public"]) |
| 22 | |
xingao | de65ce9 | 2017-12-20 07:59:30 -0800 | [diff] [blame] | 23 | licenses(["notice"]) # Apache 2.0 |
| 24 | |
Damien Martin-Guillerez | 8fa5ae6 | 2016-03-02 16:24:13 +0000 | [diff] [blame] | 25 | cc_library( |
| 26 | name = "malloc", |
| 27 | ) |
| 28 | |
Damien Martin-Guillerez | 8fa5ae6 | 2016-03-02 16:24:13 +0000 | [diff] [blame] | 29 | filegroup( |
| 30 | name = "empty", |
| 31 | srcs = [], |
| 32 | ) |
| 33 | |
Damien Martin-Guillerez | 6dab815 | 2016-05-06 12:44:26 +0000 | [diff] [blame] | 34 | filegroup( |
| 35 | name = "cc_wrapper", |
| 36 | srcs = ["cc_wrapper.sh"], |
| 37 | ) |
| 38 | |
Ilya Biryukov | 12471a7 | 2017-12-20 05:46:44 -0800 | [diff] [blame] | 39 | filegroup( |
| 40 | name = "compiler_deps", |
Marcel Hlopko | 8b0bfaf | 2019-09-02 08:13:18 -0700 | [diff] [blame] | 41 | srcs = glob(["extra_tools/**"], allow_empty = True) + [%{cc_compiler_deps}], |
Ilya Biryukov | 12471a7 | 2017-12-20 05:46:44 -0800 | [diff] [blame] | 42 | ) |
| 43 | |
Damien Martin-Guillerez | 8fa5ae6 | 2016-03-02 16:24:13 +0000 | [diff] [blame] | 44 | # This is the entry point for --crosstool_top. Toolchains are found |
| 45 | # by lopping off the name of --crosstool_top and searching for |
| 46 | # the "${CPU}" entry in the toolchains attribute. |
| 47 | cc_toolchain_suite( |
| 48 | name = "toolchain", |
| 49 | toolchains = { |
Nicolas Lopez | bcbdb87 | 2017-03-28 08:08:50 +0000 | [diff] [blame] | 50 | "%{name}|%{compiler}": ":cc-compiler-%{name}", |
rosica | 547bf42 | 2018-09-06 02:10:02 -0700 | [diff] [blame] | 51 | "%{name}": ":cc-compiler-%{name}", |
Alex Humesky | f787d31 | 2016-05-03 21:41:34 +0000 | [diff] [blame] | 52 | "armeabi-v7a|compiler": ":cc-compiler-armeabi-v7a", |
rosica | 547bf42 | 2018-09-06 02:10:02 -0700 | [diff] [blame] | 53 | "armeabi-v7a": ":cc-compiler-armeabi-v7a", |
Damien Martin-Guillerez | 8fa5ae6 | 2016-03-02 16:24:13 +0000 | [diff] [blame] | 54 | }, |
| 55 | ) |
| 56 | |
| 57 | cc_toolchain( |
| 58 | name = "cc-compiler-%{name}", |
hlopko | 6bc4528 | 2018-10-18 02:17:37 -0700 | [diff] [blame] | 59 | toolchain_identifier = "%{cc_toolchain_identifier}", |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 60 | toolchain_config = ":%{cc_toolchain_identifier}", |
Ilya Biryukov | 12471a7 | 2017-12-20 05:46:44 -0800 | [diff] [blame] | 61 | all_files = ":compiler_deps", |
rosica | 44a961b | 2019-06-06 00:17:06 -0700 | [diff] [blame] | 62 | ar_files = ":compiler_deps", |
| 63 | as_files = ":compiler_deps", |
Ilya Biryukov | 12471a7 | 2017-12-20 05:46:44 -0800 | [diff] [blame] | 64 | compiler_files = ":compiler_deps", |
Damien Martin-Guillerez | 8fa5ae6 | 2016-03-02 16:24:13 +0000 | [diff] [blame] | 65 | dwp_files = ":empty", |
Ilya Biryukov | 12471a7 | 2017-12-20 05:46:44 -0800 | [diff] [blame] | 66 | linker_files = ":compiler_deps", |
Damien Martin-Guillerez | 8fa5ae6 | 2016-03-02 16:24:13 +0000 | [diff] [blame] | 67 | objcopy_files = ":empty", |
Damien Martin-Guillerez | 8fa5ae6 | 2016-03-02 16:24:13 +0000 | [diff] [blame] | 68 | strip_files = ":empty", |
Keith Smiley | f08819b | 2020-11-12 03:13:54 -0800 | [diff] [blame] | 69 | supports_param_files = 1, |
hlopko | 8b9f746 | 2020-05-26 05:39:52 -0700 | [diff] [blame] | 70 | module_map = %{modulemap}, |
Damien Martin-Guillerez | 8fa5ae6 | 2016-03-02 16:24:13 +0000 | [diff] [blame] | 71 | ) |
| 72 | |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 73 | cc_toolchain_config( |
| 74 | name = "%{cc_toolchain_identifier}", |
| 75 | cpu = "%{target_cpu}", |
| 76 | compiler = "%{compiler}", |
rosica | 96500b7 | 2019-05-21 03:25:53 -0700 | [diff] [blame] | 77 | toolchain_identifier = "%{cc_toolchain_identifier}", |
| 78 | host_system_name = "%{host_system_name}", |
| 79 | target_system_name = "%{target_system_name}", |
| 80 | target_libc = "%{target_libc}", |
| 81 | abi_version = "%{abi_version}", |
| 82 | abi_libc_version = "%{abi_libc_version}", |
| 83 | cxx_builtin_include_directories = [%{cxx_builtin_include_directories}], |
| 84 | tool_paths = {%{tool_paths}}, |
| 85 | compile_flags = [%{compile_flags}], |
| 86 | opt_compile_flags = [%{opt_compile_flags}], |
| 87 | dbg_compile_flags = [%{dbg_compile_flags}], |
| 88 | cxx_flags = [%{cxx_flags}], |
| 89 | link_flags = [%{link_flags}], |
Marcel Hlopko | ab9c1f5 | 2019-06-19 00:45:58 -0700 | [diff] [blame] | 90 | link_libs = [%{link_libs}], |
rosica | 96500b7 | 2019-05-21 03:25:53 -0700 | [diff] [blame] | 91 | opt_link_flags = [%{opt_link_flags}], |
| 92 | unfiltered_compile_flags = [%{unfiltered_compile_flags}], |
| 93 | coverage_compile_flags = [%{coverage_compile_flags}], |
| 94 | coverage_link_flags = [%{coverage_link_flags}], |
| 95 | supports_start_end_lib = %{supports_start_end_lib}, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 96 | ) |
| 97 | |
Damien Martin-Guillerez | 8fa5ae6 | 2016-03-02 16:24:13 +0000 | [diff] [blame] | 98 | # Android tooling requires a default toolchain for the armeabi-v7a cpu. |
| 99 | cc_toolchain( |
| 100 | name = "cc-compiler-armeabi-v7a", |
hlopko | c3fb1db | 2018-10-09 20:40:58 -0700 | [diff] [blame] | 101 | toolchain_identifier = "stub_armeabi-v7a", |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 102 | toolchain_config = ":stub_armeabi-v7a", |
Damien Martin-Guillerez | 8fa5ae6 | 2016-03-02 16:24:13 +0000 | [diff] [blame] | 103 | all_files = ":empty", |
Googler | 28953cb | 2018-12-05 10:46:00 -0800 | [diff] [blame] | 104 | ar_files = ":empty", |
| 105 | as_files = ":empty", |
Damien Martin-Guillerez | 8fa5ae6 | 2016-03-02 16:24:13 +0000 | [diff] [blame] | 106 | compiler_files = ":empty", |
Damien Martin-Guillerez | 8fa5ae6 | 2016-03-02 16:24:13 +0000 | [diff] [blame] | 107 | dwp_files = ":empty", |
Damien Martin-Guillerez | 8fa5ae6 | 2016-03-02 16:24:13 +0000 | [diff] [blame] | 108 | linker_files = ":empty", |
| 109 | objcopy_files = ":empty", |
Damien Martin-Guillerez | 8fa5ae6 | 2016-03-02 16:24:13 +0000 | [diff] [blame] | 110 | strip_files = ":empty", |
| 111 | supports_param_files = 1, |
| 112 | ) |
Cal Peyser | f026e14 | 2016-12-19 18:16:26 +0000 | [diff] [blame] | 113 | |
rosica | beaba92 | 2019-05-20 02:36:26 -0700 | [diff] [blame] | 114 | armeabi_cc_toolchain_config(name = "stub_armeabi-v7a") |