./configure make && make install

  linux源代码编译安装的三个过程:configure,  make , make install

  1. ./configure  

    configure 是一个可执行脚本,有很多选项,可以执行 ./configure  --help 列出, configure的作用是检测安装平台的目标特征,比如检测编译器是什么版本,最后生成一个符合目标平台的编译脚本makefile。

       ./configure --prefix = /usr/local/xxx 指定是将软件安装到指定的目录/usr/local/xxx下。另外一个额外的好处是方便卸载软件和移植,卸载只需要删除xxx文件夹,移植将文件打包烤至目标主机即可。

  2. make 

    编译过程。根据第一步生成的makefile脚本编译源代码、

  3. make install (需要root权限,向系统写文件)

    安装(有些软件需要先运行 make check 或 make test来进行一些测试),将编译出来的程序、依赖库、文档拷贝至指定的xxx目标。

      如果在configure后面没有指定 --prefix目录, 默认将可执行文件放到 /usr/loceal/bin , 库文件/usr/local/lib , 配置文件 /usr/local/etc  ,其他资源文件 /usr/local/share

参考: https://thoughtbot.com/blog/the-magic-behind-configure-make-make-install

原文地址:https://www.cnblogs.com/Zhangyq-yard/p/10969963.html