Added MINGW32 changes.

This commits a number of changes from Earnie Boyd that allows GNU make
to build for MINGW32 systems.  Only missing from this commit are the
changes to configure.in etc.; I'm waiting for Earnie to sign papers for
those new files.

Also not here is any README.mingw32 etc. which would explain how to use
this port.
This commit is contained in:
Paul Smith 2003-11-03 22:04:09 +00:00
parent 74216b00a4
commit 76f034acaa
6 changed files with 113 additions and 56 deletions

View File

@ -13,6 +13,27 @@
* dir.c (directory_contents_hash_1, directory_contents_hash_1) * dir.c (directory_contents_hash_1, directory_contents_hash_1)
[WINDOWS32]: Initialize hash. [WINDOWS32]: Initialize hash.
2003-06-19 Earnie Boyd <earnie@uses.sf.net>
* dir.c (read_dirstream): Provide a workaround for broken versions of
the MinGW dirent structure.
2003-05-30 Earnie Boyd <earnie@users.sf.net>
* w32/include/dirent.h: Add __MINGW32__ filter.
2003-05-30 Earnie Boyd <earnie@users.sf.net>
* make.h: Add global declaration of *make_host.
* main.c (print_usage): Remove local declaration of *make_host.
(print_version): Display "This program built for ..." after Copyright
notice.
2003-05-30 Earnie Boyd <earnie@users.sf.net>
* doc/make.texi: Change "ifinfo" to "ifnottex" as suggested by the
execution of "makeinfo --html make.texi".
2003-04-30 Paul D. Smith <psmith@gnu.org> 2003-04-30 Paul D. Smith <psmith@gnu.org>
* build.template: Make some changes to maybe allow this script to * build.template: Make some changes to maybe allow this script to

6
dir.c
View File

@ -1130,6 +1130,12 @@ read_dirstream (__ptr_t stream)
buf = xmalloc (bufsz); buf = xmalloc (bufsz);
} }
d = (struct dirent *) buf; d = (struct dirent *) buf;
#ifdef __MINGW32__
# if __MINGW32_VERSION_MAJOR < 3 || (__MINGW32_VERSION_MAJOR == 3 && \
__MINGW32_VERSION_MINOR == 0)
d->d_name = xmalloc(len);
# endif
#endif
FAKE_DIR_ENTRY (d); FAKE_DIR_ENTRY (d);
#ifdef _DIRENT_HAVE_D_NAMLEN #ifdef _DIRENT_HAVE_D_NAMLEN
d->d_namlen = len - 1; d->d_namlen = len - 1;

View File

