我可以指示bazel发出".elf"消息吗?后缀为可执行文件? [英] Can I instruct bazel to emit a ".elf" suffix to executables?
问题描述
cc_binary
(在osx/linux上)创建不带后缀的可执行文件.这是有道理的,因为这些平台上的标准是不使用扩展.
cc_binary
(on osx / linux) creates executables with no suffix. This makes sense, since the standard on those platforms is to not use extensions.
但是,当通过自定义CROSSTOOL将Bazel用作交叉编译器时,我希望Bazel发出带有显式.elf
后缀的elf文件.
When using Bazel as a cross-compiler through a custom CROSSTOOL, though, I'd like Bazel to emit an elf file with an explicit .elf
suffix.
通过CROSSTOOL或自定义的重命名"规则是否可行?
Is this possible, either through CROSSTOOL or a custom "rename" rule?
推荐答案
您可以将cc_binary命名为"foo.elf",而bazel将会对其进行构建.或者,您也可以使用genrule进行重命名.
You can name your cc_binary 'foo.elf' and bazel will just build it. Or you can use genrule to do the renaming afterwards.
现在,如果您需要使用多个工具链来构建相同的cc_binary,并且每次生成不同的扩展名,那将更加棘手.但是genrule也可以在那里工作.
Now if you need to build the same cc_binary with multiple toolchains, each time producing a different extension, that's a little bit more tricky. But genrule will work there too.
这篇关于我可以指示bazel发出".elf"消息吗?后缀为可执行文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!