makefile mac中的zip文件夹

时间:2012-02-29 11:00:49

标签: macos makefile zip

我在Mac OS X上使用makefile,我尝试在另一个我的makefile所在的文件夹中压缩目录:

我的makefile位于文件夹:/ Volumes / Sources

要压缩的文件夹是:/ Volumes / Bin / myapp

所以我尝试在makefile中运行zip命令,如下所示:

zip -r myapp.zip /Volumes/Bin/myapp

它在我的zip存档中工作,我有目录“Volumes”,“Bin”,“myapp”

我不想要,我希望/ Volumes / bin / myapp的所有文件和文件夹都位于.zip存档的根目录。

我尝试“pushd”和“cd”,更改目录后,“pwd”命令显示我没有改变!我还在/ Volumes / Sources

任何帮助?

1 个答案:

答案 0 :(得分:2)

makefile规则中的每个命令都在其自己的子shell中。这不起作用:

cd /Volumes/Bin/myapp # <-- you start in Sources/, cd to myapp/, and die.
zip -r myapp.zip . # <-- you are in Sources/, drat!. 

试试这个:

cd /Volumes/Bin/myapp ; zip -r myapp.zip .