在Makefile安装中移动目录到位的最佳方式是什么?
我目前在我的Makefile中使用常用技术来安装单个文件:
install:
    install -D executable ${BIN_DIR}
但是我碰到了一种情况,我需要将整个目录及其下的所有文件移动到位。
  cp -r是最好的方式,还是有更多的linux-y / unix-y方式来做到这一点? 
  是的,很难想象cp -r更加unix-ish的方式,尽管-r是cp的相对较晚的补充。  我可以告诉你我们曾经这样做的方式,并且它可以在文件系统和文件系统之间巧妙地工作: 
  让src是要移动的源目录,并且/path/to/target是/path/to/target的绝对路径。  然后你可以使用: 
$ tar cf - src | (cd /path/to/target; tar xf -)
  我的install(1)版install(1) (Debian)有: 
   -d, --directory
          treat all arguments as directory names; create all components of the specified directories
   -t, --target-directory=DIRECTORY
          copy all SOURCE arguments into DIRECTORY
  所以如果你想在你的Makefile中一直使用install(1) ,你可以这样做: 
install -d destdir
install srcdir/* -t destdir
  -t不是递归的,但是 - 如果srcdir包含目录,那么它们不会被复制。 
链接是另一个可行的选择。 这将允许你保持多个目录(代表不同的版本)。
链接地址: http://www.djcxy.com/p/91629.html上一篇: What's the best way to move a directory into place in a Makefile install?
下一篇: Google App Engine dispatch.yaml Validation error PHP module
