On Jul 22 11:24, Gökçe Aydos wrote: > On 2014-07-21 13:23, Marco Atzeri wrote: > >I presume the make you are using is not cygwin one > >as the first form is understandable only by cygwin programs > > I do not see a difference between the two lines, because the command > "cygpath" is used in both. I want to add that I get the behavior both under > Cygwin64 terminal and in Win command prompt with bash. If the cygpath is run > embedded in another function, it does not produce a usable path for Windows > programs.
It's not cygpath at fault here. It's how make works. Your patsubst with a shell call in the replacement string simply doesn't work as intended. For testing purposes, replace cygpath with this simple test application: $ cat > mycygpath.c <<EOF #include <stdio.h> int main (int argc, char **argv) { int i; for (i = 1; i < argc; ++i) { fprintf (stderr, "ARGV[%d] = '%s'\n", i, argv[i]); if (argv[i][0] == '-') continue; if (argv[i][0] == '/') { if (!strncmp (argv[i], "/cygdrive/c/", 7)) printf ("C:/%s\n", argv[i] + 7); else printf ("C:/cygwin64/%s\n", argv[i] + 1); } else if (!strncmp (argv[i], "./", 2)) printf ("%s\n", argv[i] + 2); else printf ("%s\n", argv[i]); } return 0; } EOF It works exactly as cygpath for your testcase, but additionally it reproduces the exact incoming argument string on stderr: $ gcc -o mycygpath mycygpath.c $ ./mycygpath lib1 ./relative.vhd /cygdrive/c/Windows/absolute.vhd ARGV[1] = 'lib1' lib1 ARGV[2] = './relative.vhd' relative.vhd ARGV[3] = '/cygdrive/c/Windows/absolute.vhd' C:/Windows/absolute.vhd Now change your Makefile like this: $ cat > Makefile <<EOF FILES = lib1 ./relative.vhd \ lib2 /cygdrive/c/Windows/absolute.vhd convert_absolute_paths_to_windows_paths: @echo 1: $(patsubst /%,$(shell ./mycygpath -m /%),$(FILES)) @echo 2: $(shell ./mycygpath -m $(FILES)) EOF And now run make: $ make ARGV[1] = '-m' ARGV[2] = '/%' ARGV[1] = '-m' ARGV[2] = 'lib1' ARGV[3] = './relative.vhd' ARGV[4] = 'lib2' ARGV[5] = '/cygdrive/c/Windows/absolute.vhd' 1: lib1 ./relative.vhd lib2 C:/cygwin64/cygdrive/c/Windows/absolute.vhd 2: lib1 relative.vhd lib2 C:/Windows/absolute.vhd Observe what make gives to the first mycygpath call. cygpath gets a literal "/%" string. mycygpath as well as cygpath will *correctly* generate "C:/cygwin64/%", and then, *after* the call to $(shell), the % substitution of patsubst will be performed. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat
pgp22nljeizND.pgp
Description: PGP signature