I'm using a makefile to deploy static content to an s3 bucket using Amazon's CLI. I want to throw in a variable to choose the target destination so I don't need to repeat the same script in different make verbs.
I seem to have got it to work but I want to make the argument case-insensitive from the terminal when it's executed. Here's what I have:
S3_NAME_DEV = com-mydomain-application-dev
S3_NAME_LIVE = com-mydomain-application
deploy:
# e.g. make deploy t=LIVE
aws s3 sync dist/ s3://$(S3_NAME_${t})
I tried adding the two carets (which is supported in bash 4 and I'm using) $(S3_NAME_${t^^})
but doesn't work :/. Here's the output when I do $ make deploy t=live
(variable just disappears).
$ make deploy t=live
# e.g. make deploy t=LIVE
aws s3 sync dist/ s3://
I thought it might be useful to include what the aws command might look like (so that not knowing the AWS CLI doesn't throw you off).
aws s3 sync dist/ s3://com-mydomain-application
In the shell I call the make
from I can do this successfully:
$ t=live
$ echo ${t^^}
LIVE
Any help would be greatly appreciated.
Bonus points: setting default value
UPDATE:
So make doesn't inherit the bash which executes it like I assumed. If I @echo "my version is: $$BASH_VERSION"
in the make file I get version 3.2 (OS X default). Pretty good chance fixing this will solve the issue.