如何将后缀应用于makefile中的多个文件?
How to apply suffix to multiple files in makefile?
我想一次将 --preload-file
后缀应用到多个文件。
如果我这样做 --preload-file file1 --preload-file file2
就可以了。
但如果我这样做 --preload-file file1 file2
,则会生成以下错误:
file2: Input file has an unknown suffix, don't know what to do with
it!
有没有办法同时将后缀应用于两个文件,这样我就可以做类似 --preload-file $(MY_FILES)
的事情?
如https://emscripten.org/docs/tools_reference/emcc.html?highlight=preload所述:
--preload-file <name>
Specify a file to preload before running the compiled code
asynchronously. The path is relative to the current directory at
compile time. If a directory is passed here, its entire contents will
be embedded.
因此只要 file1 和 file2 在同一目录下,您就应该能够传递它,因此在您的情况下,后缀将应用于两个文件。
要提供特定问题的答案,如果您有 GNU make,您可以使用:
$(addprefix --preload-file ,$(MY_FILES))
(注意逗号前的 space)。在 POSIX 标准品牌中无法做到这一点。
我想一次将 --preload-file
后缀应用到多个文件。
如果我这样做 --preload-file file1 --preload-file file2
就可以了。
但如果我这样做 --preload-file file1 file2
,则会生成以下错误:
file2: Input file has an unknown suffix, don't know what to do with it!
有没有办法同时将后缀应用于两个文件,这样我就可以做类似 --preload-file $(MY_FILES)
的事情?
如https://emscripten.org/docs/tools_reference/emcc.html?highlight=preload所述:
--preload-file <name>
Specify a file to preload before running the compiled code asynchronously. The path is relative to the current directory at compile time. If a directory is passed here, its entire contents will be embedded.
因此只要 file1 和 file2 在同一目录下,您就应该能够传递它,因此在您的情况下,后缀将应用于两个文件。
要提供特定问题的答案,如果您有 GNU make,您可以使用:
$(addprefix --preload-file ,$(MY_FILES))
(注意逗号前的 space)。在 POSIX 标准品牌中无法做到这一点。