相关疑难解决方法(0)

在 makefile 中将 Windows 路径转换为 ​​Unix 路径

这个问题与Convert Cygwin path to Windows path in a makefile有关,但并不相同。

我需要转换 Windows 路径,例如:

C:\src\bin
Run Code Online (Sandbox Code Playgroud)

进入 Unix 路径,例如:

/c/src/bin
Run Code Online (Sandbox Code Playgroud)

在 makefile 中,我可以使用以下代码来转换此类路径:

slashedpath = $(subst \\,\/,$(windowspath))
unixpath = $(shell cygpath -u $(slashedpath))
Run Code Online (Sandbox Code Playgroud)

当cygpath函数不可用时,如何在 GNU Make 正在处理的 makefile 中执行相同的转换?

ps 如果$(windowspath)包含多个路径怎么办?如何将它们全部转换?

makefile gnu-make

5
推荐指数
1
解决办法
6432
查看次数

标签 统计

gnu-make ×1

makefile ×1