gpt4 book ai didi

生成文件 : can 'canned recipes' have parameters?

转载 作者:行者123 更新时间:2023-12-02 10:25:16 28 4
gpt4 key购买 nike

我的问题涉及 GNU 的品牌。

如果您有一系列命令可用作多个目标的配方,则 canned recipe派上用场了。我可能看起来像这样:

define run-foo
# Here comes a
# sequence of commands that are
# executed line by line
endef

现在你可以像这样使用 jar 装食谱:

file1: input1:
$(run-foo)

$(pattern) : sub/% : %.inp
$(run-foo)

等等。我想知道是否可以定义带有参数的 jar 头食谱(或类似的东西),以便我可以像这样执行它们:

file2: input2
$(run-foo) specific-parameter2 "additional"

file3: input3
$(run-foo) another-parameter3 "text"

这可能吗?欢迎任何提示:)

最佳答案

您可以通过以下方式执行此操作:

  • define-ed 宏中使用参数 $1$2... 等
  • 通过 $(call ...) 调用宏

例如:

define recipe
echo $1
endef

all: t1 t2

t1:
$(call recipe,"One")

t2:
$(call recipe,"Two")

关于生成文件 : can 'canned recipes' have parameters?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21254862/

28 4 0