使用 makefile 安装时询问问题
我正在尝试为我的库创建一个安装文件,该文件有 3 个部分,其中第 2 部分依赖于第 1 部分,第 3 部分依赖于第 2 部分和第 1 部分。
可能有人只想安装一个部分,现在是 makefile应该检查是否已经在前缀位置安装了其他必需的部件,如果没有,则询问用户是否确定安装该部件?
例如要安装第 2 部分,makefile 应检查第 1 部分是否已安装,如果未安装,则询问“您确定要在第 1 部分之前安装第 2 部分吗?”
我应该补充一点,make 文件中已经有 4 个目标,makepart1
、makepart2
、makepart3
和 make 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是不好的形式。让运行 make 的人将变量传递给它,其中包含适当的值。
This is bad form. Have the person running make pass variables to it instead, containing the appropriate values.
据我所知,要安装
part2
make 必须安装part1
和part2
。这必须声明为依赖项。那么part3
依赖于part2
,这意味着make part3
必须安装所有三个部分:part1
,因为part2
依赖于它,而part2
则因为part3
依赖于part3
。这样,
all
目标必须依赖于part3
,并且所有内容都将被安装。make
不应提出问题,而是自动解析依赖项。如果用户想要安装part3
,则还必须安装其依赖项;不然就不行了,不是吗?As I see it, to install
part2
make has to install bothpart1
andpart2
. This must be declared as dependency. Thenpart3
depends onpart2
, which meansmake part3
has to install all three parts:part1
becausepart2
depends on it, andpart2
becausepart3
depends onpart3
.This way,
all
target must depend onpart3
, and everything will be installed.make
should not ask questions but resolve the dependencies automatically. If user wants to installpart3
, then its dependencies must also be installed; otherwise it won't work, will it?