| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:date:from:to:subject:message-id:reply-to | |
| :references:mime-version:content-type:in-reply-to; q=dns; s= | |
| default; b=fViv96rlzs3PtroKPv+/Lc7QVgsppyNPlEplbWsrn4HTnjReFLDVL | |
| 7nS/Xvlzv3rX5VkLojIQNMDsIDjt7e7qIfoetDs2ZOM1Y+eMSzKhr92lYQH+sdJT | |
| T4DyKzrE4WS45MHbpGi4NvIIS3QrnsQjWOWdz1RPsbBiztKi7I7YUU= | |
| DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:date:from:to:subject:message-id:reply-to | |
| :references:mime-version:content-type:in-reply-to; s=default; | |
| bh=rXFBfA4B3X8PhSNqti9Ul1Je3Lk=; b=p26YP+C0WwyNUM0TtYN/eX/Nbrc0 | |
| l+0i8d8ZjM/wC7wKP2kPCREH9wrq8EwLrLq0AumOrLm8tW6mOg2XcZ4uH3ut/U1j | |
| chsQT95xSNlMPqDRdY1Lm+H0dEeJhHwo0ocTp0cksvWqq5hak6cTBp7WBtBsxBrt | |
| BL0VaxiVdBGYhXU= | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Authentication-Results: | sourceware.org; auth=none |
| X-Virus-Found: | No |
| X-Spam-SWARE-Status: | No, score=-5.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 |
| X-HELO: | calimero.vinschen.de |
| Date: | Tue, 22 Jul 2014 12:16:47 +0200 |
| From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: Re: cygpath does not work properly in Makefile |
| Message-ID: | <20140722101647.GD2451@calimero.vinschen.de> |
| Reply-To: | cygwin AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| References: | <53CCF82E DOT 7040407 AT gmail DOT com> <53CE2DEA DOT 1030003 AT uni-bremen DOT de> |
| MIME-Version: | 1.0 |
| In-Reply-To: | <53CE2DEA.1030003@uni-bremen.de> |
| User-Agent: | Mutt/1.5.23 (2014-03-12) |
--1yeeQ81UyVL57Vl7
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Jul 22 11:24, G=C3=B6k=C3=A7e 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
>=20
> 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 und=
er
> 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 Windo=
ws
> 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 =3D 1; i < argc; ++i)
{
fprintf (stderr, "ARGV[%d] =3D '%s'\n", i, argv[i]);
if (argv[i][0] =3D=3D '-')
continue;
if (argv[i][0] =3D=3D '/')
{
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] =3D 'lib1'
lib1
ARGV[2] =3D './relative.vhd'
relative.vhd
ARGV[3] =3D '/cygdrive/c/Windows/absolute.vhd'
C:/Windows/absolute.vhd
Now change your Makefile like this:
$ cat > Makefile <<EOF
FILES =3D 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] =3D '-m'
ARGV[2] =3D '/%'
ARGV[1] =3D '-m'
ARGV[2] =3D 'lib1'
ARGV[3] =3D './relative.vhd'
ARGV[4] =3D 'lib2'
ARGV[5] =3D '/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
--=20
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
--1yeeQ81UyVL57Vl7
Content-Type: application/pgp-signature
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAEBAgAGBQJTzjoPAAoJEPU2Bp2uRE+gwwkP/1rlENRqZtKb/yKB+REY1dmz
qAhPRHUo3YxT38AsMkB/uUa0KAKWK/N1UnR0yZ4fVcssJt8iazc4snTjl9q1WCtR
2WCBLWVQOaam3wEsz5aXhegByTXeXymrd3nso2lOf3O8bN1XCAWzF1h7IX0hld++
1SYVhtHwXNlojfxVYyA2TPKVGiCLrBeUVWGATi6nWDsvPKyCisewE6NSsRLK0SCJ
29BaTIOITepu9p6sEOVnugHov39C3hnI+/kVdfkdWBN69sG/anI6L459I/69chBn
7qaDF7ZHs1iiNugIcSNWqW+evs5RQHPYLaVytjjaz/oQlrF6VOaaRwBqbBnuN83m
KpLTnDG6dX8EFo5obXjIe71XKpTbRYA0yVLwA8BceCJ1Q2+6SwIKf6jURn/56pvo
YarY5QMt68GppKJ6l7LMl+qvwZJKNdDrZ5TDv3cnQ/6Mt1wGCgkmb+gbxSQaDKmJ
sqNqx8WGMbDfbCg25WvmKXLXZFdVKmDrAV8puoNc7cVMX6I0bTVuSuSMQz33jR4X
A9ABg/FeZvNYDue1uGi/jMVHEJREddRHD3A45bobxx71MRvXbYRWtvjdpBeL0mW4
7yHJoBPr55QstL7udMBItA6os4cb9zAMytVTETA04Mzthg7dm04dNs2Z8KXYSGwv
ZK7x8amA/GPx930l8pyP
=ZbFJ
-----END PGP SIGNATURE-----
--1yeeQ81UyVL57Vl7--
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |