template(「 gcc_toolchain」){
工具鏈(target_name){
斷言(已定義(invoker.cc),「 gcc工具鏈必須指定一個\「 cc \」值「)
斷言(已定義(invoker.cxx),「 gcc工具鏈必須指定一個\「 cxx \」值「)
斷言(已定義(invoker.ld),「 gcc工具鏈必須指定一個\「 ld \」值「)
斷言(已定義(invoker.ar),「 gcc工具鏈必須指定一個\「 ar \」值「)
斷言(定義(invoker.as),「「工具鏈必須指定一個\」 as \「值」)
斷言(定義(invoker.cp),「「工具鏈必須指定一個\「 cp \」值」)
ar = invoker.ar
as =調用者
cc = invoker.cc
cxx = invoker.cxx
ld = invoker.ld
cp = invoker.cp
need_strip =否
if(defined(invoker.strip)){
剝離= invoker.strip
need_strip = true
}
如果(defined(invoker.extra_
ldflags)&&invoker.extra_ldflags!=「」){
extra_ldflags =「」
}其他{
extra_ldflags =「」
}
工具(「 cc」){
命令=「 $ cc -c {{cflags}} {{defines}} {{include_dirs}} {{cflags_c}}」 +
#「 -MMD -MP -MF'{{source_out_dir}} / {{source_name_part}}。d'」 +
#「 -Wa,-a,-ad,-alms = {{source_out_dir}} / {{source_name_part}}。lst」 +
「 {{source}} -o {{output}}」
depsformat =「 gcc」
description =「跨編譯器{{output}}」
輸出= [
「 {{source_out_dir}} / {{source_name_part}}。o」,
]
}
工具(「 cxx」){
depfile =「 {{output}}。d」
命令=「 $ cxx -c {{cflags}} {{defines}} {{include_dirs}} {{cflags_c}}」 +
#「 -MMD -MP -MF'{{source_out_dir}} / {{source_name_part}}。d'」 +
#「 -Wa,-a,-ad,-alms = {{source_out_dir}} / {{source_name_part}}。lst」 +
「 {{source}} -o {{output}}」
depsformat =「 gcc」
description =「 CXX {{output}}」
輸出= [
「 {{source_out_dir}} / {{target_output_name}}。{{source_name_part}}。o」,
]
}
工具(「 asm」){
depfile =「 {{output}}。d」
command =「 $ as -c {{cflags}} {{defines}} {{include_dirs}} {{asmflags}} {{source}} {{cflags_c}}」 +
「 -o {{輸出}}」
depsformat =「 gcc」
description =「跨編譯器{{output}}」
輸出= [
「 {{source_out_dir}} / {{source_name_part}}。o」
]
}
工具(「連結」){
outfile =「 {{output_dir}} / {{target_output_name}} {{output_extension}}」
rspfile =「 {{output}}。rsp」
rspfile_content =「 {{inputs}}」
命令=「 $ ar cr {{輸出}} @ \」 $ rspfile \「」
description =「 AR {{output}}」
輸出= [
超越
]
default_output_dir =「 {{root_out_dir}} / libs」
default_output_extension =「 .a」
output_prefix =「 lib」
}
工具(「連結」){
outfile =「 {{output_dir}} / bin / {{target_output_name}}。elf」
rspfile =「 $ outfile.rsp」
command =「 $ ld {{inputs}} {{ldflags}} $ extra_ldflags -specs = nano.specs」 +
#在供應商路徑中設置ld文件補丁
「 -lc -lm -lnosys {{libs}} -Wl,-Map = {{target_output_name}}。map,-cref」 +
「 -Wl,-gc-sections -o $ outfile」
if(need_strip){
命令+ =「 && $ cp -O二進位-S $ outfile {{output_dir}} / bin / {{target_output_name}}。bin」
}
description =「 LINK $ outfile」
default_output_dir =「 {{root_out_dir}}」
rspfile_content =「 {{inputs}}」
輸出= [
超越
]
}
工具(「郵票」){
如果(host_os ==「 win」){
命令=「 cmd / c類型nul> \」 {{輸出}} \「」
}其他{
命令=「 / usr / bin / touch {{輸出}}」
}
description =「 STAMP {{output}}」
}
工具(「複製」){
命令=「 $ cp -O二進位-S {{源}} {{輸出}}。bin && echo $ strip」
description =「 COPY {{源}} {{輸出}}」
}
}