gpt4 book ai didi

linux - 理解带有 $(basename $(notdir $@)) 的 Makefile

转载 作者:IT王子 更新时间:2023-10-29 00:26:18 53 4
gpt4 key购买 nike

我试图理解 Makefile,但我不理解带有注释的配方行。

...
...
sample.a:
cd ../$(basename $(notdir $@)) && make ##i don't understand this
...
...

我在这方面还是个新手。你能给我一个非常简单的解释吗:

$(basename $(notdir $@))

最佳答案

如果你分解它:

$(notdir $@) 从文件名中去掉路径,只留下文件名(所以 /x/y/foo.a 变成 foo.a)$(basename ...) 去掉了扩展名(所以 foo.a 变成了 foo)

这里有一个不错的引用:http://www.gnu.org/software/make/manual/html_node/File-Name-Functions.html

关于linux - 理解带有 $(basename $(notdir $@)) 的 Makefile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16727021/

53 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com