blob: 8f60930e2385c16d40851654d6ed09d99c42de9b [file] [edit]
# Copyright 2022 Comcast Cable Communications Management, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
# Copyright 2021 The Cobalt Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/toolchain/gcc_toolchain.gni")
template("rdk_gcc_toolchain") {
gcc_toolchain(target_name) {
assert(defined(invoker.envprefix), "please specify \"envprefix\"")
envprefix = invoker.envprefix
_cc_env = string_split(getenv(envprefix + "CC"))
_cxx_env = string_split(getenv(envprefix + "CXX"))
_ar_env = string_split(getenv(envprefix + "AR"))
cc = _cc_env[0]
cxx = _cxx_env[0]
ld = cxx
ar = _ar_env[0]
extra_cflags = string_join(" ", _cc_env - [ _cc_env[0] ])
extra_cxxflags = string_join(" ", _cxx_env - [ _cxx_env[0] ])
extra_ldflags = extra_cxxflags
extra_asmflags = extra_cflags
extra_cflags += " " + getenv(envprefix + "CFLAGS")
extra_cxxflags += " " + getenv(envprefix + "CXXFLAGS")
extra_ldflags += " " + getenv(envprefix + "LDFLAGS")
forward_variables_from(invoker, "*", [ "toolchain_args" ])
toolchain_args = {
if (defined(invoker.toolchain_args)) {
forward_variables_from(invoker.toolchain_args, "*")
}
is_clang = false
}
}
}