GNU Make是否在文件名中支持'%'? [英] Does GNU Make support '%' in a filename?
问题描述
在GNU Make中是否可以依赖于文件名中包含%
的文件?我有这样的东西:
In GNU Make is it possible to have a dependency on a file that includes a %
in the filename? I have something like this:
foo: results(10%).dat
gnuplot config.plt
虽然我当然可以选择其他文件名,但很高兴知道是否应该始终避免使用%
或是否有一种简单的方法对其进行转义(我已经尝试过\
,\\
和%%
没有运气.
While I can of course choose a different filename it would be nice to know if %
should always be avoided or if there is a simple way to escape it (I've tried \
, \\
, and %%
with no luck).
编辑:我的问题似乎更加微妙.由于匹配和文件名百分比的组合,它似乎不起作用:
My problems seems to be more subtle. It seems to not work because of a combination of matching and a percent filename:
all: foo.txt bar.txt
PERCENT := %
foo%txt bar%txt: results(10$(PERCENT)).dat
touch foo$*txt bar$*txt
这会失败,但是如果文件名中没有%
就可以了.
This fails but if the filename doesn't have a %
it's fine.
推荐答案
您可以尝试:
PERCENT := %
foo: results(10$(PERCENT)).dat
gnuplot config.plt
(gnuplot
之前的空格实际上是制表符).
(where the spaces before gnuplot
are a tab character really).
这篇关于GNU Make是否在文件名中支持'%'?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!