gnu make:列出特定运行中所有变量(或“宏")的值 [英] gnu make: list the values of all variables (or "macros") in a particular run
本文介绍了gnu make:列出特定运行中所有变量(或“宏")的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
运行make时,如何在Makefile中列出所有变量(也称为宏)的当前值?
How can I list the current value of all variables (also called macros) in a Makefile when running make?
例如如果在Makefile中:
E.g. if this is in the Makefile:
CUR-DIR := $(shell /bin/pwd)
LOG-DIR := $(CUR-DIR)/make-logs
然后我想告诉我:
CUR-DIR = /home/johv/src/test
LOG-DIR = /home/johv/src/test/make-logs
推荐答案
我最终这样做是这样的:
I ended up doing it like this:
gmake -pn | grep -A1 "^# makefile"| grep -v "^#\|^--" | sort | uniq > makevars.txt
给出:
CUR-DIR := /home/johv/src/test
LOG-DIR := /home/johv/src/test/make-logs
MAKEFILE_LIST := Makefile
MAKEFLAGS = pn
SHELL = /bin/sh
VARS_OLD := [...]
gmake -pn
确实很冗长,看起来像这样:
gmake -pn
is really verbose and looks kinda like this:
# environment
GNOME2_PATH = /usr/local:/opt/gnome:/usr:/usr/local:/opt/gnome:/usr
# automatic
@F = $(notdir $@)
# makefile
SHELL = /bin/sh
# default
RM = rm -f
这篇关于gnu make:列出特定运行中所有变量(或“宏")的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文