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)
[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>
* 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);
}
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);
#ifdef _DIRENT_HAVE_D_NAMLEN
d->d_namlen = len - 1;

View File

@ -30,7 +30,7 @@
* Make: (make). Remake files automatically.
@end direntry
@ifinfo
@ifnottex
This file documents the GNU Make utility, which determines
automatically which pieces of a large program need to be recompiled,
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
Texts. A copy of the license is included in the section entitled
``GNU Free Documentation License''.
@end ifinfo
@end ifnottex
@iftex
@shorttitlepage GNU Make
@ -88,7 +88,7 @@ Cover art by Etienne Suvasa.
@end titlepage
@page
@ifinfo
@ifnottex
@node Top, Overview, (dir), (dir)
@top Make
@ -101,7 +101,7 @@ last updated @value{UPDATED},
documents GNU @code{make} Version @value{VERSION}.@refill
This manual describes @code{make} and contains the following chapters:@refill
@end ifinfo
@end ifnottex
@menu
* Overview:: Overview of @code{make}.
@ -371,9 +371,9 @@ from others whenever the others change.
@end menu
@node Preparing, Reading, Overview, Overview
@ifinfo
@ifnottex
@heading Preparing and Running Make
@end ifinfo
@end ifnottex
To prepare to use @code{make}, you must write a file called
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
introductory or general information and the later sections contain
specialized or technical information.
@ifinfo
@ifnottex
The exception is the second chapter, @ref{Introduction, ,An
Introduction to Makefiles}, all of which is introductory.
@end ifinfo
@end ifnottex
@iftex
The exception is @ref{Introduction, ,An Introduction to Makefiles},
all of which is introductory.
@ -1558,7 +1558,7 @@ the makefile (often with a target called @samp{all}).
prerequisites from source files themselves.
@end menu
@ifinfo
@ifnottex
@node Rule Example, Rule Syntax, Rules, Rules
@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
added to the prerequisites.
@end itemize
@end ifinfo
@end ifnottex
@node Rule Syntax, Prerequisite Types, Rule Example, Rules
@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
expansion, but you need more sophisticated techniques, including the
@code{wildcard} function and string substitution.
@ifinfo
@ifnottex
@xref{Wildcard Function, ,The Function @code{wildcard}}.
@end ifinfo
@end ifnottex
@iftex
These are described in the following section.
@end iftex
@ -3737,9 +3737,9 @@ on the command line, by putting them in the @code{MAKEFLAGS} variable.
@iftex
See the next section.
@end iftex
@ifinfo
@ifnottex
@xref{Options/Recursion}.
@end ifinfo
@end ifnottex
Variables are @emph{not} normally passed down if they were created by
default by @code{make} (@pxref{Implicit Variables, ,Variables Used by
@ -5051,9 +5051,9 @@ endef
@iftex
See the next section for information about @code{define}.
@end iftex
@ifinfo
@ifnottex
@xref{Defining, ,Defining Variables Verbatim}.
@end ifinfo
@end ifnottex
@node Defining, Environment, Override Directive, Using Variables
@section Defining Variables Verbatim

9
main.c
View File

@ -2141,7 +2141,6 @@ handle_non_switch_argument (char *arg, int env)
static void
print_usage (int bad)
{
extern char *make_host;
const char *const *cpp;
FILE *usageto;
@ -2700,7 +2699,7 @@ print_version (void)
word "Copyright", so it hardly seems worth it. */
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);
printf (_("%sThis is free software; see the source for copying conditions.\n\
@ -2708,6 +2707,12 @@ print_version (void)
%sPARTICULAR PURPOSE.\n"),
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;
/* 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 *starting_directory;
extern unsigned int makelevel;
extern char *version_string, *remote_description;
extern char *version_string, *remote_description, *make_host;
extern unsigned int commands_started;

View File

@ -1,37 +1,62 @@
#ifndef _DIRENT_H
#define _DIRENT_H
#include <stdlib.h>
#include <windows.h>
#include <limits.h>
#include <sys/types.h>
#ifndef NAME_MAX
#define NAME_MAX 255
#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
/* Windows version of dirent.h
Copyright (C) 1996, 1997, 2003 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Make is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Make; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
#ifndef _DIRENT_H
#define _DIRENT_H
#ifdef __MINGW32__
# include <windows.h>
# include_next <dirent.h>
#else
#include <stdlib.h>
#include <windows.h>
#include <limits.h>
#include <sys/types.h>
#ifndef NAME_MAX
#define NAME_MAX 255
#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