1*eed53cd4SHONG Yifan# Copyright 2018 The Bazel Authors. All rights reserved. 2*eed53cd4SHONG Yifan# 3*eed53cd4SHONG Yifan# Licensed under the Apache License, Version 2.0 (the "License"); 4*eed53cd4SHONG Yifan# you may not use this file except in compliance with the License. 5*eed53cd4SHONG Yifan# You may obtain a copy of the License at 6*eed53cd4SHONG Yifan# 7*eed53cd4SHONG Yifan# http://www.apache.org/licenses/LICENSE-2.0 8*eed53cd4SHONG Yifan# 9*eed53cd4SHONG Yifan# Unless required by applicable law or agreed to in writing, software 10*eed53cd4SHONG Yifan# distributed under the License is distributed on an "AS IS" BASIS, 11*eed53cd4SHONG Yifan# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*eed53cd4SHONG Yifan# See the License for the specific language governing permissions and 13*eed53cd4SHONG Yifan# limitations under the License. 14*eed53cd4SHONG Yifan"""Constants for action names used for C++ rules.""" 15*eed53cd4SHONG Yifan 16*eed53cd4SHONG Yifan# Keep in sync with //cc/toolchains/actions:BUILD. 17*eed53cd4SHONG Yifan 18*eed53cd4SHONG Yifan# Name for the C compilation action. 19*eed53cd4SHONG YifanC_COMPILE_ACTION_NAME = "c-compile" 20*eed53cd4SHONG Yifan 21*eed53cd4SHONG Yifan# Name of the C++ compilation action. 22*eed53cd4SHONG YifanCPP_COMPILE_ACTION_NAME = "c++-compile" 23*eed53cd4SHONG Yifan 24*eed53cd4SHONG Yifan# Name of the linkstamp-compile action. 25*eed53cd4SHONG YifanLINKSTAMP_COMPILE_ACTION_NAME = "linkstamp-compile" 26*eed53cd4SHONG Yifan 27*eed53cd4SHONG Yifan# Name of the action used to compute CC_FLAGS make variable. 28*eed53cd4SHONG YifanCC_FLAGS_MAKE_VARIABLE_ACTION_NAME = "cc-flags-make-variable" 29*eed53cd4SHONG Yifan 30*eed53cd4SHONG Yifan# Name of the C++ module codegen action. 31*eed53cd4SHONG YifanCPP_MODULE_CODEGEN_ACTION_NAME = "c++-module-codegen" 32*eed53cd4SHONG Yifan 33*eed53cd4SHONG Yifan# Name of the C++ header parsing action. 34*eed53cd4SHONG YifanCPP_HEADER_PARSING_ACTION_NAME = "c++-header-parsing" 35*eed53cd4SHONG Yifan 36*eed53cd4SHONG Yifan# Name of the C++ module compile action. 37*eed53cd4SHONG YifanCPP_MODULE_COMPILE_ACTION_NAME = "c++-module-compile" 38*eed53cd4SHONG Yifan 39*eed53cd4SHONG Yifan# Name of the assembler action. 40*eed53cd4SHONG YifanASSEMBLE_ACTION_NAME = "assemble" 41*eed53cd4SHONG Yifan 42*eed53cd4SHONG Yifan# Name of the assembly preprocessing action. 43*eed53cd4SHONG YifanPREPROCESS_ASSEMBLE_ACTION_NAME = "preprocess-assemble" 44*eed53cd4SHONG Yifan 45*eed53cd4SHONG Yifan# Name of the action producing ThinLto index. 46*eed53cd4SHONG YifanLTO_INDEXING_ACTION_NAME = "lto-indexing" 47*eed53cd4SHONG Yifan 48*eed53cd4SHONG Yifan# Name of the action producing ThinLto index for executable. 49*eed53cd4SHONG YifanLTO_INDEX_FOR_EXECUTABLE_ACTION_NAME = "lto-index-for-executable" 50*eed53cd4SHONG Yifan 51*eed53cd4SHONG Yifan# Name of the action producing ThinLto index for dynamic library. 52*eed53cd4SHONG YifanLTO_INDEX_FOR_DYNAMIC_LIBRARY_ACTION_NAME = "lto-index-for-dynamic-library" 53*eed53cd4SHONG Yifan 54*eed53cd4SHONG Yifan# Name of the action producing ThinLto index for nodeps dynamic library. 55*eed53cd4SHONG YifanLTO_INDEX_FOR_NODEPS_DYNAMIC_LIBRARY_ACTION_NAME = "lto-index-for-nodeps-dynamic-library" 56*eed53cd4SHONG Yifan 57*eed53cd4SHONG Yifan# Name of the action compiling lto bitcodes into native objects. 58*eed53cd4SHONG YifanLTO_BACKEND_ACTION_NAME = "lto-backend" 59*eed53cd4SHONG Yifan 60*eed53cd4SHONG Yifan# Name of the link action producing executable binary. 61*eed53cd4SHONG YifanCPP_LINK_EXECUTABLE_ACTION_NAME = "c++-link-executable" 62*eed53cd4SHONG Yifan 63*eed53cd4SHONG Yifan# Name of the link action producing dynamic library. 64*eed53cd4SHONG YifanCPP_LINK_DYNAMIC_LIBRARY_ACTION_NAME = "c++-link-dynamic-library" 65*eed53cd4SHONG Yifan 66*eed53cd4SHONG Yifan# Name of the link action producing dynamic library that doesn't include it's 67*eed53cd4SHONG Yifan# transitive dependencies. 68*eed53cd4SHONG YifanCPP_LINK_NODEPS_DYNAMIC_LIBRARY_ACTION_NAME = "c++-link-nodeps-dynamic-library" 69*eed53cd4SHONG Yifan 70*eed53cd4SHONG Yifan# Name of the archiving action producing static library. 71*eed53cd4SHONG YifanCPP_LINK_STATIC_LIBRARY_ACTION_NAME = "c++-link-static-library" 72*eed53cd4SHONG Yifan 73*eed53cd4SHONG Yifan# Name of the action stripping the binary. 74*eed53cd4SHONG YifanSTRIP_ACTION_NAME = "strip" 75*eed53cd4SHONG Yifan 76*eed53cd4SHONG Yifan# A string constant for the objc compilation action. 77*eed53cd4SHONG YifanOBJC_COMPILE_ACTION_NAME = "objc-compile" 78*eed53cd4SHONG Yifan 79*eed53cd4SHONG Yifan# A string constant for the objc++ compile action. 80*eed53cd4SHONG YifanOBJCPP_COMPILE_ACTION_NAME = "objc++-compile" 81*eed53cd4SHONG Yifan 82*eed53cd4SHONG Yifan# A string constant for the objc executable link action. 83*eed53cd4SHONG YifanOBJC_EXECUTABLE_ACTION_NAME = "objc-executable" 84*eed53cd4SHONG Yifan 85*eed53cd4SHONG Yifan# A string constant for the objc fully-link link action. 86*eed53cd4SHONG YifanOBJC_FULLY_LINK_ACTION_NAME = "objc-fully-link" 87*eed53cd4SHONG Yifan 88*eed53cd4SHONG Yifan# A string constant for the clif action. 89*eed53cd4SHONG YifanCLIF_MATCH_ACTION_NAME = "clif-match" 90*eed53cd4SHONG Yifan 91*eed53cd4SHONG YifanACTION_NAMES = struct( 92*eed53cd4SHONG Yifan c_compile = C_COMPILE_ACTION_NAME, 93*eed53cd4SHONG Yifan cpp_compile = CPP_COMPILE_ACTION_NAME, 94*eed53cd4SHONG Yifan linkstamp_compile = LINKSTAMP_COMPILE_ACTION_NAME, 95*eed53cd4SHONG Yifan cc_flags_make_variable = CC_FLAGS_MAKE_VARIABLE_ACTION_NAME, 96*eed53cd4SHONG Yifan cpp_module_codegen = CPP_MODULE_CODEGEN_ACTION_NAME, 97*eed53cd4SHONG Yifan cpp_header_parsing = CPP_HEADER_PARSING_ACTION_NAME, 98*eed53cd4SHONG Yifan cpp_module_compile = CPP_MODULE_COMPILE_ACTION_NAME, 99*eed53cd4SHONG Yifan assemble = ASSEMBLE_ACTION_NAME, 100*eed53cd4SHONG Yifan preprocess_assemble = PREPROCESS_ASSEMBLE_ACTION_NAME, 101*eed53cd4SHONG Yifan lto_indexing = LTO_INDEXING_ACTION_NAME, 102*eed53cd4SHONG Yifan lto_backend = LTO_BACKEND_ACTION_NAME, 103*eed53cd4SHONG Yifan lto_index_for_executable = LTO_INDEX_FOR_EXECUTABLE_ACTION_NAME, 104*eed53cd4SHONG Yifan lto_index_for_dynamic_library = LTO_INDEX_FOR_DYNAMIC_LIBRARY_ACTION_NAME, 105*eed53cd4SHONG Yifan lto_index_for_nodeps_dynamic_library = LTO_INDEX_FOR_NODEPS_DYNAMIC_LIBRARY_ACTION_NAME, 106*eed53cd4SHONG Yifan cpp_link_executable = CPP_LINK_EXECUTABLE_ACTION_NAME, 107*eed53cd4SHONG Yifan cpp_link_dynamic_library = CPP_LINK_DYNAMIC_LIBRARY_ACTION_NAME, 108*eed53cd4SHONG Yifan cpp_link_nodeps_dynamic_library = CPP_LINK_NODEPS_DYNAMIC_LIBRARY_ACTION_NAME, 109*eed53cd4SHONG Yifan cpp_link_static_library = CPP_LINK_STATIC_LIBRARY_ACTION_NAME, 110*eed53cd4SHONG Yifan strip = STRIP_ACTION_NAME, 111*eed53cd4SHONG Yifan objc_compile = OBJC_COMPILE_ACTION_NAME, 112*eed53cd4SHONG Yifan objc_executable = OBJC_EXECUTABLE_ACTION_NAME, 113*eed53cd4SHONG Yifan objc_fully_link = OBJC_FULLY_LINK_ACTION_NAME, 114*eed53cd4SHONG Yifan objcpp_compile = OBJCPP_COMPILE_ACTION_NAME, 115*eed53cd4SHONG Yifan clif_match = CLIF_MATCH_ACTION_NAME, 116*eed53cd4SHONG Yifan) 117*eed53cd4SHONG Yifan 118*eed53cd4SHONG Yifan# Names of actions that parse or compile C++ code. 119*eed53cd4SHONG YifanALL_CPP_COMPILE_ACTION_NAMES = [ 120*eed53cd4SHONG Yifan ACTION_NAMES.linkstamp_compile, 121*eed53cd4SHONG Yifan ACTION_NAMES.cpp_compile, 122*eed53cd4SHONG Yifan ACTION_NAMES.cpp_header_parsing, 123*eed53cd4SHONG Yifan ACTION_NAMES.cpp_module_compile, 124*eed53cd4SHONG Yifan ACTION_NAMES.cpp_module_codegen, 125*eed53cd4SHONG Yifan ACTION_NAMES.lto_backend, 126*eed53cd4SHONG Yifan ACTION_NAMES.clif_match, 127*eed53cd4SHONG Yifan] 128*eed53cd4SHONG Yifan 129*eed53cd4SHONG Yifan# Names of actions that parse or compile C, C++ and assembly code. 130*eed53cd4SHONG YifanALL_CC_COMPILE_ACTION_NAMES = ALL_CPP_COMPILE_ACTION_NAMES + [ 131*eed53cd4SHONG Yifan ACTION_NAMES.c_compile, 132*eed53cd4SHONG Yifan ACTION_NAMES.preprocess_assemble, 133*eed53cd4SHONG Yifan ACTION_NAMES.assemble, 134*eed53cd4SHONG Yifan] 135*eed53cd4SHONG Yifan 136*eed53cd4SHONG Yifan# Names of actions that link C, C++ and assembly code. 137*eed53cd4SHONG YifanALL_CC_LINK_ACTION_NAMES = [ 138*eed53cd4SHONG Yifan ACTION_NAMES.cpp_link_executable, 139*eed53cd4SHONG Yifan ACTION_NAMES.cpp_link_dynamic_library, 140*eed53cd4SHONG Yifan ACTION_NAMES.cpp_link_nodeps_dynamic_library, 141*eed53cd4SHONG Yifan ACTION_NAMES.lto_index_for_executable, 142*eed53cd4SHONG Yifan ACTION_NAMES.lto_index_for_dynamic_library, 143*eed53cd4SHONG Yifan ACTION_NAMES.lto_index_for_nodeps_dynamic_library, 144*eed53cd4SHONG Yifan] 145*eed53cd4SHONG Yifan 146*eed53cd4SHONG Yifan# Names of actions that link entire programs. 147*eed53cd4SHONG YifanCC_LINK_EXECUTABLE_ACTION_NAMES = [ 148*eed53cd4SHONG Yifan ACTION_NAMES.cpp_link_executable, 149*eed53cd4SHONG Yifan ACTION_NAMES.lto_index_for_executable, 150*eed53cd4SHONG Yifan] 151*eed53cd4SHONG Yifan 152*eed53cd4SHONG Yifan# Names of actions that link dynamic libraries. 153*eed53cd4SHONG YifanDYNAMIC_LIBRARY_LINK_ACTION_NAMES = [ 154*eed53cd4SHONG Yifan ACTION_NAMES.cpp_link_dynamic_library, 155*eed53cd4SHONG Yifan ACTION_NAMES.cpp_link_nodeps_dynamic_library, 156*eed53cd4SHONG Yifan ACTION_NAMES.lto_index_for_dynamic_library, 157*eed53cd4SHONG Yifan ACTION_NAMES.lto_index_for_nodeps_dynamic_library, 158*eed53cd4SHONG Yifan] 159*eed53cd4SHONG Yifan 160*eed53cd4SHONG Yifan# Names of actions that link nodeps dynamic libraries. 161*eed53cd4SHONG YifanNODEPS_DYNAMIC_LIBRARY_LINK_ACTION_NAMES = [ 162*eed53cd4SHONG Yifan ACTION_NAMES.cpp_link_nodeps_dynamic_library, 163*eed53cd4SHONG Yifan ACTION_NAMES.lto_index_for_nodeps_dynamic_library, 164*eed53cd4SHONG Yifan] 165*eed53cd4SHONG Yifan 166*eed53cd4SHONG Yifan# Names of actions that link transitive dependencies. 167*eed53cd4SHONG YifanTRANSITIVE_LINK_ACTION_NAMES = [ 168*eed53cd4SHONG Yifan ACTION_NAMES.cpp_link_executable, 169*eed53cd4SHONG Yifan ACTION_NAMES.cpp_link_dynamic_library, 170*eed53cd4SHONG Yifan ACTION_NAMES.lto_index_for_executable, 171*eed53cd4SHONG Yifan ACTION_NAMES.lto_index_for_dynamic_library, 172*eed53cd4SHONG Yifan] 173*eed53cd4SHONG Yifan 174*eed53cd4SHONG YifanACTION_NAME_GROUPS = struct( 175*eed53cd4SHONG Yifan all_cc_compile_actions = ALL_CC_COMPILE_ACTION_NAMES, 176*eed53cd4SHONG Yifan all_cc_link_actions = ALL_CC_LINK_ACTION_NAMES, 177*eed53cd4SHONG Yifan all_cpp_compile_actions = ALL_CPP_COMPILE_ACTION_NAMES, 178*eed53cd4SHONG Yifan cc_link_executable_actions = CC_LINK_EXECUTABLE_ACTION_NAMES, 179*eed53cd4SHONG Yifan dynamic_library_link_actions = DYNAMIC_LIBRARY_LINK_ACTION_NAMES, 180*eed53cd4SHONG Yifan nodeps_dynamic_library_link_actions = NODEPS_DYNAMIC_LIBRARY_LINK_ACTION_NAMES, 181*eed53cd4SHONG Yifan transitive_link_actions = TRANSITIVE_LINK_ACTION_NAMES, 182*eed53cd4SHONG Yifan) 183