List Info

Thread: (no subject)




(no subject)
user name
2006-08-08 12:15:57
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.


_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make
(no subject)
user name
2006-08-08 15:00:22
> 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


_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )