Get the current execution path command in makefile

Reference: https://blog.csdn.net/fhb1922702569/article/details/81558797

Practice results:

0: relative path

1: Absolute path, without backslash suffix

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: Absolute path, with backslash suffix

Guess you like

Origin blog.csdn.net/qingfengjuechen/article/details/91884120