On Wed, 2016-04-06 at 09:46 +0000, David Aldrich wrote:
> But if I do:
> 
> verstr := $(shell ldd --version | head -1 | awk '{print $NF}')
> $(info glibc $(verstr) detected)
> 
> I see:
> 
> glibc  detected
> 
> So there is something wrong with the awk command. It works ok from the
> command line but not in the makefile.  Might the apostrophes be the
> problem?

You have to always escape all "$" you want to pass through to a shell,
either in a recipe or a variable or a $(shell ...) function call.  All
instances of single "$" are expanded by make as variables or functions,
before it invokes the shell.

So, write:

  verstr := $(shell ldd --version | head -1 | awk '{print $$NF}')
                                                          ^^

_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to