Is there a way to tell make to complain when I use unset variables? Something similar to set -u in bash?
I have just spent twenty minutes debugging my Makefile, because there was a one symbol typo in the name of the variable.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, there is a way:
I’ve just tested it with make version 3.81
EDIT:
You can also set it in your makefile, to protect yourself in the future from silly mistakes.
To do it just put this somewhere near the top of your makefile (this will be passed to recursive make processes too):