GNU可以创建句柄空间吗? [英] Can GNU make handle spaces?

查看:115
本文介绍了GNU可以创建句柄空间吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个makefile文件,其中包含C,其中包含空格.我无法绕过必须在文件名中包含空格的问题.是否可以使用gnu make在文件名中包含空格?

I have a makefile that has C INCLUDES with spaces in them. There is no way for me to get around having to have the spaces in the file names. Is there any way to have spaces in file names with gnu make?

推荐答案

Make通过在文件名中转义空格来对此提供一些基本支持,因为以下Makefile将正确编译并重新编译C文件foo bar.c:

Make has some basic support for this by escaping spaces in filenames, in that the following Makefile will correctly compile and recompile the C file foo bar.c:

foo\ bar: foo\ bar.c
    gcc -o "${@}" "${<}"

但是,在引用所运行的每个命令时,您必须非常小心,并且以空格分隔的文件列表(例如,SRCSLIBS)的变量将不起作用,尽管可能可以使用制作文本函数进行足够的黑客攻击引出报价并使一切正常工作……

However, you have to be super-careful in quoting every command you run, and variables that are space-separated lists of files—e.g., SRCS, LIBS—won’t work, although it’ß possible that with enough hacking using Make text functions you can parse out the quotes and get everything working…

因此,尽管对规则和模式中的文件名中的空格提供了基本支持,但复杂的事情将是非常艰巨而令人沮丧的工作.

So while there is rudimentary support for spaces in filenames in rules and patterns, anything complicated is going to be an awful lot of very hard and frustrating work.

这篇关于GNU可以创建句柄空间吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