On this line:
GCCVER:=$(shell a=`mktemp` && echo $'#include <stdio.h>\nmain() {printf("%u.%u\\n", __GNUC__, __GNUC_MINOR__);}' | gcc -o "$a" -xc -; "$a"; rm "$a")
I get:
*** unterminated call to function `shell': missing `)'. Stop.
What’s wrong with my stupidly circuitous variable?
Update0
$ make --version
GNU Make 3.81
$ bash --version
GNU bash, version 4.2.8(1)-release (x86_64-pc-linux-gnu)
$ uname -a
Linux 2.6.38-10-generic #46-Ubuntu SMP x86_64 GNU/Linux
$ gcc --version
gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2
when using
$for Bash inside a Makefile, you need to double them:$$afor example. I’m not familiar with the notation$'but I’ll have to assume you know what you’re doing with that. unless it’s a Makefile construct, you need to double the dollar sign on that one too.also, the hash sign
#is terminating the shell expansion in Make’s evaluation, which is why it never sees the right paren. escaping it helps, but I don’t have it working quite right yet.I’m debugging it by having two steps: first is setting GCCVER to be the list of commands without the enclosing
$(shell), then in the 2nd step settingGCCVER := $(shell $(GCCVER)). you might want to try that too, commenting out the$(shell)step when it doesn’t work, usingexport, and making a “set” recipe:Then:
[update] this works:
And full circle, having gotten rid of the extra step:
Using the
$'Bash construct:Since your system doesn’t work the same as mine, I’m going to cop out and say either use reinierpost’s suggestion or, alternatively: