help-make
[Top][All Lists]
Advanced

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

Re: (no subject)


From: gmake
Subject: Re: (no subject)
Date: Tue, 8 Aug 2006 10:00:22 -0500 (CDT)

Dear GNU make experts,

Do you know why

default:
   g=$(basename file.ext); \
   /bin/echo g=$$g;

produces "g=file", while

default:
   f=file.ext; \
   g=$(basename $$f); \
   /bin/echo g=$$g;

"g=file.ext".

How to extract the basename of $f in the second case?

Thank you in advence,
Val.


It needs another $:

...
    g=$$(basename $$f); \
    ...

So that it gets passed to the shell as $(basename $f).

$(basename ...) is GNU make's basename function, while you want the Unix
basename and command-substitution, which is $$(basename ...).

Thanks,
Lee




reply via email to

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