install - copy files and set attributes
install 在做拷贝的同时,设置attributes.
因此Makefile 中尽量使用install 命令。
例如
@install -d /usr/bin
@install -p -D -m 0755 targets /usr/bin
相当于
@mkdir -p /usr/bin
@cp targets /usr/bin
@chmod 755 /usr/bin/targets
@touch /usr/bin/tagets <---- 更新文件时间戳
install 命令好强大啊。
另外@前缀的意思是不在控制台输出结果。
本文介绍了如何利用install命令进行文件复制并同时设置文件属性,包括权限和时间戳等,以此来替代传统的cp和chmod命令组合。通过示例展示了install命令的强大功能。
1733

被折叠的 条评论
为什么被折叠?



