I have the following snippet within my GNU makefile:
test:=$(shell grep '#pragma' test_types.h)
$(info test:$(test))
The above results in the following error message:
*** unterminated call to function 'shell': missing ')'. STOP
However if I remove the '#' from the snippet above:
test:=$(shell grep 'pragma' test_types.h)
$(info test:$(test))
The output is:
test: #pragma pack(push, 1) #pragma pack(pop)
If I run the following directly from the command line: grep '#pragma' test_types.h. The output is again:
#pragma pack(push, 1) #pragma pack(pop)
What is causing the shell function behaviour when combining grep with a search for # within a GNU makefile?
It is interpreting the # as the start of a comment, so the rest of the line is no longer seen.
Escape the character as \# instead and it will work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With