@ -30,7 +30,7 @@
* Make: (make). Remake files automatically. * Make: (make). Remake files automatically.
@end direntry @end direntry
@ifinfo @ifnottex
This file documents the GNU Make utility, which determines This file documents the GNU Make utility, which determines
automatically which pieces of a large program need to be recompiled, automatically which pieces of a large program need to be recompiled,
and issues the commands to recompile them. and issues the commands to recompile them.
@ -47,7 +47,7 @@ any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license is included in the section entitled Texts. A copy of the license is included in the section entitled
``GNU Free Documentation License''. ``GNU Free Documentation License''.
@end ifinfo @end ifnottex
@iftex @iftex
@shorttitlepage GNU Make @shorttitlepage GNU Make
@ -88,7 +88,7 @@ Cover art by Etienne Suvasa.
@end titlepage @end titlepage
@page @page
@ifinfo @ifnottex
@node Top, Overview, (dir), (dir) @node Top, Overview, (dir), (dir)
@top Make @top Make
@ -101,7 +101,7 @@ last updated @value{UPDATED},
documents GNU @code{make} Version @value{VERSION}.@refill documents GNU @code{make} Version @value{VERSION}.@refill
This manual describes @code{make} and contains the following chapters:@refill This manual describes @code{make} and contains the following chapters:@refill
@end ifinfo @end ifnottex
@menu @menu
* Overview:: Overview of @code{make}. * Overview:: Overview of @code{make}.
@ -371,9 +371,9 @@ from others whenever the others change.
@end menu @end menu
@node Preparing, Reading, Overview, Overview @node Preparing, Reading, Overview, Overview
@ifinfo @ifnottex
@heading Preparing and Running Make @heading Preparing and Running Make
@end ifinfo @end ifnottex
To prepare to use @code{make}, you must write a file called To prepare to use @code{make}, you must write a file called
the @dfn{makefile} that describes the relationships among files the @dfn{makefile} that describes the relationships among files
@ -406,10 +406,10 @@ introduction, read the first few sections of each chapter, skipping the
later sections. In each chapter, the first few sections contain later sections. In each chapter, the first few sections contain
introductory or general information and the later sections contain introductory or general information and the later sections contain
specialized or technical information. specialized or technical information.
@ifinfo @ifnottex
The exception is the second chapter, @ref{Introduction, ,An The exception is the second chapter, @ref{Introduction, ,An
Introduction to Makefiles}, all of which is introductory. Introduction to Makefiles}, all of which is introductory.
@end ifinfo @end ifnottex
@iftex @iftex
The exception is @ref{Introduction, ,An Introduction to Makefiles}, The exception is @ref{Introduction, ,An Introduction to Makefiles},
all of which is introductory. all of which is introductory.
@ -1558,7 +1558,7 @@ the makefile (often with a target called @samp{all}).
prerequisites from source files themselves. prerequisites from source files themselves.
@end menu @end menu
@ifinfo @ifnottex
@node Rule Example, Rule Syntax, Rules, Rules @node Rule Example, Rule Syntax, Rules, Rules
@section Rule Example @section Rule Example
@ -1587,7 +1587,7 @@ The command does not explicitly mention @file{defs.h}, but we presume
that @file{foo.c} includes it, and that that is why @file{defs.h} was that @file{foo.c} includes it, and that that is why @file{defs.h} was
added to the prerequisites. added to the prerequisites.
@end itemize @end itemize
@end ifinfo @end ifnottex
@node Rule Syntax, Prerequisite Types, Rule Example, Rules @node Rule Syntax, Prerequisite Types, Rule Example, Rules
@section Rule Syntax @section Rule Syntax
@ -1833,9 +1833,9 @@ make @file{*.o}. This is not what you want!
Actually it is possible to obtain the desired result with wildcard Actually it is possible to obtain the desired result with wildcard
expansion, but you need more sophisticated techniques, including the expansion, but you need more sophisticated techniques, including the
@code{wildcard} function and string substitution. @code{wildcard} function and string substitution.
@ifinfo @ifnottex
@xref{Wildcard Function, ,The Function @code{wildcard}}. @xref{Wildcard Function, ,The Function @code{wildcard}}.
@end ifinfo @end ifnottex
@iftex @iftex
These are described in the following section. These are described in the following section.
@end iftex @end iftex
@ -3737,9 +3737,9 @@ on the command line, by putting them in the @code{MAKEFLAGS} variable.
@iftex @iftex
See the next section. See the next section.
@end iftex @end iftex
@ifinfo @ifnottex
@xref{Options/Recursion}. @xref{Options/Recursion}.
@end ifinfo @end ifnottex
Variables are @emph{not} normally passed down if they were created by Variables are @emph{not} normally passed down if they were created by
default by @code{make} (@pxref{Implicit Variables, ,Variables Used by default by @code{make} (@pxref{Implicit Variables, ,Variables Used by
@ -5051,9 +5051,9 @@ endef
@iftex @iftex
See the next section for information about @code{define}. See the next section for information about @code{define}.
@end iftex @end iftex
@ifinfo @ifnottex
@xref{Defining, ,Defining Variables Verbatim}. @xref{Defining, ,Defining Variables Verbatim}.
@end ifinfo @end ifnottex
@node Defining, Environment, Override Directive, Using Variables @node Defining, Environment, Override Directive, Using Variables
@section Defining Variables Verbatim @section Defining Variables Verbatim

9
main.c
View File

@ -2141,7 +2141,6 @@ handle_non_switch_argument (char *arg, int env)
static void static void
print_usage (int bad) print_usage (int bad)
{ {
extern char *make_host;
const char *const *cpp; const char *const *cpp;
FILE *usageto; FILE *usageto;
@ -2700,7 +2699,7 @@ print_version (void)
word "Copyright", so it hardly seems worth it. */ word "Copyright", so it hardly seems worth it. */
printf ("%sGNU Make %s\n\ printf ("%sGNU Make %s\n\
%sCopyright (C) 2002 Free Software Foundation, Inc.\n", %sCopyright (C) 2003 Free Software Foundation, Inc.\n",
precede, version_string, precede); precede, version_string, precede);
printf (_("%sThis is free software; see the source for copying conditions.\n\ printf (_("%sThis is free software; see the source for copying conditions.\n\
@ -2708,6 +2707,12 @@ print_version (void)
%sPARTICULAR PURPOSE.\n"), %sPARTICULAR PURPOSE.\n"),
precede, precede, precede); precede, precede, precede);
if (!remote_description || *remote_description == '\0')
printf (_("\n%sThis program built for %s\n"), precede, make_host);
else
printf (_("\n%sThis program built for %s (%s)\n"),
precede, make_host, remote_description);
printed_version = 1; printed_version = 1;
/* Flush stdout so the user doesn't have to wait to see the /* Flush stdout so the user doesn't have to wait to see the

2
make.h
View File

@ -505,7 +505,7 @@ extern int max_load_average;
extern char *program; extern char *program;
extern char *starting_directory; extern char *starting_directory;
extern unsigned int makelevel; extern unsigned int makelevel;
extern char *version_string, *remote_description; extern char *version_string, *remote_description, *make_host;
extern unsigned int commands_started; extern unsigned int commands_started;

View File

@ -1,37 +1,62 @@
#ifndef _DIRENT_H /* Windows version of dirent.h
#define _DIRENT_H Copyright (C) 1996, 1997, 2003 Free Software Foundation, Inc.
This file is part of GNU Make.
#include <stdlib.h>
#include <windows.h> GNU Make is free software; you can redistribute it and/or modify
#include <limits.h> it under the terms of the GNU General Public License as published by
#include <sys/types.h> the Free Software Foundation; either version 2, or (at your option)
any later version.
#ifndef NAME_MAX
#define NAME_MAX 255 GNU Make is distributed in the hope that it will be useful,
#endif but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#define __DIRENT_COOKIE 0xfefeabab GNU General Public License for more details.
You should have received a copy of the GNU General Public License
struct dirent along with GNU Make; see the file COPYING. If not, write to
{ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
ino_t d_ino; /* unused - no equivalent on WINDOWS32 */ MA 02111-1307, USA. */
char d_name[NAME_MAX+1];
}; #ifndef _DIRENT_H
#define _DIRENT_H
typedef struct dir_struct {
ULONG dir_ulCookie; #ifdef __MINGW32__
HANDLE dir_hDirHandle; # include <windows.h>
DWORD dir_nNumFiles; # include_next <dirent.h>
char dir_pDirectoryName[NAME_MAX+1]; #else
struct dirent dir_sdReturn;
} DIR; #include <stdlib.h>
#include <windows.h>
DIR *opendir(const char *); #include <limits.h>
struct dirent *readdir(DIR *); #include <sys/types.h>
void rewinddir(DIR *);
void closedir(DIR *); #ifndef NAME_MAX
int telldir(DIR *); #define NAME_MAX 255
void seekdir(DIR *, long); #endif
#endif #define __DIRENT_COOKIE 0xfefeabab
struct dirent
{
ino_t d_ino; /* unused - no equivalent on WINDOWS32 */
char d_name[NAME_MAX+1];
};
typedef struct dir_struct {
ULONG dir_ulCookie;
HANDLE dir_hDirHandle;
DWORD dir_nNumFiles;
char dir_pDirectoryName[NAME_MAX+1];
struct dirent dir_sdReturn;
} DIR;
DIR *opendir(const char *);
struct dirent *readdir(DIR *);
void rewinddir(DIR *);
void closedir(DIR *);
int telldir(DIR *);
void seekdir(DIR *, long);
#endif /* !__MINGW32__ */
#endif