參考: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:絕對路徑,帶反斜槓後綴