I have a GNU makefile. It runs fine on Linux, Solaris and OS X. However, under Cygwin-32, Cygwin-64 and MinGW, it produces:
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `echo 2.0.4(0.287/5/3) | egrep -i -c "fc22.i686"'
There is no Line 0; and the test for Fedora 22 actually occurs Line 73:
IS_FEDORA22_i686 = $(shell echo $(RELEASE) | $(EGREP) -i -c "fc22.i686")
What is going on with Cygwin and MinGW? More importantly, how can I fix it?
I know it sounds like a stretch, so here is a screen capture. The upper left is MinGW. The center is Cygwin-32. The lower right is Cygwin-64.
Best Answer
The problem is that the shell is seeing the parentheses in
$RELEASE
outside of any quotes, so is trying to interpret them. Two things to try: put double-quotes around the reference to$(RELEASE)
, and use:=
per this. For example:Edit: uname output with switches like
-m
doesn't usually have any shell metacharacters. The same problem could happen with any variable that did. That's why it's useful to setSHELL
in your makefile - if the user is runningcsh
, you will have different problems than withbash
.