【发布时间】:2019-09-07 07:00:11
【问题描述】:
我正在制作一个包含以下语句的 windows make 文件
Win10_SDK_Version := $(shell find $(WROOT_WIN10_SDK)/Include -maxdepth 1 -type d -path $(WROOT_WIN10_SDK)/Include/[0-9.]* -exec basename {}\; 2> output.txt | sort | tail -n 1)
但是,我看到变量 Win10_SDK_Version 未填充。为了调试,我在此行之前打印了变量 $(WROOT_WIN10_SDK) 并按预期填充了它
WROOT_WIN10_SDK=["E:/Myscpetre20/depot/sim/sim-20fq1/build/gobuild/compcache/cayman_msvc_desktop/ob-11144741/windows2016-clean/win/Program Files/Windows Kits/10"]
而且output.txt文件的内容说语句失败--find: basename: No such file or directory
如果我将上面的语句缩短到下面,不包括 exec basename---
Win10_SDK_Version := $(shell find $(WROOT_WIN10_SDK)/Include -maxdepth 1 -type d -path $(WROOT_WIN10_SDK)/Include/[0-9.]* 2> output.txt | sort | tail -n 1)
上面的语句执行得很好,所以确定这是我使用“-exec basename {}\;”的方式有问题。我还尝试在 basename 中包含单引号,如下所示--
Win10_SDK_Version := $(shell find $(WROOT_WIN10_SDK)/Include -maxdepth 1 -type d -path $(WROOT_WIN10_SDK)/Include/[0-9.]* -exec 'basename {}'\; 2> output.txt | sort | tail -n 1)
但即使这样失败了,谁能指导我如何在上述语句中正确包含 exec basename ?
【问题讨论】:
标签: windows makefile build gnu-make