Can I instruct bazel to emit a “.elf” suffix to executables?

回眸只為那壹抹淺笑 提交于 2019-12-11 10:35:33

问题


cc_binary (on osx / linux) creates executables with no suffix. This makes sense, since the standard on those platforms is to not use extensions.

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.

Is this possible, either through CROSSTOOL or a custom "rename" rule?


回答1:


You can name your cc_binary 'foo.elf' and bazel will just build it. Or you can use genrule to do the renaming afterwards.

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.



来源:https://stackoverflow.com/questions/45598017/can-i-instruct-bazel-to-emit-a-elf-suffix-to-executables

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!