In a Makefile, a deploy recipe needs a environment variable ENV to be set to properly execute itself, whereas others don\'t care, e.g.:
Inline variant
In my makefiles, I normally use an expression like:
deploy:
test -n "$(ENV)" # $$ENV
rsync . $(ENV).example.com:/var/www/myapp/
The reasons:
Don't forget the comment which is important for debugging:
test -n ""
Makefile:3: recipe for target 'deploy' failed
make: *** [deploy] Error 1
... forces you to lookup the Makefile while ...
test -n "" # $ENV
Makefile:3: recipe for target 'deploy' failed
make: *** [deploy] Error 1
... explains directly what's wrong
Global variant (for completeness, but not asked)
On top of your Makefile, you could also write:
ifeq ($(ENV),)
$(error ENV is not set)
endif
Warnings:
clean target will fail if ENV is not set. Otherwise see Hudon's answer which is more complex