Subject: Make 3.75: Win32-Specific Fix for Filenames in Dependencies and i n Vpath
From: [email-masked] ("Griswold, Victor")

10 Feb 1997 18:37:33 -0800
Approved: [email-masked]
Distribution: cygnus
Message-ID: <199702102309.SAA08545.cygnus.gnu-win32@telxon>
Mime-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Original-To: "Cygnus:GNU-WIN32" <[email-masked]>
Original-Cc: "GNU:Make-Bugs" <[email-masked]>
X-Priority: 3
X-Mailer: Internet Mail Service (5.0.1389.3)
Original-Sender: [email-masked]

In the process of creating a software build environment which utilizes
the cygwin32 tools, some difficulties arose in the use of 'make'.
Specifically, DOS/Windows' use of ':' in filespecs confused 'make' both
in dependency lines and in vpath lines.

Since one of our goals is to have both our Unix and NT developers
satisfied
when working with the same build tools, I chose not to define 'MSDOS' in
order to change the vpath 'PATH_SEPARATOR_CHAR' from a ':' to a ';'.
That would break use of the Makefiles under Unix.  Instead, I followed
what
was already done under VMS for GNU make:  allow ':' to be "escaped" as
'\:'.  A trivial $(subst :,\:,FILESPEC) then fixes up any DOS filespec,
and does nothing to a Unix filespec.

A conditional was already available for '#ifdef VMS' to enable this
escape
mechanism for dependency lines.  I simply added checking for '_WIN32' to
also enable the '\:' dependency escape, and added similar logic to the
'vpath' line parsing.

Complete 'diff's are listed below; they are quite short.

If this modification does not appear to obviously break the build of any
critical cygwin32 tool, I believe that it would be reasonable to
incorporate
it into the standard 'make' distribution for cygwin32.

========================================================================

*** dir.c.orig	Tue Dec 03 22:03:43 1996
 --- dir.c	Fri Jan 24 12:38:10 1997
***************
*** 201,206 ****
 --- 201,208 ----
  #define DIRECTORY_BUCKETS 199
  #endif

+ struct dirfile;
+
  struct directory_contents
    {
      struct directory_contents *next;

*** read.c.orig	Tue Dec 03 22:03:51 1996
 --- read.c	Mon Jan 27 11:50:48 1997
***************
*** 1683,1689 ****
  #endif
  #endif
        else
! #ifdef VMS
  /* VMS filenames can have a ':' in them but they have to be '\'ed but
we need
   *  to remove this '\' before we can use the filename.
   * Savestring called because q may be read-only string constant.
 --- 1683,1689 ----
  #endif
  #endif
        else
! #if defined(VMS) || defined(_WIN32)
  /* VMS filenames can have a ':' in them but they have to be '\'ed but
we need
   *  to remove this '\' before we can use the filename.
   * Savestring called because q may be read-only string constant.

*** vpath.c.orig	Tue Dec 03 22:03:54 1996
 --- vpath.c	Fri Jan 24 13:41:56 1997
***************
*** 203,209 ****

        /* Find the end of this entry.  */
        v = p;
!       while (*p != '\0' && *p != PATH_SEPARATOR_CHAR && !isblank (*p))
  	++p;

        len = p - v;
 --- 203,212 ----

        /* Find the end of this entry.  */
        v = p;
!       while (*p != '\0' &&
!       		 (*p != PATH_SEPARATOR_CHAR
!       		  || (p != dirpath && *(p-1) == '\\'))
!       		 && !isblank (*p))
  	++p;

        len = p - v;
***************
*** 214,219 ****
 --- 217,234 ----

        if (len > 1 || *v != '.')
  	{
+ 		char *read = v;
+ 		char *write = v;
+
+ 		/*	Clean out the '\\' from "escaped" path
separators.	*/
+ 		while (read < v + len) {
+ 			if (*read == '\\' && *(read + 1) ==
PATH_SEPARATOR_CHAR)
+ 				read++;
+
+ 			*write++ = *read++;
+ 		}
+ 		len -= (read - write);
+
  	  v = savestring (v, len);

  	  /* Verify that the directory actually exists.  */
***************
*** 481,487 ****

        for (i = 0; v->searchpath[i] != 0; ++i)
  	printf ("%s%c", v->searchpath[i],
! 		v->searchpath[i + 1] == 0 ? '\n' : PATH_SEPARATOR_CHAR);
      }

    if (vpaths == 0)
 --- 496,502 ----

        for (i = 0; v->searchpath[i] != 0; ++i)
  	printf ("%s%c", v->searchpath[i],
! 		v->searchpath[i + 1] == 0 ? '\n' : ' ');
      }

    if (vpaths == 0)

========================================================================

Victor J. Griswold, D.Sc.
Aironet Wireless Communications, Inc.
voice:	330-664-7987
fax:	330-664-7301
email:	(MS-Mail) [email-masked]
	(MIME) [email-masked]

-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".