今天在安装redis的时候发现官方的文档上没有说要执行make install,直接cd 到src 目录里面执行redis-server
文件就能启动。
而看很多别人的笔记呢,则都写了make install
,发现实际就是把src目录下的几个二进制文件复制到了系统的/usr/local/bin
下面了而已。
查了下似乎是说make install
执行的是Makefile
里面的脚本。
实际的作用也就是上面说的复制二进制文件么?
只是以redis的安装为例,主要是问安装程序时候的make install
make install
(对make
命令来说)字面意思就是达成install
这个目标。这个目标既然叫install
, of course, perform the software installation.In UNIX-like systems, software installation usually optionally includes the following steps:
strip
Remove unnecessary symbols from binary code filesSome UNIX-like system software does not require installation. You can use it directly by executing the executable file. Some are not like this. For example, the configuration files and resource files required by the software are not copied to the corresponding locations. The software including the dynamic link library needs to update the dynamic link library cache. Otherwise, an error will occur because the dynamic link library just compiled cannot be found, etc. wait.
Excerpted from the official README:
Similarly,
Excerpted from https://github.com/antirez/redis/blob/3.0/Makefile
But this is just to execute the
make install
under the src directory.After looking at the Makefile in the src/ folder, I executed the
install
command with /usr/local/bin as the directory parameter (default) for many things (please allow me not to list them one by one).Remarks: Adding a parameter after make usually executes a certain target in the Makefile. For example,
make install
就是执行Makefile中install:
is to execute a set of commands belowinstall:
in the Makefile.So
install
命令是什么呢?man install
what is the command?man install
and you will know: