How to define local variable in Makefile target?
I would like to avoid repeating filename like:
zsh:
FILENAME := "text.txt"
@echo "Copying ${FILENAME}...";
scp "${FILENAME}" "user@host:/home/user/${FILENAME}"
But I am getting an error:
FILENAME := "text.txt"
/bin/sh: FILENAME: command not found
Same with $(FILENAME)
Trying
zsh:
export FILENAME="text.txt"
@echo "Copying ${FILENAME} to $(EC2)";
Gives me an empty value:
Copying ...
How to declare a local variable in Makefile
. Defining it through the shell is just a workaround. – Gaikwar