这是什么样的Makefile变量分配? [英] What kind of Makefile variable assignment is this?
问题描述
我使用简单的makefile已有多年了,但是直到最近才被分配来学习大量复杂的由Autotools生成的makefile来来往往的任务,这些文件用于我的雇主购买的代码库.在这些代码中,我遇到了如下的变量声明:
I've used simple makefiles for years, but only recently been assigned the task of learning the ins and outs of a large, complicated set of Autotools-generated makefiles which is used for a code base my employer has bought. In these, I'm running into variable declarations like the following:
QOBJECT_MOCSRCS = $(QOBJECT_HEADER:%.h=.gen/moc_%.cpp) \
$(QOBJECT_SRCS:%.cpp=.gen/moc_%.cpp)
QOBJECT_DEPS = $(QOBJECT_MOCSRCS:%.cpp=.deps/%.Po)
我从上下文中得出的最佳猜测是,这些建立的文件名列表由构建过程提供,例如QOBJECT_MOCSRCS应该以(a).h文件,(b).cpp文件的列表结尾,基于在构建过程中将在临时目录./gen中生成的一组中间.cpp文件的词干名称的%.这用于存储moc _%.cpp文件,这些文件是通过使用Qt的moc工具构建Qt文件而输出的...令我发疯的是,我无法在任何中找到任何内容make 文档(主要是GNU make手册),该文档告诉我这种声明样式的含义,因此我可以对其进行跟踪并掌握语法. $()的内容看起来有点像规则,GNU中最接近的等效内容使手册似乎是指定特定于目标的变量值的规则,但是我不知道这是否接近正确的读数.谁能给我指出一个合适的学习参考书?
My best guess from context is that these set up lists of names of files to be provided by the build process, eg., QOBJECT_MOCSRCS should end up as a list of (a) .h files, (b) .cpp files, based on the % stem names of a set of intermediate .cpp files which will be generated during the build, in a temporary directory ./gen. This is used to store the moc_%.cpp files which are output as a result of a build of Qt files with Qt's moc tool...what is driving me crazy, is that I have been unable to find anything in any make documentation I've got (mostly the GNU make manual) that tells me what this style of declaration is called, so I can track it down and get a grip on the syntax. The contents of the $() look sort of like rules, and the nearest equivalents in the GNU make manual seem to be rules specifying target-specific variable values, but I have no idea whether this is anywhere near a correct reading. Can anyone point me to an appropriate reference for study?
推荐答案
This feature is called substitution references, http://www.gnu.org/software/make/manual/html_node/Substitution-Refs.html#Substitution-Refs
这篇关于这是什么样的Makefile变量分配?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!