Linux “安装”与“安装干净”?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8556125/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 03:43:01  来源:igfitidea点击:

"Make install" vs "Make install clean"?

linuxunixinstallationmakefile

提问by

In *nix, when I compile software, when should I do:

在*nix中,当我编译软件时,我应该什么时候做:

# make install

vs

对比

# make install clean

?

?

回答by aculich

When you call makewith arguments, you are giving it a list of targets.

当您make使用参数调用时,您将给它一个target列表。

There is some discussion of this in the Upgrading Ports section of the FreeBSD Handbookwhere it says:

FreeBSD 手册升级端口部分对此进行了一些讨论,其中说:

Unlike the usual make install clean command, it will upgrade all
the dependencies prior to building and installing the selected
port.

[...]

Note: You can save two extra steps by just running make install
clean instead of make, make install and make clean as three
separate steps.

Also, as a side note: Don't build your package as root unless you really need to. In general you should work in an unprivileged account and then as a final step you can do sudo make installif you have to. It would be better, though, to add the unprivileged user to a group with write-access to the install directories, or even better to install it into a non-system area (for example, with ./configureyou can use --prefix=) since most systems, whether Linux or BSD, usually have packages and a packaging system that is used to install software.

另外,作为旁注:除非您确实需要,否则不要以 root 身份构建您的包。通常,您应该在非特权帐户中工作,然后作为最后一步,sudo make install如果需要,您可以这样做。但是,最好将非特权用户添加到对安装目录具有写访问权限的组中,或者甚至更好地将其安装到非系统区域(例如,./configure您可以使用--prefix=),因为大多数系统,无论是Linux 或 BSD,通常有用于安装软件的包和打包系统。