核心:install就是把可执行文件拷贝到bin目录下。
参考
man install
INSTALL(1) User Commands INSTALL(1)
NAME
install - copy files and set attributes
SYNOPSIS
install [OPTION]... [-T] SOURCE DEST
install [OPTION]... SOURCE... DIRECTORY
install [OPTION]... -t DIRECTORY SOURCE...
install [OPTION]... -d DIRECTORY...
DESCRIPTION
This install program copies files (often just compiled) into destina‐
tion locations you choose. If you want to download and install a
ready-to-use package on a GNU/Linux system, you should instead be using
a package manager like yum(1) or apt-get(1).
我们自己写一些模块的时候,在makefile里,增加install段
如:
install: server
install -s server $(DESTDIR)$(PREFIX)/bin
其中
(
D
E
S
T
D
I
R
)
(DESTDIR)
(DESTDIR)(PREFIX)指定具体的bin目录。
在make完成后,make install也可以完成make。
或者直接使用cp命令,把可执行文件拷贝到目的bin目录,效果经测试是一样的。