使用 makefile 安装时询问问题

发布于 2024-11-13 11:06:21 字数 461 浏览 2 评论 0原文

我正在尝试为我的库创建一个安装文件,该文件有 3 个部分,其中第 2 部分依赖于第 1 部分,第 3 部分依赖于第 2 部分和第 1 部分。

可能有人只想安装一个部分,现在是 makefile应该检查是否已经在前缀位置安装了其他必需的部件,如果没有,则询问用户是否确定安装该部件?

例如要安装第 2 部分,makefile 应检查第 1 部分是否已安装,如果未安装,则询问“您确定要在第 1 部分之前安装第 2 部分吗?”

我应该补充一点,make 文件中已经有 4 个目标,makepart1makepart2makepart3make all< /代码>。如果有人安装第 3 部分而不安装第 2 部分或第 1 部分,那么没有问题,但我想验证这一点,因为有人可能安装了错误的部分,

我该怎么办? 任何想法都会受到赞赏

I am trying to create an installation file for my library which has 3 parts, which part2 is depended to part 1 and part 3 is depended to part 2 and part 1.

It is possible that someone wants to install only one part, now the makefile should check is already installed the other required parts in the prefix location or not, and if not ask question if the user is sure to install that part?

for example to install part 2, the makefile should check whether part 1 is installed or not, and if it is not install ask "are you sure to install part 2 before part1?"

I should add that already in the make file there are 4 targets, make part1, make part2, make part3 and make all. And there is no problem if someone install part3 without installing part2 or 1, but I wanna to verify that cuz it is possible that someone install a wrong part

how can I do that?
any Idea will be apreciated

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

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

发布评论

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

评论(2

天涯离梦残月幽梦 2024-11-20 11:06:21

这是不好的形式。让运行 make 的人将变量传递给它,其中包含适当的值。

This is bad form. Have the person running make pass variables to it instead, containing the appropriate values.

烟凡古楼 2024-11-20 11:06:21

据我所知,要安装 part2 make 必须安装 part1part2。这必须声明为依赖项。那么 part3 依赖于 part2,这意味着 make part3 必须安装所有三个部分:part1,因为 part2 依赖于它,而 part2 则因为 part3 依赖于 part3

这样,all 目标必须依赖于 part3,并且所有内容都将被安装。

make 不应提出问题,而是自动解析依赖项。如果用户想要安装 part3,则还必须安装其依赖项;不然就不行了,不是吗?

As I see it, to install part2 make has to install both part1 and part2. This must be declared as dependency. Then part3 depends on part2, which means make part3 has to install all three parts: part1 because part2 depends on it, and part2 because part3 depends on part3.

This way, all target must depend on part3, and everything will be installed.

make should not ask questions but resolve the dependencies automatically. If user wants to install part3, then its dependencies must also be installed; otherwise it won't work, will it?

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