1# Copyright 2018 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"""Constants for action names used for C++ rules.""" 15 16# Keep in sync with //cc/toolchains/actions:BUILD. 17 18# Name for the C compilation action. 19C_COMPILE_ACTION_NAME = "c-compile" 20 21# Name of the C++ compilation action. 22CPP_COMPILE_ACTION_NAME = "c++-compile" 23 24# Name of the linkstamp-compile action. 25LINKSTAMP_COMPILE_ACTION_NAME = "linkstamp-compile" 26 27# Name of the action used to compute CC_FLAGS make variable. 28CC_FLAGS_MAKE_VARIABLE_ACTION_NAME = "cc-flags-make-variable" 29 30# Name of the C++ module codegen action. 31CPP_MODULE_CODEGEN_ACTION_NAME = "c++-module-codegen" 32 33# Name of the C++ header parsing action. 34CPP_HEADER_PARSING_ACTION_NAME = "c++-header-parsing" 35 36# Name of the C++ deps scanning action. 37CPP_MODULE_DEPS_SCANNING_ACTION_NAME = "c++-module-deps-scanning" 38 39# Name of the C++ module compile action. 40CPP20_MODULE_COMPILE_ACTION_NAME = "c++20-module-compile" 41CPP20_MODULE_CODEGEN_ACTION_NAME = "c++20-module-codegen" 42 43# Name of the C++ module compile action. 44CPP_MODULE_COMPILE_ACTION_NAME = "c++-module-compile" 45 46# Name of the assembler action. 47ASSEMBLE_ACTION_NAME = "assemble" 48 49# Name of the assembly preprocessing action. 50PREPROCESS_ASSEMBLE_ACTION_NAME = "preprocess-assemble" 51 52LLVM_COV = "llvm-cov" 53 54# Name of the action producing ThinLto index. 55LTO_INDEXING_ACTION_NAME = "lto-indexing" 56 57# Name of the action producing ThinLto index for executable. 58LTO_INDEX_FOR_EXECUTABLE_ACTION_NAME = "lto-index-for-executable" 59 60# Name of the action producing ThinLto index for dynamic library. 61LTO_INDEX_FOR_DYNAMIC_LIBRARY_ACTION_NAME = "lto-index-for-dynamic-library" 62 63# Name of the action producing ThinLto index for nodeps dynamic library. 64LTO_INDEX_FOR_NODEPS_DYNAMIC_LIBRARY_ACTION_NAME = "lto-index-for-nodeps-dynamic-library" 65 66# Name of the action compiling lto bitcodes into native objects. 67LTO_BACKEND_ACTION_NAME = "lto-backend" 68 69# Name of the link action producing executable binary. 70CPP_LINK_EXECUTABLE_ACTION_NAME = "c++-link-executable" 71 72# Name of the link action producing dynamic library. 73CPP_LINK_DYNAMIC_LIBRARY_ACTION_NAME = "c++-link-dynamic-library" 74 75# Name of the link action producing dynamic library that doesn't include it's 76# transitive dependencies. 77CPP_LINK_NODEPS_DYNAMIC_LIBRARY_ACTION_NAME = "c++-link-nodeps-dynamic-library" 78 79# Name of the archiving action producing static library. 80CPP_LINK_STATIC_LIBRARY_ACTION_NAME = "c++-link-static-library" 81 82# Name of the action stripping the binary. 83STRIP_ACTION_NAME = "strip" 84 85# A string constant for the objc compilation action. 86OBJC_COMPILE_ACTION_NAME = "objc-compile" 87 88# A string constant for the objc++ compile action. 89OBJCPP_COMPILE_ACTION_NAME = "objc++-compile" 90 91# A string constant for the objc executable link action. 92OBJC_EXECUTABLE_ACTION_NAME = "objc-executable" 93 94# A string constant for the objc fully-link link action. 95OBJC_FULLY_LINK_ACTION_NAME = "objc-fully-link" 96 97# A string constant for the clif actions. 98CLIF_MATCH_ACTION_NAME = "clif-match" 99 100# A string constant for the obj copy actions. 101OBJ_COPY_ACTION_NAME = "objcopy_embed_data" 102 103# A string constant for the validation action for cc_static_library. 104VALIDATE_STATIC_LIBRARY = "validate-static-library" 105 106ACTION_NAMES = struct( 107 c_compile = C_COMPILE_ACTION_NAME, 108 cpp_compile = CPP_COMPILE_ACTION_NAME, 109 linkstamp_compile = LINKSTAMP_COMPILE_ACTION_NAME, 110 cc_flags_make_variable = CC_FLAGS_MAKE_VARIABLE_ACTION_NAME, 111 cpp_module_codegen = CPP_MODULE_CODEGEN_ACTION_NAME, 112 cpp_header_parsing = CPP_HEADER_PARSING_ACTION_NAME, 113 cpp_module_deps_scanning = CPP_MODULE_DEPS_SCANNING_ACTION_NAME, 114 cpp20_module_compile = CPP20_MODULE_COMPILE_ACTION_NAME, 115 cpp20_module_codegen = CPP20_MODULE_CODEGEN_ACTION_NAME, 116 cpp_module_compile = CPP_MODULE_COMPILE_ACTION_NAME, 117 assemble = ASSEMBLE_ACTION_NAME, 118 preprocess_assemble = PREPROCESS_ASSEMBLE_ACTION_NAME, 119 llvm_cov = LLVM_COV, 120 lto_indexing = LTO_INDEXING_ACTION_NAME, 121 lto_backend = LTO_BACKEND_ACTION_NAME, 122 lto_index_for_executable = LTO_INDEX_FOR_EXECUTABLE_ACTION_NAME, 123 lto_index_for_dynamic_library = LTO_INDEX_FOR_DYNAMIC_LIBRARY_ACTION_NAME, 124 lto_index_for_nodeps_dynamic_library = LTO_INDEX_FOR_NODEPS_DYNAMIC_LIBRARY_ACTION_NAME, 125 cpp_link_executable = CPP_LINK_EXECUTABLE_ACTION_NAME, 126 cpp_link_dynamic_library = CPP_LINK_DYNAMIC_LIBRARY_ACTION_NAME, 127 cpp_link_nodeps_dynamic_library = CPP_LINK_NODEPS_DYNAMIC_LIBRARY_ACTION_NAME, 128 cpp_link_static_library = CPP_LINK_STATIC_LIBRARY_ACTION_NAME, 129 strip = STRIP_ACTION_NAME, 130 objc_compile = OBJC_COMPILE_ACTION_NAME, 131 objc_executable = OBJC_EXECUTABLE_ACTION_NAME, 132 objc_fully_link = OBJC_FULLY_LINK_ACTION_NAME, 133 objcpp_compile = OBJCPP_COMPILE_ACTION_NAME, 134 clif_match = CLIF_MATCH_ACTION_NAME, 135 objcopy_embed_data = OBJ_COPY_ACTION_NAME, 136 validate_static_library = VALIDATE_STATIC_LIBRARY, 137) 138 139# Names of actions that parse or compile C++ code. 140ALL_CPP_COMPILE_ACTION_NAMES = [ 141 ACTION_NAMES.linkstamp_compile, 142 ACTION_NAMES.cpp_compile, 143 ACTION_NAMES.cpp_header_parsing, 144 ACTION_NAMES.cpp_module_compile, 145 ACTION_NAMES.cpp_module_codegen, 146 ACTION_NAMES.lto_backend, 147 ACTION_NAMES.clif_match, 148] 149 150# Names of actions that parse or compile C, C++ and assembly code. 151ALL_CC_COMPILE_ACTION_NAMES = ALL_CPP_COMPILE_ACTION_NAMES + [ 152 ACTION_NAMES.c_compile, 153 ACTION_NAMES.preprocess_assemble, 154 ACTION_NAMES.assemble, 155] 156 157# Names of actions that link C, C++ and assembly code. 158ALL_CC_LINK_ACTION_NAMES = [ 159 ACTION_NAMES.cpp_link_executable, 160 ACTION_NAMES.cpp_link_dynamic_library, 161 ACTION_NAMES.cpp_link_nodeps_dynamic_library, 162 ACTION_NAMES.lto_index_for_executable, 163 ACTION_NAMES.lto_index_for_dynamic_library, 164 ACTION_NAMES.lto_index_for_nodeps_dynamic_library, 165] 166 167# Names of actions that link entire programs. 168CC_LINK_EXECUTABLE_ACTION_NAMES = [ 169 ACTION_NAMES.cpp_link_executable, 170 ACTION_NAMES.lto_index_for_executable, 171] 172 173# Names of actions that link dynamic libraries. 174DYNAMIC_LIBRARY_LINK_ACTION_NAMES = [ 175 ACTION_NAMES.cpp_link_dynamic_library, 176 ACTION_NAMES.cpp_link_nodeps_dynamic_library, 177 ACTION_NAMES.lto_index_for_dynamic_library, 178 ACTION_NAMES.lto_index_for_nodeps_dynamic_library, 179] 180 181# Names of actions that link nodeps dynamic libraries. 182NODEPS_DYNAMIC_LIBRARY_LINK_ACTION_NAMES = [ 183 ACTION_NAMES.cpp_link_nodeps_dynamic_library, 184 ACTION_NAMES.lto_index_for_nodeps_dynamic_library, 185] 186 187# Names of actions that link transitive dependencies. 188TRANSITIVE_LINK_ACTION_NAMES = [ 189 ACTION_NAMES.cpp_link_executable, 190 ACTION_NAMES.cpp_link_dynamic_library, 191 ACTION_NAMES.lto_index_for_executable, 192 ACTION_NAMES.lto_index_for_dynamic_library, 193] 194 195ACTION_NAME_GROUPS = struct( 196 all_cc_compile_actions = ALL_CC_COMPILE_ACTION_NAMES, 197 all_cc_link_actions = ALL_CC_LINK_ACTION_NAMES, 198 all_cpp_compile_actions = ALL_CPP_COMPILE_ACTION_NAMES, 199 cc_link_executable_actions = CC_LINK_EXECUTABLE_ACTION_NAMES, 200 dynamic_library_link_actions = DYNAMIC_LIBRARY_LINK_ACTION_NAMES, 201 nodeps_dynamic_library_link_actions = NODEPS_DYNAMIC_LIBRARY_LINK_ACTION_NAMES, 202 transitive_link_actions = TRANSITIVE_LINK_ACTION_NAMES, 203) 204