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 relative to the makefiles location that are produced by make are not accepted by the compiler.
Update the PATH environment variable: From the Start menu, select Parameters > Control Panel > System. Select the Advanced tab and click Environment variables. Edit the PATH environment variable to add the Cygwin installation directory, for example c:\cygwin\bin; and click OK.
The Cygwin DLL supports user specific fstab files. These are stored in the directory /etc/fstab. d and the name of the file is the Cygwin username of the user, as it's created from the Windows account database or stored in the /etc/passwd file (see the section called “Mapping Windows accounts to POSIX accounts”).
Description. The cygpath program is a utility that converts Windows native filenames to Cygwin POSIX-style pathnames and vice versa. It can be used when a Cygwin program needs to pass a file name to a native Windows program, or expects to get a file name from a native Windows program.
Using Cygwin As noted, Cygwin provides a Unix-like environment under Windows. The installation directory (by default, c:\cygwin) is the root of the Unix-like file system, which contains bin, etc, home, tmp, and usr directories as would be found on a GNU/Linux or other Unix system.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With