gpt4 book ai didi

makefile - 在 Makefile 中首次使用时分配一次变量

转载 作者:行者123 更新时间:2023-12-05 08:07:48 30 4
gpt4 key购买 nike

<分区>

如何在变量扩展中仅调用一次 make shell 函数,并且仅在首次使用该变量时调用?我不想在声明时使用 := 进行扩展(即:简单扩展),因为扩展很昂贵,而且只有我的一些目标需要变量。

我尝试使用条件变量赋值,但它每次都会调用 shell,例如,以下调用 shell ls 两次:

.PHONY: test

FILES ?= $(warning Invoking the shell)$(shell ls)

test:
echo $(FILES) one
echo $(FILES) two

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