列出GNU make中包含在其定义中包含变量的目标/目标 [英] List goals/targets in GNU make that contain variables in their definition
问题描述
我有一个相当大的makefile,它通过计算变量的名称来动态创建多个目标. (例如foo $(VAR):$(PREREQS)).在扩展这些变量之后,可以说服gnu make吐出一系列目标吗?
I have a fairly large makefile that creates a number of targets on the fly by computing names from variables. (eg foo$(VAR) : $(PREREQS)). Is there any way that gnu make can be convinced to spit out a list of targets after it has expanded these variables?
我希望能够获取任意makefile的目标.我正在尝试为我的外壳编写一个完成函数.
I'd like to be able to get the targets for an aribitrary makefile. I'm trying to write a completion function for my shell.
推荐答案
您可以解析make -pn
(即make --print-data-base --dry-run
)的输出吗?它打印出所有变量,规则,隐式规则以及将要费力的细节运行哪些命令.
Can you parse the output from make -pn
(i.e. make --print-data-base --dry-run
)? It prints out all the variables, rules, implicit rules and which commands will be run in laborious detail.
这篇关于列出GNU make中包含在其定义中包含变量的目标/目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!