makefile - GNU Make 支持文件名中的 '%' 吗?

标签 makefile gnu-make

在 GNU Make 中,是否可以依赖于文件名中包含 % 的文件?我有这样的东西:

foo: results(10%).dat
    gnuplot config.plt

虽然我当然可以选择不同的文件名,但最好知道是否应该始终避免 % 或者是否有一种简单的方法来转义它(我已经尝试过 \\\%%,但运气不佳)。

编辑:我的问题似乎更微妙。由于匹配和百分比文件名的组合,它似乎不起作用:

all: foo.txt bar.txt

PERCENT := %

foo%txt bar%txt: results(10$(PERCENT)).dat
    touch foo$*txt bar$*txt

这会失败,但如果文件名没有%,那就没问题。

最佳答案

你可以尝试:

PERCENT := %
foo: results(10$(PERCENT)).dat
    gnuplot config.plt

(其中 gnuplot 之前的空格实际上是制表符)。

关于makefile - GNU Make 支持文件名中的 '%' 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37419859/

相关文章:

c++ - 当 esp32 组件 #includes esp_types.h 在 newlib/not esp32/中找到时,esp-idf 构建闪存失败

c++ - makefile 并链接不同文件夹中的库

多个目标上的 Makefile : . PHONY

makefile - CENTOS - Linux - Make - Makefile(获取用户输入不起作用)

makefile - 制作 : execute 2nd rule only if 1st changed file

makefile - GNU make 引用

xcode - 奇怪的错误消息: xcode-select: error: malformed developer path ("/Library/Developer/CommandLineTools")

c++ - default_random_engine’ 没有命名类型

c - :=$= means in Makefile? 是什么意思

makefile - 使用 GNU-make 函数检查是否定义了变量