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:绝对路径,带反斜杠后缀

猜你喜欢

转载自blog.csdn.net/qingfengjuechen/article/details/91884120