$(BUILDDIR)/%.check: $(SRCDIR)/%.c
$(eval pragma := $(shell grep "pragma" $< ))
@echo $<: $(pragma)
$(pragma) variable is always a null string, even for files containing #pragma
What’s wrong?
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.
There are several things wrong.
1) You are putting Make syntax into a command, which should be in the shell syntax.
2) You are attempting to set a variable in one command and use it in another (which won’t work because each command runs in its own subshell).
3) You have attempted a complex command without testing its simpler components (which would have told you that something was wrong).
If all you want to do is display the
#pragmalines, this will do it:If you want to do something more complex with the lines, tell us what it is and we’ll see if we can help.