如何在make变量中将当前目录捕获为绝对路径名?

如何在make变量中将当前目录捕获为绝对路径名?

问题描述:

我想在运行GNUmake文件的过程中获取当前目录,并将其放入make变量中.

I'd like to get the current directory during a GNUmake file run put into a make variable.

执行此操作的语法是什么?像这样吗?

What is the syntax to do this? Something like this?

DIR := $(PWD)

嗯,不,$PWD有时是在您的环境中定义的,因此由make继承,但通常不是.您需要$CURDIR.

Um, no, $PWD is sometimes defined in your environment and thus inherited by make, but oftentimes not. You need $CURDIR.

DIR := ${CURDIR}