| # Copyright (c) 2024 Project CHIP Authors |
| # |
| # 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. |
| |
| declare_args() { |
| zephyr_ar = "" |
| zephyr_cc = "" |
| zephyr_cxx = "" |
| } |
| |
| toolchain("zephyr") { |
| tool("cc") { |
| depfile = "{{output}}.d" |
| command = "\"${zephyr_cc}\" -MMD -MF \"$depfile\" {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c \"{{source}}\" -o \"{{output}}\"" |
| depsformat = "gcc" |
| outputs = |
| [ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ] |
| description = "CC {{output}}" |
| } |
| |
| tool("cxx") { |
| depfile = "{{output}}.d" |
| command = "\"${zephyr_cxx}\" -MMD -MF \"$depfile\" {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c \"{{source}}\" -o \"{{output}}\"" |
| depsformat = "gcc" |
| outputs = |
| [ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ] |
| description = "CXX {{output}}" |
| } |
| |
| tool("asm") { |
| depfile = "{{output}}.d" |
| command = "\"${zephyr_cc}\" -MMD -MF \"$depfile\" {{defines}} {{include_dirs}} {{asmflags}} -c \"{{source}}\" -o \"{{output}}\"" |
| depsformat = "gcc" |
| outputs = |
| [ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ] |
| description = "ASM {{output}}" |
| } |
| |
| tool("alink") { |
| rspfile = "{{output}}.rsp" |
| rspfile_content = "{{inputs}}" |
| command = |
| "rm -f \"{{output}}\" && ${zephyr_ar} rcs \"{{output}}\" @$rspfile" |
| outputs = [ "{{output_dir}}/{{target_output_name}}{{output_extension}}" ] |
| default_output_extension = ".a" |
| default_output_dir = "{{root_out_dir}}/lib" |
| output_prefix = "lib" |
| description = "AR {{output}}" |
| } |
| |
| tool("link") { |
| outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" |
| rspfile = "$outfile.rsp" |
| rspfile_content = "{{inputs}}" |
| command = "\"${zephyr_cxx}\" {{ldflags}} -o \"$outfile\" -Wl,--start-group @$rspfile {{solibs}} {{libs}} -Wl,--end-group" |
| outputs = [ outfile ] |
| default_output_dir = "{{root_out_dir}}/bin" |
| description = "LINK {{output}}" |
| } |
| |
| tool("solink") { |
| outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" |
| rspfile = "$outfile.rsp" |
| rspfile_content = "{{inputs}}" |
| command = "\"${zephyr_cxx}\" -shared {{ldflags}} -o \"$outfile\" -Wl,--start-group @$rspfile {{solibs}} {{libs}} -Wl,--end-group" |
| outputs = [ outfile ] |
| default_output_extension = ".so" |
| default_output_dir = "{{root_out_dir}}/lib" |
| output_prefix = "lib" |
| description = "SOLINK {{output}}" |
| } |
| |
| tool("stamp") { |
| command = "touch {{output}}" |
| description = "STAMP {{output}}" |
| } |
| |
| tool("copy") { |
| command = "cp -af \"{{source}}\" \"{{output}}\"" |
| description = "COPY {{source}} {{output}}" |
| } |
| |
| toolchain_args = { |
| current_os = "zephyr" |
| is_clang = false |
| } |
| } |