WilliamKF
WilliamKF

Reputation: 43159

Why is makefile shell result different than doing same in shell?

With a GNU makefile content of:

SVNVERSION_NUMBER := $(shell svnversion --version | perl -lne 'print $1 if /version (\d+.\d+.\d+)/')

$(error $(SVNVERSION_NUMBER))

I get a result of:

Makefile:3: *** svnversion, version 1.6.2 (r37639).  Stop.

However, at the shell if I type:

svnversion --version | perl -lne 'print $1 if /version (\d+.\d+.\d+)/'

I get the result:

1.6.2

Clearly, my shell syntax is not doing what I think it is, but I'm not clear on why.

Thanks.

Upvotes: 0

Views: 569

Answers (1)

Peter Cordes
Peter Cordes

Reputation: 364533

$ is special in make strings. $$ for a literal dollar sign in the perl command.

Upvotes: 7

Related Questions