makefile中獲取當前執行路徑的命令

參考:https://blog.csdn.net/fhb1922702569/article/details/81558797

實踐結果:

0:相對路徑

1:絕對路徑,不帶反斜槓後綴

cur_mkfile := $(abspath $(lastword $(MAKEFILE_LIST)))
$(info cur_mkfile=$(cur_mkfile))

cur_makefile_path0 :=$(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST)))) #ok,0
cur_makefile_path1 := $(patsubst %/, %, $(dir $(cur_mkfile))) #ok, 1

$(info cur_makefile_path0=$(cur_makefile_path0))
$(info cur_makefile_path1=$(cur_makefile_path1))
$(info cur_makefile_path2=$(dir $(cur_mkfile)))

2:絕對路徑,帶反斜槓後綴

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章