gnu make-断言特定的命令行工具可用

发布于 2025-02-10 02:57:09 字数 194 浏览 1 评论 0原文

在makefile中,我如何确保某些工具(例如gcovlcovg ++)在执行其他目标之前可用?

我想优雅地失败

gcov/lcov/g ++不可用

In a makefile, how would I make sure that certain tools like gcov, lcov, g++ are available before executing any other targets?

I want to gracefully fail with

gcov/lcov/g++ not available

.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时间你老了 2025-02-17 02:57:09

您可以尝试类似的事情:

TOOLS := gcov lcov g++

$(foreach TOOL,$(TOOLS),\
    $(if $(shell command -v $(TOOL)),,\
        $(error Cannot locate $(TOOL) on PATH)))

这显然是在使用Posix Shell。

You could try something like:

TOOLS := gcov lcov g++

$(foreach TOOL,$(TOOLS),\
    $(if $(shell command -v $(TOOL)),,\
        $(error Cannot locate $(TOOL) on PATH)))

This assumes you're using a POSIX shell obviously.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文