开发者

Convert Cygwin path to Windows path in a makefile

开发者 https://www.devze.com 2023-01-29 23:14 出处:网络
How can I convert a Cygwin style path ( /cygdrive/c/foo/bar ) to Windows style ( C:/foo/bar ) (yes, with / going forward) in a GNU makefile? I have the situation of using Cygwin\'s make with a GCC tha

How can I convert a Cygwin style path ( /cygdrive/c/foo/bar ) to Windows style ( C:/foo/bar ) (yes, with / going forward) in a GNU makefile? I have the situation of using Cygwin's make with a GCC that does not understand Cygwin style paths, so paths relat开发者_如何学JAVAive to the makefiles location that are produced by make are not accepted by the compiler.


Use the shell function to execute the cygpath utility with the -w flag.

Example:

BAR := /cygdrive/c/foo/bar
WIN_BAR := $(shell cygpath -w ${BAR})

cygpath accepts a lot of additional options. See the man page for details.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号