简体   繁体   中英

zip folder in makefile mac

I use a makefile on Mac OS X and I try to zip a directory in another folder where my makefile is :

My makefile is in folder : /Volumes/Sources

And the folder to zip is : /Volumes/Bin/myapp

So I try to run zip command in makefile like this :

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

It works BUT in my zip archive, I have directories "Volumes", "Bin", "myapp"

And I don't want, I would like all files and folders of /Volumes/Bin/myapp at the root of .zip archive.

I try "pushd" and "cd", abut after changing directory, a "pwd" command shows that i didn't change ! I'm still in /Volumes/Sources

Any help ?

Each command in a makefile rule acts in its own subshell. This won't work:

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

Try this:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM