help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to switch behaviour according to glibc version?


From: Paul Smith
Subject: Re: How to switch behaviour according to glibc version?
Date: Wed, 06 Apr 2016 07:47:51 -0400

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}')
                                                          ^^



reply via email to

[Prev in Thread] Current Thread [Next in Thread]