本文介绍了从makefile获取makefile的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Makefile中获取Makefile的名称?

How to get the name of the makefile in the makefile?

谢谢.

注意:

我需要这样做,因为我希望自己的makefile能够自己调用,但该makefile却不称为Makefile,所以我想写这样的东西:

I would need that because I would like my makefile to call itself, but the makefile is not called Makefile, so I'd like to write something like this:

target:
    ($MAKE) -f ($MAKEFILENAME) other_target

推荐答案

location = $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
WHERE_ART_THOU := $(location)
$(warning $(WHERE_ART_THOU))

我也相信这是特定于GNU品牌的,但我不太确定.

I also believe this is GNU make-specific, but I'm not too sure.

这篇关于从makefile获取makefile的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 12:21
查看更多