2

I want to create an archive for a given folder but without the folders name in the path...

In fact I want to do the same thing that this post : Avoid unwanted path in Zip file

BUT I'm in a makefile and the following code doesn't work :

cd $(PROJECT_FOLDER)
zip -r dist/$(ARCHIVE) $(PROJECT_FOLDER)

It is like cd is not done and finaly the archive is well created but with the $(PROJECT_FOLDER) folder at the beginning.

Do you know how to do this ?

1 Answers1

2

Each command line in a Makefile is launched into a separate shell process.  To get a cd to work, do

cd $(PROJECT_FOLDER); zip -r dist/$(ARCHIVE) $(PROJECT_FOLDER)

i.e., all on one line.

Optionally, for clarity, you could say

cd $(PROJECT_FOLDER); \
zip -r dist/$(ARCHIVE) $(PROJECT_FOLDER)

i.e., make it one logical line, but break the pieces into separate physical lines.