summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2023-01-15 18:27:13 -0500
committerPaul Smith <psmith@gnu.org>2023-01-15 18:27:13 -0500
commit6128c3e266940ebc3c5e5a4a54241354334d1ebc (patch)
treeb322c061c1b04aceb25083e9ef3a0b16e9648df8
parentceb52b5d1b10ce0f5a1ab090e1911cdde6f7d98a (diff)
downloadmake-git-6128c3e266940ebc3c5e5a4a54241354334d1ebc.tar.gz
Rename WINDOWS32 macro to MK_OS_W32
* configure.ac: Set MK_OS_W32 to 1 if we're on Windows32. * src/config.h.W32: Ditto. * mk/Windows32.mk: Ditto. * src/makeint.h: Convert #if refs to WINDOWS32, to use MK_OS_W32. * src/*: Ditto. * src/w32/*: Ditto. * gl/lib/*: Ditto.
-rw-r--r--configure.ac2
-rw-r--r--gl/lib/glob.c28
-rw-r--r--mk/Windows32.mk2
-rw-r--r--src/arscan.c4
-rw-r--r--src/commands.c8
-rw-r--r--src/config.h.W326
-rw-r--r--src/default.c2
-rw-r--r--src/dir.c56
-rw-r--r--src/function.c8
-rw-r--r--src/hash.h2
-rw-r--r--src/job.c96
-rw-r--r--src/main.c34
-rw-r--r--src/makeint.h8
-rw-r--r--src/misc.c6
-rw-r--r--src/mkcustom.h2
-rw-r--r--src/os.h2
-rw-r--r--src/output.c8
-rw-r--r--src/read.c20
-rw-r--r--src/remake.c12
-rw-r--r--src/variable.c14
-rw-r--r--src/vpath.c4
-rw-r--r--src/w32/compat/dirent.c4
-rw-r--r--src/w32/include/dirent.h2
-rw-r--r--src/w32/pathstuff.c2
24 files changed, 165 insertions, 167 deletions
diff --git a/configure.ac b/configure.ac
index c17ec99f..645b4466 100644
--- a/configure.ac
+++ b/configure.ac
@@ -449,7 +449,7 @@ AS_CASE([$host],
[*-*-mingw32],
[AM_CONDITIONAL([WINDOWSENV], [true])
w32_target_env=yes
- AC_DEFINE([WINDOWS32], [1], [Build for the WINDOWS32 API.])
+ AC_DEFINE([MK_OS_W32], [1], [Build for the Windows32 API.])
AC_DEFINE([HAVE_DOS_PATHS], [1], [Support DOS-style pathnames.])
])
diff --git a/gl/lib/glob.c b/gl/lib/glob.c
index a18c8942..a5bcd8d7 100644
--- a/gl/lib/glob.c
+++ b/gl/lib/glob.c
@@ -71,7 +71,7 @@ USA. */
# endif
#endif
-#if !defined _AMIGA && !MK_OS_VMS && !defined WINDOWS32
+#if !defined _AMIGA && !MK_OS_VMS && !MK_OS_W32
# include <pwd.h>
#endif
@@ -115,7 +115,7 @@ extern int errno;
#endif
-#if (defined POSIX || defined WINDOWS32) && !defined __GNU_LIBRARY__
+#if (defined POSIX || MK_OS_W32) && !defined __GNU_LIBRARY__
/* Posix does not require that the d_ino field be present, and some
systems do not provide it. */
# define REAL_DIR_ENTRY(dp) 1
@@ -146,11 +146,11 @@ extern int errno;
# include <alloca.h>
# else /* Not HAVE_ALLOCA_H. */
# ifndef _AIX
-# ifdef WINDOWS32
+# if MK_OS_W32
# include <malloc.h>
# else
extern char *alloca ();
-# endif /* WINDOWS32 */
+# endif /* MK_OS_W32 */
# endif /* Not _AIX. */
# endif /* sparc or HAVE_ALLOCA_H. */
# endif /* GCC. */
@@ -416,14 +416,14 @@ glob (const char *pattern, int flags,
/* Find the filename. */
filename = strrchr (pattern, '/');
-#if defined __MSDOS__ || defined WINDOWS32
+#if defined __MSDOS__ || MK_OS_W32
/* The case of "d:pattern". Since `:' is not allowed in
file names, we can safely assume that wherever it
happens in pattern, it signals the filename part. This
is so we could some day support patterns like "[a-z]:foo". */
if (filename == NULL)
filename = strchr (pattern, ':');
-#endif /* __MSDOS__ || WINDOWS32 */
+#endif /* __MSDOS__ || MK_OS_W32 */
if (filename == NULL)
{
/* This can mean two things: a simple name or "~name". The later
@@ -460,7 +460,7 @@ glob (const char *pattern, int flags,
{
char *newp;
dirlen = filename - pattern;
-#if defined __MSDOS__ || defined WINDOWS32
+#if defined __MSDOS__ || MK_OS_W32
if (*filename == ':'
|| (filename > pattern + 1 && filename[-1] == ':'))
{
@@ -494,7 +494,7 @@ glob (const char *pattern, int flags,
++filename;
if (filename[0] == '\0'
-#if defined __MSDOS__ || defined WINDOWS32
+#if defined __MSDOS__ || MK_OS_W32
&& dirname[dirlen - 1] != ':'
&& (dirlen < 3 || dirname[dirlen - 2] != ':'
|| dirname[dirlen - 1] != '/')
@@ -534,7 +534,7 @@ glob (const char *pattern, int flags,
if (home_dir == NULL || home_dir[0] == '\0')
home_dir = "SYS:";
# else
-# ifdef WINDOWS32
+# if MK_OS_W32
if (home_dir == NULL || home_dir[0] == '\0')
home_dir = "c:/users/default"; /* poor default */
# else
@@ -602,7 +602,7 @@ glob (const char *pattern, int flags,
home_dir = "~"; /* No luck. */
}
# endif /* MK_OS_VMS */
-# endif /* WINDOWS32 */
+# endif /* MK_OS_W32 */
# endif
/* Now construct the full directory. */
if (dirname[1] == '\0')
@@ -622,7 +622,7 @@ glob (const char *pattern, int flags,
dirname = newp;
}
}
-# if !defined _AMIGA && !defined WINDOWS32 && !MK_OS_VMS
+# if !defined _AMIGA && !MK_OS_W32 && !MK_OS_VMS
else
{
char *end_name = strchr (dirname, '/');
@@ -702,7 +702,7 @@ glob (const char *pattern, int flags,
home directory. */
return GLOB_NOMATCH;
}
-# endif /* Not Amiga && not WINDOWS32 && not MK_OS_VMS. */
+# endif /* Not Amiga && not MK_OS_W32 && not MK_OS_VMS. */
}
#endif /* Not MK_OS_VMS. */
@@ -1011,7 +1011,7 @@ prefix_array (const char *dirname, char **array, size_t n)
{
size_t i;
size_t dirlen = strlen (dirname);
-#if defined __MSDOS__ || defined WINDOWS32
+#if defined __MSDOS__ || MK_OS_W32
char sep_char = '/';
# define DIRSEP_CHAR sep_char
#else
@@ -1022,7 +1022,7 @@ prefix_array (const char *dirname, char **array, size_t n)
/* DIRNAME is just "/", so normal prepending would get us "//foo".
We want "/foo" instead, so don't prepend any chars from DIRNAME. */
dirlen = 0;
-#if defined __MSDOS__ || defined WINDOWS32
+#if defined __MSDOS__ || MK_OS_W32
else if (dirlen > 1)
{
if (dirname[dirlen - 1] == '/' && dirname[dirlen - 2] == ':')
diff --git a/mk/Windows32.mk b/mk/Windows32.mk
index 27712f36..57226eb1 100644
--- a/mk/Windows32.mk
+++ b/mk/Windows32.mk
@@ -43,7 +43,7 @@ LDFLAGS =
msvc_CC = cl.exe
msvc_LD = link.exe
-msvc_CPPFLAGS = /DHAVE_CONFIG_H /DWINDOWS32 /DWIN32 /D_CONSOLE
+msvc_CPPFLAGS = /DHAVE_CONFIG_H /DMK_OS_W32=1 /DWIN32 /D_CONSOLE
msvc_CPPFLAGS += /I$(OUTDIR)src /I$(SRCDIR)/src /I$(SRCDIR)/src/w32/include /I$(OUTDIR)lib /I$(SRCDIR)/lib
msvc_CFLAGS = /nologo /MT /W4 /EHsc
diff --git a/src/arscan.c b/src/arscan.c
index 89f0e3b6..1b5899bd 100644
--- a/src/arscan.c
+++ b/src/arscan.c
@@ -330,7 +330,7 @@ ar_scan (const char *archive, ar_member_func_t function, const void *varg)
# define __AR_BIG__
#endif
-#ifndef WINDOWS32
+#if !MK_OS_W32
# if !defined (__ANDROID__) && !defined (__BEOS__) && !defined(MK_OS_ZOS)
# include <ar.h>
# else
@@ -953,7 +953,7 @@ ar_member_touch (const char *arname, const char *memname)
if (r < 0)
goto lose;
/* Advance member's time to that time */
-#if defined(ARFMAG) || defined(ARFZMAG) || defined(AIAMAG) || defined(WINDOWS32)
+#if defined(ARFMAG) || defined(ARFZMAG) || defined(AIAMAG) || MK_OS_W32
datelen = snprintf (TOCHAR (ar_hdr.ar_date), sizeof ar_hdr.ar_date,
"%" PRIdMAX, (intmax_t) statbuf.st_mtime);
if (! (0 <= datelen && datelen < (int) sizeof ar_hdr.ar_date))
diff --git a/src/commands.c b/src/commands.c
index e95e0262..881d9f49 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -21,7 +21,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#include "variable.h"
#include "job.h"
#include "commands.h"
-#ifdef WINDOWS32
+#if MK_OS_W32
#include <windows.h>
#include "w32err.h"
#endif
@@ -495,7 +495,7 @@ fatal_error_signal (int sig)
remove_intermediates (1);
exit (EXIT_FAILURE);
#else /* not __MSDOS__ */
-#ifdef WINDOWS32
+#if MK_OS_W32
extern HANDLE main_thread;
/* Windows creates a separate thread for handling Ctrl+C, so we need
@@ -581,7 +581,7 @@ fatal_error_signal (int sig)
exit (MAKE_TROUBLE);
#endif
-#ifdef WINDOWS32
+#if MK_OS_W32
if (main_thread)
CloseHandle (main_thread);
/* Cannot call W32_kill with a pid (it needs a handle). The exit
@@ -592,7 +592,7 @@ fatal_error_signal (int sig)
will be unblocked when we return and arrive then to kill us. */
if (kill (make_pid (), sig) < 0)
pfatal_with_name ("kill");
-#endif /* not WINDOWS32 */
+#endif /* not MK_OS_W32 */
#endif /* not __MSDOS__ */
}
diff --git a/src/config.h.W32 b/src/config.h.W32
index bf23d8d9..d752c3ff 100644
--- a/src/config.h.W32
+++ b/src/config.h.W32
@@ -17,10 +17,8 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#include "mkconfig.h"
-#define MK_W32 1
-
-/* Build for the WINDOWS32 API. */
-#define WINDOWS32 1
+/* Build for the Windows32 API. */
+#define MK_OS_W32 1
/* Suppress some Visual C++ warnings.
Maybe after the code cleanup for ISO C we can remove some/all of these. */
diff --git a/src/default.c b/src/default.c
index db132f78..c0972f23 100644
--- a/src/default.c
+++ b/src/default.c
@@ -664,7 +664,7 @@ static const char *default_variables[] =
".LIBPATTERNS", "lib%.a $(DJDIR)/lib/lib%.a",
#elif defined(__APPLE__)
".LIBPATTERNS", "lib%.dylib lib%.a",
-#elif defined(__CYGWIN__) || defined(WINDOWS32)
+#elif defined(__CYGWIN__) || MK_OS_W32
".LIBPATTERNS", "lib%.dll.a %.dll.a lib%.a %.lib lib%.dll %.dll",
#else
".LIBPATTERNS", "lib%.so lib%.a",
diff --git a/src/dir.c b/src/dir.c
index 5abafae9..f3e5127b 100644
--- a/src/dir.c
+++ b/src/dir.c
@@ -50,7 +50,7 @@ const char *vmsify (const char *name, int type);
# define NAMLEN(d) _D_NAMLEN(d)
#endif
-#if (defined (POSIX) || MK_OS_VMS || defined (WINDOWS32)) && !defined (__GNU_LIBRARY__)
+#if (defined (POSIX) || MK_OS_VMS || MK_OS_W32) && !defined (__GNU_LIBRARY__)
/* Posix does not require that the d_ino field be present, and some
systems do not provide it. */
# define REAL_DIR_ENTRY(dp) 1
@@ -110,7 +110,7 @@ dosify (const char *filename)
}
#endif /* __MSDOS__ */
-#ifdef WINDOWS32
+#if MK_OS_W32
#include "pathstuff.h"
#endif
@@ -244,8 +244,8 @@ static unsigned int open_directories = 0;
struct directory_contents
{
dev_t dev; /* Device and inode numbers of this dir. */
-#ifdef WINDOWS32
- /* Inode means nothing on WINDOWS32. Even file key information is
+#if MK_OS_W32
+ /* Inode means nothing on Windows32. Even file key information is
* unreliable because it is random per file open and undefined for remote
* filesystems. The most unique attribute I can come up with is the fully
* qualified name of the directory. Beware though, this is also
@@ -263,7 +263,7 @@ struct directory_contents
# else
ino_t ino;
# endif
-#endif /* WINDOWS32 */
+#endif /* MK_OS_W32 */
struct hash_table dirfiles; /* Files in this directory. */
unsigned long counter; /* command_count value when last read. */
DIR *dirstream; /* Stream reading this directory. */
@@ -291,7 +291,7 @@ directory_contents_hash_1 (const void *key_0)
const struct directory_contents *key = key_0;
unsigned long hash;
-#ifdef WINDOWS32
+#if MK_OS_W32
hash = 0;
ISTRING_HASH_1 (key->path_key, hash);
hash ^= ((unsigned int) key->dev << 4) ^ (unsigned int) key->ctime;
@@ -304,7 +304,7 @@ directory_contents_hash_1 (const void *key_0)
# else
hash = ((unsigned int) key->dev << 4) ^ (unsigned int) key->ino;
# endif
-#endif /* WINDOWS32 */
+#endif /* MK_OS_W32 */
return hash;
}
@@ -314,7 +314,7 @@ directory_contents_hash_2 (const void *key_0)
const struct directory_contents *key = key_0;
unsigned long hash;
-#ifdef WINDOWS32
+#if MK_OS_W32
hash = 0;
ISTRING_HASH_2 (key->path_key, hash);
hash ^= ((unsigned int) key->dev << 4) ^ (unsigned int) ~key->ctime;
@@ -327,7 +327,7 @@ directory_contents_hash_2 (const void *key_0)
# else
hash = ((unsigned int) key->dev << 4) ^ (unsigned int) ~key->ino;
# endif
-#endif /* WINDOWS32 */
+#endif /* MK_OS_W32 */
return hash;
}
@@ -350,7 +350,7 @@ directory_contents_hash_cmp (const void *xv, const void *yv)
const struct directory_contents *y = yv;
int result;
-#ifdef WINDOWS32
+#if MK_OS_W32
ISTRING_COMPARE (x->path_key, y->path_key, result);
if (result)
return result;
@@ -373,7 +373,7 @@ directory_contents_hash_cmp (const void *xv, const void *yv)
if (result)
return result;
# endif
-#endif /* WINDOWS32 */
+#endif /* MK_OS_W32 */
return MAKECMP(x->dev, y->dev);
}
@@ -471,7 +471,7 @@ find_directory (const char *name)
struct stat st;
int r;
-#ifdef WINDOWS32
+#if MK_OS_W32
char *w32_path;
#endif
@@ -516,7 +516,7 @@ find_directory (const char *name)
dir->counter = command_count;
/* See if the directory exists. */
-#if defined(WINDOWS32)
+#if MK_OS_W32
{
char tem[MAX_PATH+1], *tstart, *tend;
size_t len = strlen (name);
@@ -544,7 +544,7 @@ find_directory (const char *name)
memset (&dc_key, '\0', sizeof (dc_key));
dc_key.dev = st.st_dev;
-#ifdef WINDOWS32
+#if MK_OS_W32
dc_key.path_key = w32_path = w32ify (name, 1);
dc_key.ctime = st.st_ctime;
#else
@@ -562,7 +562,7 @@ find_directory (const char *name)
if (HASH_VACANT (dc))
{
/* Nope; this really is a directory we haven't seen before. */
-#ifdef WINDOWS32
+#if MK_OS_W32
char fs_label[BUFSIZ];
char fs_type[BUFSIZ];
unsigned long fs_serno;
@@ -573,11 +573,11 @@ find_directory (const char *name)
dc = xcalloc (sizeof (struct directory_contents));
*dc = dc_key;
-#ifdef WINDOWS32
+#if MK_OS_W32
dc->path_key = xstrdup (w32_path);
dc->mtime = st.st_mtime;
- /* NTFS is the only WINDOWS32 filesystem that bumps mtime on a
+ /* NTFS is the only Windows32 filesystem that bumps mtime on a
directory when files are added/deleted from a directory. */
w32_path[3] = '\0';
if (GetVolumeInformation (w32_path, fs_label, sizeof (fs_label),
@@ -590,7 +590,7 @@ find_directory (const char *name)
dc->fs_flags = FS_NTFS;
else
dc->fs_flags = FS_UNKNOWN;
-#endif /* WINDOWS32 */
+#endif /* MK_OS_W32 */
hash_insert_at (&directory_contents, dc, dc_slot);
}
@@ -636,7 +636,7 @@ dir_contents_file_exists_p (struct directory *dir,
struct dirfile *df;
struct dirent *d;
struct directory_contents *dc = dir->contents;
-#ifdef WINDOWS32
+#if MK_OS_W32
struct stat st;
int rehash = 0;
#endif
@@ -684,7 +684,7 @@ dir_contents_file_exists_p (struct directory *dir,
if (dc->dirstream == NULL)
{
-#ifdef WINDOWS32
+#if MK_OS_W32
/*
* Check to see if directory has changed since last read. FAT
* filesystems force a rehash always as mtime does not change
@@ -751,7 +751,7 @@ dir_contents_file_exists_p (struct directory *dir,
dirfile_key.name = d->d_name;
dirfile_key.length = len;
dirfile_slot = (struct dirfile **) hash_find_slot (&dc->dirfiles, &dirfile_key);
-#ifdef WINDOWS32
+#if MK_OS_W32
/*
* If re-reading a directory, don't cache files that have
* already been discovered.
@@ -1085,7 +1085,7 @@ print_dir_data_base (void)
unsigned int impossible;
struct directory **dir_slot;
struct directory **dir_end;
-#ifdef WINDOWS32
+#if MK_OS_W32
char buf[INTSTR_LENGTH + 1];
#endif
@@ -1103,7 +1103,7 @@ print_dir_data_base (void)
if (dir->contents == NULL)
printf (_("# %s: could not be stat'd.\n"), dir->name);
else if (dir->contents->dirfiles.ht_vec == NULL)
-#ifdef WINDOWS32
+#if MK_OS_W32
printf (_("# %s (key %s, mtime %s): could not be opened.\n"),
dir->name, dir->contents->path_key,
make_ulltoa ((unsigned long long)dir->contents->mtime, buf));
@@ -1136,7 +1136,7 @@ print_dir_data_base (void)
++f;
}
}
-#ifdef WINDOWS32
+#if MK_OS_W32
printf (_("# %s (key %s, mtime %s): "),
dir->name, dir->contents->path_key,
make_ulltoa ((unsigned long long)dir->contents->mtime, buf));
@@ -1274,7 +1274,7 @@ read_dirstream (void *stream)
* On MS-Windows, stat() "succeeds" for foo/bar/. where foo/bar is a
* regular file; fix that here.
*/
-#if !defined(stat) && !defined(WINDOWS32) || MK_OS_VMS
+#if !defined(stat) && !MK_OS_W32 || MK_OS_VMS
# if !MK_OS_VMS
# ifndef HAVE_SYS_STAT_H
int stat (const char *path, struct stat *sbuf);
@@ -1291,7 +1291,7 @@ static int
local_stat (const char *path, struct stat *buf)
{
int e;
-#ifdef WINDOWS32
+#if MK_OS_W32
size_t plen = strlen (path);
/* Make sure the parent of "." exists and is a directory, not a
@@ -1314,7 +1314,7 @@ local_stat (const char *path, struct stat *buf)
#endif
/* Similarly for lstat. */
-#if !defined(lstat) && !defined(WINDOWS32) || MK_OS_VMS
+#if !defined(lstat) && !MK_OS_W32 || MK_OS_VMS
# if !MK_OS_VMS
# ifndef HAVE_SYS_STAT_H
int lstat (const char *path, struct stat *sbuf);
@@ -1326,7 +1326,7 @@ int lstat (const char *path, struct stat *sbuf);
# endif
# endif
# define local_lstat lstat
-#elif defined(WINDOWS32)
+#elif MK_OS_W32
/* Windows doesn't support lstat(). */
# define local_lstat local_stat
#else
diff --git a/src/function.c b/src/function.c
index 63ea50f8..3b6bc203 100644
--- a/src/function.c
+++ b/src/function.c
@@ -1618,7 +1618,7 @@ shell_completed (int exit_code, int exit_sig)
define_variable_cname (".SHELLSTATUS", buf, o_override, 0);
}
-#ifdef WINDOWS32
+#if MK_OS_W32
/*untested*/
#include <windows.h>
@@ -1836,7 +1836,7 @@ func_shell_base (char *o, char **argv, int trim_newlines)
pid_t pid;
#ifndef __MSDOS__
-#ifdef WINDOWS32
+#if MK_OS_W32
/* Reset just_print_flag. This is needed on Windows when batch files
are used to run the commands, because we normally refrain from
creating batch files under -n. */
@@ -1849,7 +1849,7 @@ func_shell_base (char *o, char **argv, int trim_newlines)
&batch_filename);
if (command_argv == 0)
{
-#ifdef WINDOWS32
+#if MK_OS_W32
just_print_flag = j_p_f;
#endif
return o;
@@ -1873,7 +1873,7 @@ func_shell_base (char *o, char **argv, int trim_newlines)
goto done;
}
-#elif defined(WINDOWS32)
+#elif MK_OS_W32
windows32_openpipe (pipedes, errfd, &pid, command_argv, child.environment);
/* Restore the value of just_print_flag. */
just_print_flag = j_p_f;
diff --git a/src/hash.h b/src/hash.h
index deaceab6..56f9a90b 100644
--- a/src/hash.h
+++ b/src/hash.h
@@ -20,7 +20,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#include <stdio.h>
#include <ctype.h>
-#if defined __cplusplus || (defined __STDC__ && __STDC__) || defined WINDOWS32
+#if defined __cplusplus || (defined __STDC__ && __STDC__) || MK_OS_W32
# if !defined __GLIBC__ || !defined __P
# undef __P
# define __P(protos) protos
diff --git a/src/job.c b/src/job.c
index 9a5d4b30..459ae7e2 100644
--- a/src/job.c
+++ b/src/job.c
@@ -29,7 +29,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#include "shuffle.h"
/* Default shell to use. */
-#ifdef WINDOWS32
+#if MK_OS_W32
# include <windows.h>
const char *default_shell = "sh.exe";
@@ -92,7 +92,7 @@ int dos_command_running;
static void vmsWaitForChildren (int *);
#endif
-#ifdef WINDOWS32
+#if MK_OS_W32
# include <windows.h>
# include <io.h>
# include <process.h>
@@ -100,7 +100,7 @@ static void vmsWaitForChildren (int *);
# include "w32err.h"
# include "pathstuff.h"
# define WAIT_NOHANG 1
-#endif /* WINDOWS32 */
+#endif /* MK_OS_W32 */
#ifdef __EMX__
# include <process.h>
@@ -175,7 +175,7 @@ int wait ();
#endif /* Don't have 'union wait'. */
-#if !defined(HAVE_UNISTD_H) && !defined(WINDOWS32)
+#if !defined(HAVE_UNISTD_H) && !MK_OS_W32
int dup2 ();
int execve ();
void _exit ();
@@ -201,7 +201,7 @@ static const char *
pid2str (pid_t pid)
{
static char pidstring[100];
-#if defined(WINDOWS32) && (__GNUC__ > 3 || _MSC_VER > 1300)
+#if MK_OS_W32 && (__GNUC__ > 3 || _MSC_VER > 1300)
/* %Id is only needed for 64-builds, which were not supported by
older versions of Windows compilers. */
sprintf (pidstring, "%Id", pid);
@@ -246,7 +246,7 @@ unsigned long job_counter = 0;
unsigned int jobserver_tokens = 0;
-#ifdef WINDOWS32
+#if MK_OS_W32
/*
* The macro which references this function is defined in makeint.h.
*/
@@ -366,7 +366,7 @@ create_batch_file (char const *base, int unixy, int *fd)
/* not reached */
return NULL;
}
-#endif /* WINDOWS32 */
+#endif /* MK_OS_W32 */
#ifdef __EMX__
/* returns whether path is assumed to be a unix like shell. */
@@ -440,7 +440,7 @@ is_bourne_compatible_shell (const char *path)
/* this should be able to deal with extensions on Windows-like systems */
for (s = unix_shells; *s != NULL; ++s)
{
-#if defined(WINDOWS32) || defined(__MSDOS__)
+#if MK_OS_W32 || defined(__MSDOS__)
size_t len = strlen (*s);
if ((strlen (cp) >= len && STOP_SET (cp[len], MAP_DOT|MAP_NUL))
&& strncasecmp (cp, *s, len) == 0)
@@ -618,7 +618,7 @@ extern pid_t shell_function_pid;
void
reap_children (int block, int err)
{
-#ifndef WINDOWS32
+#if !MK_OS_W32
WAIT_T status;
#endif
/* Initially, assume we have some. */
@@ -724,7 +724,7 @@ reap_children (int block, int err)
else
{
/* No remote children. Check for local children. */
-#if !defined(__MSDOS__) && !defined(WINDOWS32)
+#if !defined(__MSDOS__) && !MK_OS_W32
if (any_local)
{
#if MK_OS_VMS
@@ -783,7 +783,7 @@ reap_children (int block, int err)
/* We got a remote child. */
remote = 1;
}
-#endif /* !__MSDOS__, !WINDOWS32. */
+#endif /* !__MSDOS__, !MK_OS_W32. */
#ifdef __MSDOS__
/* Life is very different on MSDOS. */
@@ -795,7 +795,7 @@ reap_children (int block, int err)
exit_sig = WIFSIGNALED (status) ? WTERMSIG (status) : 0;
coredump = 0;
#endif /* __MSDOS__ */
-#ifdef WINDOWS32
+#if MK_OS_W32
{
HANDLE hPID;
HANDLE hcTID, hcPID;
@@ -861,7 +861,7 @@ reap_children (int block, int err)
pid = (pid_t) hPID;
}
-#endif /* WINDOWS32 */
+#endif /* MK_OS_W32 */
}
/* Some child finished: increment the command count. */
@@ -1408,7 +1408,7 @@ start_job_command (struct child *child)
child->environment = target_environment (child->file,
child->file->cmds->any_recurse);
-#if !defined(__MSDOS__) && !defined(WINDOWS32)
+#if !defined(__MSDOS__) && !MK_OS_W32
#if !MK_OS_VMS
/* start_waiting_job has set CHILD->remote if we can start a remote job. */
@@ -1457,7 +1457,7 @@ start_job_command (struct child *child)
#endif /* !MK_OS_VMS */
}
-#else /* __MSDOS__ or WINDOWS32 */
+#else /* __MSDOS__ or MK_OS_W32 */
#ifdef __MSDOS__
{
int proc_return;
@@ -1514,7 +1514,7 @@ start_job_command (struct child *child)
child->pid = dos_pid++;
}
#endif /* __MSDOS__ */
-#ifdef WINDOWS32
+#if MK_OS_W32
{
HANDLE hPID;
char* arg0;
@@ -1557,8 +1557,8 @@ start_job_command (struct child *child)
child->pid = -1;
}
}
-#endif /* WINDOWS32 */
-#endif /* __MSDOS__ or WINDOWS32 */
+#endif /* MK_OS_W32 */
+#endif /* __MSDOS__ or MK_OS_W32 */
/* Bump the number of jobs started in this second. */
if (child->pid >= 0)
@@ -1594,7 +1594,7 @@ start_waiting_job (struct child *c)
is too high, make this one wait. */
if (!c->remote
&& ((job_slots_used > 0 && load_too_high ())
-#ifdef WINDOWS32
+#if MK_OS_W32
|| process_table_full ()
#endif
))
@@ -2027,7 +2027,7 @@ load_too_high (void)
double load, guess;
time_t now;
-#ifdef WINDOWS32
+#if MK_OS_W32
/* sub_proc.c is limited in the number of objects it can wait for. */
if (process_table_full ())
return 1;
@@ -2168,7 +2168,7 @@ start_waiting_jobs (void)
return;
}
-#ifndef WINDOWS32
+#if !MK_OS_W32
/* EMX: Start a child process. This function returns the new pid. */
# if defined __EMX__
@@ -2468,7 +2468,7 @@ child_execute_job (struct childbase *child, int good_stdin, char **argv)
return pid;
}
#endif /* !__MSDOS__ && !MK_OS_VMS */
-#endif /* !WINDOWS32 */
+#endif /* !MK_OS_W32 */
/* Replace the current process with one running the command in ARGV,
with environment ENVP. This function does not return. */
@@ -2486,7 +2486,7 @@ exec_command (char **argv, char **envp)
OSS (error, NILF, "%s: %s", argv[0], strerror (errno));
_exit (EXIT_FAILURE);
#else
-#ifdef WINDOWS32
+#if MK_OS_W32
HANDLE hPID;
HANDLE hWaitPID;
int exit_code = EXIT_FAILURE;
@@ -2543,7 +2543,7 @@ exec_command (char **argv, char **envp)
/* Use the child's exit code as our exit code */
exit (exit_code);
-#else /* !WINDOWS32 */
+#else /* !MK_OS_W32 */
pid_t pid = -1;
@@ -2652,7 +2652,7 @@ exec_command (char **argv, char **envp)
}
return pid;
-#endif /* !WINDOWS32 */
+#endif /* !MK_OS_W32 */
#endif /* !MK_OS_VMS */
}
@@ -2671,7 +2671,7 @@ exec_command (char **argv, char **envp)
IFS is the value of $IFS, or nil (meaning the default).
FLAGS is the value of lines_flags for this command line. It is used in the
- WINDOWS32 port to check whether + or $(MAKE) were found in this command
+ Windows32 port to check whether + or $(MAKE) were found in this command
line, in which case the effect of just_print_flag is overridden.
The returned value is either NULL if the line was empty, or else a pointer
@@ -2752,7 +2752,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
const char *sh_chars;
const char **sh_cmds;
-#elif defined (WINDOWS32)
+#elif MK_OS_W32
/* We used to have a double quote (") in sh_chars_dos[] below, but
that caused any command line with quoted file names be run
through a temporary batch file, which introduces command-line
@@ -2795,7 +2795,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
# ifdef HAVE_DOS_PATHS
/* This is required if the MSYS/Cygwin ports (which do not define
- WINDOWS32) are compiled with HAVE_DOS_PATHS defined, which uses
+ MK_OS_W32) are compiled with HAVE_DOS_PATHS defined, which uses
sh_chars_sh directly (see below). The value must be identical
to that of sh_chars immediately above. */
static const char *sh_chars_sh = "#;\"*?[]&|<>(){}$`^~!";
@@ -2812,7 +2812,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
int instring, word_has_equals, seen_nonequals, last_argument_was_empty;
char **new_argv = 0;
char *argstr = 0;
-#ifdef WINDOWS32
+#if MK_OS_W32
int slow_flag = 0;
if (!unixy_shell)
@@ -2825,7 +2825,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
sh_cmds = sh_cmds_sh;
sh_chars = sh_chars_sh;
}
-#endif /* WINDOWS32 */
+#endif /* MK_OS_W32 */
if (restp != NULL)
*restp = NULL;
@@ -2842,7 +2842,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
/* See if it is safe to parse commands internally. */
if (shell == 0)
shell = default_shell;
-#ifdef WINDOWS32
+#if MK_OS_W32
else if (strcmp (shell, default_shell))
{
char *s1 = _fullpath (NULL, shell, 0);
@@ -2855,7 +2855,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
}
if (slow_flag)
goto slow;
-#else /* not WINDOWS32 */
+#else /* not MK_OS_W32 */
#if defined (__MSDOS__) || defined (__EMX__)
else if (strcasecmp (shell, default_shell))
{
@@ -2889,7 +2889,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
else if (strcmp (shell, default_shell))
goto slow;
#endif /* !__MSDOS__ && !__EMX__ */
-#endif /* not WINDOWS32 */
+#endif /* not MK_OS_W32 */
if (ifs)
for (cap = ifs; *cap != '\0'; ++cap)
@@ -2938,7 +2938,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
DOS/Windows/OS2, if we don't have a POSIX shell, we keep the
pre-POSIX behavior of removing the backslash-newline. */
if (instring == '"'
-#if defined (__MSDOS__) || defined (__EMX__) || defined (WINDOWS32)
+#if defined (__MSDOS__) || defined (__EMX__) || MK_OS_W32
|| !unixy_shell
#endif
)
@@ -2961,7 +2961,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
quotes have the same effect. */
else if (instring == '"' && strchr ("\\$`", *p) != 0 && unixy_shell)
goto slow;
-#ifdef WINDOWS32
+#if MK_OS_W32
/* Quoted wildcard characters must be passed quoted to the
command, so give up the fast route. */
else if (instring == '"' && strchr ("*?", *p) != 0 && !unixy_shell)
@@ -3012,7 +3012,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
while (ISBLANK (p[1]))
++p;
}
-#ifdef WINDOWS32
+#if MK_OS_W32
/* Backslash before whitespace is not special if our shell
is not Unixy. */
else if (ISSPACE (p[1]) && !unixy_shell)
@@ -3096,7 +3096,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
{
if (streq (sh_cmds[j], new_argv[0]))
goto slow;
-#if defined(__EMX__) || defined(WINDOWS32)
+#if defined(__EMX__) || MK_OS_W32
/* Non-Unix shells are case insensitive. */
if (!unixy_shell
&& strcasecmp (sh_cmds[j], new_argv[0]) == 0)
@@ -3160,7 +3160,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
execute_by_shell = 1; /* actually, call 'system' if shell isn't unixy */
#endif
-#ifdef WINDOWS32
+#if MK_OS_W32
/*
* Not eating this whitespace caused things like
*
@@ -3175,7 +3175,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
NEXT_TOKEN (line);
if (*line == '\0')
return 0;
-#endif /* WINDOWS32 */
+#endif /* MK_OS_W32 */
{
/* SHELL may be a multi-word command. Construct a command line
@@ -3187,7 +3187,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
size_t shell_len = strlen (shell);
size_t line_len = strlen (line);
size_t sflags_len = shellflags ? strlen (shellflags) : 0;
-#ifdef WINDOWS32
+#if MK_OS_W32
char *command_ptr = NULL; /* used for batch_mode_shell mode */
#endif
@@ -3222,7 +3222,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
if (unixy_shell) /* the test is complicated and we already did it */
#else
if (is_bourne_compatible_shell (shell)
-#ifdef WINDOWS32
+#if MK_OS_W32
/* If we didn't find any sh.exe, don't behave is if we did! */
&& !no_default_sh_exe
#endif
@@ -3262,7 +3262,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
}
*t = '\0';
}
-#ifdef WINDOWS32
+#if MK_OS_W32
else /* non-Posix shell (cmd.exe etc.) */
{
const char *f = line;
@@ -3334,7 +3334,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
new_argv[1] = NULL;
return new_argv;
}
-#endif /* WINDOWS32 */
+#endif /* MK_OS_W32 */
/* Create an argv list for the shell command line. */
{
int n = 1;
@@ -3399,7 +3399,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
ap = mempcpy (ap, shellflags, sflags_len);
*(ap++) = ' ';
}
-#ifdef WINDOWS32
+#if MK_OS_W32
command_ptr = ap;
#endif
for (p = line; *p != '\0'; ++p)
@@ -3414,7 +3414,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
/* POSIX says we keep the backslash-newline. If we don't have a
POSIX shell on DOS/Windows/OS2, mimic the pre-POSIX behavior
and remove the backslash/newline. */
-#if defined (__MSDOS__) || defined (__EMX__) || defined (WINDOWS32)
+#if defined (__MSDOS__) || defined (__EMX__) || MK_OS_W32
# define PRESERVE_BSNL unixy_shell
#else
# define PRESERVE_BSNL 1
@@ -3457,7 +3457,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
}
*ap = '\0';
-#ifdef WINDOWS32
+#if MK_OS_W32
/* Some shells do not work well when invoked as 'sh -c xxx' to run a
command line (e.g. Cygnus GNUWIN32 sh.exe on W32 systems). In these
cases, run commands via a script file. */
@@ -3510,7 +3510,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
new_argv[2] = NULL;
}
else
-#endif /* WINDOWS32 */
+#endif /* MK_OS_W32 */
if (unixy_shell)
new_argv = construct_command_argv_internal (new_line, 0, 0, 0, 0,
@@ -3638,7 +3638,7 @@ construct_command_argv (char *line, char **restp, struct file *file,
warn_undefined_variables_flag = 0;
shell = allocated_variable_expand_for_file ("$(SHELL)", file);
-#ifdef WINDOWS32
+#if MK_OS_W32
/*
* Convert to forward slashes so that construct_command_argv_internal()
* is not confused.
diff --git a/src/main.c b/src/main.c
index 5b4e066b..6eb308b2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -27,7 +27,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#include "shuffle.h"
#include <assert.h>
-#ifdef WINDOWS32
+#if MK_OS_W32
# include <windows.h>
# include <io.h>
# include "pathstuff.h"
@@ -912,7 +912,7 @@ print_usage (int bad)
die (bad ? MAKE_FAILURE : MAKE_SUCCESS);
}
-#ifdef WINDOWS32
+#if MK_OS_W32
/*
* HANDLE runtime exceptions by avoiding a requestor on the GUI. Capture
@@ -1117,7 +1117,7 @@ find_and_set_default_shell (const char *token)
return (sh_found);
}
-#endif /* WINDOWS32 */
+#endif /* MK_OS_W32 */
#ifdef __MSDOS__
static void
@@ -1171,7 +1171,7 @@ main (int argc, char **argv, char **envp)
unsigned int restarts = 0;
unsigned int syncing = 0;
int argv_slots; /* The jobslot info we got from our parent process. */
-#ifdef WINDOWS32
+#if MK_OS_W32
const char *unix_path = NULL;
const char *windows32_path = NULL;
@@ -1399,7 +1399,7 @@ main (int argc, char **argv, char **envp)
/* Figure out where we are. */
-#ifdef WINDOWS32
+#if MK_OS_W32
if (getcwd_fs (current_directory, GET_PATH_MAX) == 0)
#else
if (getcwd (current_directory, GET_PATH_MAX) == 0)
@@ -1497,7 +1497,7 @@ main (int argc, char **argv, char **envp)
if (*ep == '\0')
continue;
-#ifdef WINDOWS32
+#if MK_OS_W32
if (!unix_path && strneq (envp[i], "PATH=", 5))
unix_path = ep+1;
else if (!strnicmp (envp[i], "Path=", 5))
@@ -1542,7 +1542,7 @@ main (int argc, char **argv, char **envp)
v->export = export;
}
}
-#ifdef WINDOWS32
+#if MK_OS_W32
/* If we didn't find a correctly spelled PATH we define PATH as
* either the first misspelled value or an empty string
*/
@@ -1683,7 +1683,7 @@ main (int argc, char **argv, char **envp)
so the result will run the same program regardless of the current dir.
If it is a name with no slash, we can only hope that PATH did not
find it in the current directory.) */
-#ifdef WINDOWS32
+#if MK_OS_W32
/*
* Convert from backslashes to forward slashes for
* programs like sh which don't like them. Shouldn't
@@ -1693,7 +1693,7 @@ main (int argc, char **argv, char **envp)
if (strpbrk (argv[0], "/:\\") || strstr (argv[0], "..")
|| strneq (argv[0], "//", 2))
argv[0] = xstrdup (w32ify (argv[0], 1));
-#else /* WINDOWS32 */
+#else /* MK_OS_W32 */
#if defined (__MSDOS__) || defined (__EMX__)
if (strchr (argv[0], '\\'))
{
@@ -1726,7 +1726,7 @@ main (int argc, char **argv, char **envp)
)
argv[0] = xstrdup (concat (3, current_directory, "/", argv[0]));
#endif /* !__MSDOS__ */
-#endif /* WINDOWS32 */
+#endif /* MK_OS_W32 */
#endif
/* We may move, but until we do, here we are. */
@@ -1739,8 +1739,8 @@ main (int argc, char **argv, char **envp)
for (i = 0; directories->list[i] != 0; ++i)
{
const char *dir = directories->list[i];
-#ifdef WINDOWS32
- /* WINDOWS32 chdir() doesn't work if the directory has a trailing '/'
+#if MK_OS_W32
+ /* Windows32 chdir() doesn't work if the directory has a trailing '/'
But allow -C/ just in case someone wants that. */
{
char *p = (char *)dir + strlen (dir) - 1;
@@ -1754,7 +1754,7 @@ main (int argc, char **argv, char **envp)
}
}
-#ifdef WINDOWS32
+#if MK_OS_W32
/*
* THIS BLOCK OF CODE MUST COME AFTER chdir() CALL ABOVE IN ORDER
* TO NOT CONFUSE THE DEPENDENCY CHECKING CODE IN implicit.c.
@@ -1765,12 +1765,12 @@ main (int argc, char **argv, char **envp)
* at the wrong place when it was first evaluated.
*/
no_default_sh_exe = !find_and_set_default_shell (NULL);
-#endif /* WINDOWS32 */
+#endif /* MK_OS_W32 */
/* If we chdir'ed, figure out where we are now. */
if (directories)
{
-#ifdef WINDOWS32
+#if MK_OS_W32
if (getcwd_fs (current_directory, GET_PATH_MAX) == 0)
#else
if (getcwd (current_directory, GET_PATH_MAX) == 0)
@@ -2104,11 +2104,11 @@ main (int argc, char **argv, char **envp)
undefine_default_variables ();
}
-#ifdef WINDOWS32
+#if MK_OS_W32
/* look one last time after reading all Makefiles */
if (no_default_sh_exe)
no_default_sh_exe = !find_and_set_default_shell (NULL);
-#endif /* WINDOWS32 */
+#endif /* MK_OS_W32 */
#if defined (__MSDOS__) || defined (__EMX__) || MK_OS_VMS
/* We need to know what kind of shell we will be using. */
diff --git a/src/makeint.h b/src/makeint.h
index 14f58483..29a28f66 100644
--- a/src/makeint.h
+++ b/src/makeint.h
@@ -44,7 +44,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
Be sure to use the local one, and not one installed on the system.
Define GMK_BUILDING_MAKE for proper selection of dllexport/dllimport
declarations for MS-Windows. */
-#ifdef WINDOWS32
+#if MK_OS_W32
# define GMK_BUILDING_MAKE
#endif
#include "gnumake.h"
@@ -367,7 +367,7 @@ extern mode_t umask (mode_t);
# include <direct.h>
#endif
-#ifdef WINDOWS32
+#if MK_OS_W32
# include <fcntl.h>
# include <malloc.h>
# define pipe(_p) _pipe((_p), 512, O_BINARY)
@@ -400,7 +400,7 @@ extern int unixy_shell;
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
-#endif /* WINDOWS32 */
+#endif /* MK_OS_W32 */
/* ALL_SET() evaluates the second argument twice. */
#define ANY_SET(_v,_m) (((_v)&(_m)) != 0)
@@ -681,7 +681,7 @@ void dbg (const char *fmt, ...);
/* We omit these declarations on non-POSIX systems which define _POSIX_VERSION,
because such systems often declare them in header files anyway. */
-#if !defined (__GNU_LIBRARY__) && !defined (POSIX) && !defined (_POSIX_VERSION) && !defined(WINDOWS32)
+#if !defined (__GNU_LIBRARY__) && !defined (POSIX) && !defined (_POSIX_VERSION) && !MK_OS_W32
# if !MK_OS_VMS
long int lseek ();
diff --git a/src/misc.c b/src/misc.c
index f5bfee4c..cbd2cacf 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -23,7 +23,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#include <assert.h>
#include <stdarg.h>
-#ifdef WINDOWS32
+#if MK_OS_W32
# include <windows.h>
# include <io.h>
#endif
@@ -525,7 +525,7 @@ spin (const char* type)
{
fprintf (stderr, "SPIN on %s\n", filenm);
do
-#ifdef WINDOWS32
+#if MK_OS_W32
Sleep (1000);
#else
sleep (1);
@@ -585,7 +585,7 @@ get_tmpdir ()
if (!tmpdir)
{
-#if defined (__MSDOS__) || defined (WINDOWS32) || defined (__EMX__)
+#if defined (__MSDOS__) || MK_OS_W32 || defined (__EMX__)
# define TMP_EXTRAS "TMP", "TEMP",
#else
# define TMP_EXTRAS
diff --git a/src/mkcustom.h b/src/mkcustom.h
index 035c50b7..c7c3ff13 100644
--- a/src/mkcustom.h
+++ b/src/mkcustom.h
@@ -36,7 +36,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
# ifdef _AIX
#pragma alloca
# else
-# if !defined(__GNUC__) && !defined(WINDOWS32)
+# if !defined(__GNUC__) && !MK_OS_W32
# ifndef alloca /* predefined by HP cc +Olibcalls */
char *alloca ();
# endif
diff --git a/src/os.h b/src/os.h
index c12f6641..6e2a6961 100644
--- a/src/os.h
+++ b/src/os.h
@@ -151,7 +151,7 @@ void osync_release (void);
#endif /* NO_OUTPUT_SYNC */
/* Create a "bad" file descriptor for stdin when parallel jobs are run. */
-#if MK_OS_VMS || defined(WINDOWS32) || defined(__MSDOS__)
+#if MK_OS_VMS || MK_OS_W32 || defined(__MSDOS__)
# define get_bad_stdin() (-1)
#else
int get_bad_stdin (void);
diff --git a/src/output.c b/src/output.c
index 1ef3e607..eddabe03 100644
--- a/src/output.c
+++ b/src/output.c
@@ -34,11 +34,11 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
# include <sys/file.h>
#endif
-#ifdef WINDOWS32
+#if MK_OS_W32
# include <windows.h>
# include <io.h>
# include "sub_proc.h"
-#endif /* WINDOWS32 */
+#endif
struct output *output_context = NULL;
unsigned int stdio_traced = 0;
@@ -151,7 +151,7 @@ pump_from_tmp (int from, FILE *to)
{
static char buffer[8192];
-#ifdef WINDOWS32
+#if MK_OS_W32
int prev_mode;
/* "from" is opened by open_tmpfd, which does it in binary mode, so
@@ -178,7 +178,7 @@ pump_from_tmp (int from, FILE *to)
fflush (to);
}
-#ifdef WINDOWS32
+#if MK_OS_W32
/* Switch "to" back to its original mode, so that log messages by
Make have the same EOL format as without --output-sync. */
_setmode (fileno (to), prev_mode);
diff --git a/src/read.c b/src/read.c
index 0ac7becd..0a2dc53a 100644
--- a/src/read.c
+++ b/src/read.c
@@ -29,7 +29,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#include "hash.h"
-#ifdef WINDOWS32
+#if MK_OS_W32
# include <windows.h>
# include "sub_proc.h"
#elif MK_OS_VMS
@@ -98,7 +98,7 @@ static struct conditionals *conditionals = &toplevel_conditionals;
static const char *default_include_directories[] =
{
-#if defined(WINDOWS32) && !defined(INCLUDEDIR)
+#if MK_OS_W32 && !defined(INCLUDEDIR)
/* This completely up to the user when they install MSVC or other packages.
This is defined as a placeholder. */
# define INCLUDEDIR "."
@@ -228,11 +228,11 @@ read_all_makefiles (const char **makefiles)
/* TODO: Above is not always true, this needs more work */
{ "makefile.vms", "gnumakefile", "makefile", 0 };
#else
-#ifdef WINDOWS32
+#if MK_OS_W32
{ "GNUmakefile", "makefile", "Makefile", "makefile.mak", 0 };
-#else /* !MK_OS_VMS && !WINDOWS32 */
+#else /* !MK_OS_VMS && !MK_OS_W32 */
{ "GNUmakefile", "makefile", "Makefile", 0 };
-#endif /* !MK_OS_VMS && !WINDOWS32 */
+#endif /* !MK_OS_VMS && !MK_OS_W32 */
#endif /* MK_OS_VMS */
const char **p = default_makefiles;
while (*p != 0 && !file_exists_p (*p))
@@ -2673,7 +2673,7 @@ readline (struct ebuffer *ebuf)
/* We got a newline, so add one to the count of lines. */
++nlines;
-#if !defined(WINDOWS32) && !defined(__MSDOS__) && !defined(__EMX__)
+#if !MK_OS_W32 && !defined(__MSDOS__) && !defined(__EMX__)
/* Check to see if the line was really ended with CRLF; if so ignore
the CR. */
if ((p - start) > 1 && p[-2] == '\r')
@@ -3082,7 +3082,7 @@ tilde_expand (const char *name)
free (home_dir);
home_dir = getenv ("HOME");
}
-# if !defined(WINDOWS32)
+# if !MK_OS_W32
if (home_dir == 0 || home_dir[0] == '\0')
{
char *logname = getlogin ();
@@ -3094,7 +3094,7 @@ tilde_expand (const char *name)
home_dir = p->pw_dir;
}
}
-# endif /* !WINDOWS32 */
+# endif /* !MK_OS_W32 */
if (home_dir != 0)
{
char *new = xstrdup (concat (2, home_dir, name + 1));
@@ -3103,7 +3103,7 @@ tilde_expand (const char *name)
return new;
}
}
-# if !defined(WINDOWS32)
+# if !MK_OS_W32
else
{
struct passwd *pwent;
@@ -3122,7 +3122,7 @@ tilde_expand (const char *name)
else if (userend != 0)
*userend = '/';
}
-# endif /* !WINDOWS32 */
+# endif /* !MK_OS_W32 */
#endif /* !MK_OS_VMS */
return 0;
}
diff --git a/src/remake.c b/src/remake.c
index d0d6fab1..fb51811c 100644
--- a/src/remake.c
+++ b/src/remake.c
@@ -33,7 +33,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#if MK_OS_VMS
#include <starlet.h>
#endif
-#ifdef WINDOWS32
+#if MK_OS_W32
#include <windows.h>
#include <io.h>
#include <sys/stat.h>
@@ -1469,7 +1469,7 @@ f_mtime (struct file *file, int search)
FILE_TIMESTAMP adjusted_mtime = mtime;
-#if defined(WINDOWS32) || defined(__MSDOS__)
+#if MK_OS_W32 || defined(__MSDOS__)
/* Experimentation has shown that FAT filesystems can set file times
up to 3 seconds into the future! Play it safe. */
@@ -1547,14 +1547,14 @@ static FILE_TIMESTAMP
name_mtime (const char *name)
{
FILE_TIMESTAMP mtime;
-#if defined(WINDOWS32)
+#if MK_OS_W32
struct STAT st;
#else
struct stat st;
#endif
int e;
-#if defined(WINDOWS32)
+#if MK_OS_W32
{
char tem[MAX_PATH+1], *tstart, *tend;
const char *p = name + strlen (name);
@@ -1583,7 +1583,7 @@ name_mtime (const char *name)
tend = &tem[0];
}
-#if defined(WINDOWS32)
+#if MK_OS_W32
e = STAT (tem, &st);
#else
e = stat (tem, &st);
@@ -1691,7 +1691,7 @@ library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr)
{
"/lib",
"/usr/lib",
-#if defined(WINDOWS32) && !defined(LIBDIR)
+#if MK_OS_W32 && !defined(LIBDIR)
/*
* This is completely up to the user at product install time. Just define
* a placeholder.
diff --git a/src/variable.c b/src/variable.c
index f9243afb..b3569461 100644
--- a/src/variable.c
+++ b/src/variable.c
@@ -26,7 +26,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#include "variable.h"
#include "os.h"
#include "rule.h"
-#ifdef WINDOWS32
+#if MK_OS_W32
#include "pathstuff.h"
#endif
#include "hash.h"
@@ -971,7 +971,7 @@ define_automatic_variables (void)
/* Define the magic D and F variables in terms of
the automatic variables they are variations of. */
-#if defined(__MSDOS__) || defined(WINDOWS32)
+#if defined(__MSDOS__) || MK_OS_W32
/* For consistency, remove the trailing backslash as well as slash. */
define_variable_cname ("@D", "$(patsubst %/,%,$(patsubst %\\,%,$(dir $@)))",
o_automatic, 1);
@@ -987,7 +987,7 @@ define_automatic_variables (void)
o_automatic, 1);
define_variable_cname ("+D", "$(patsubst %/,%,$(patsubst %\\,%,$(dir $+)))",
o_automatic, 1);
-#else /* not __MSDOS__, not WINDOWS32 */
+#else /* not __MSDOS__, not MK_OS_W32 */
define_variable_cname ("@D", "$(patsubst %/,%,$(dir $@))", o_automatic, 1);
define_variable_cname ("%D", "$(patsubst %/,%,$(dir $%))", o_automatic, 1);
define_variable_cname ("*D", "$(patsubst %/,%,$(dir $*))", o_automatic, 1);
@@ -1210,7 +1210,7 @@ target_environment (struct file *file, int recursive)
}
}
-#ifdef WINDOWS32
+#if MK_OS_W32
if (streq (v->name, "Path") || streq (v->name, "PATH"))
{
if (!cp)
@@ -1523,7 +1523,7 @@ do_variable_definition (const floc *flocp, const char *varname,
}
else
#endif /* __MSDOS__ */
-#ifdef WINDOWS32
+#if MK_OS_W32
if ((origin == o_file || origin == o_override || origin == o_command)
&& streq (varname, "SHELL"))
{
@@ -2017,7 +2017,7 @@ print_target_variables (const struct file *file)
}
}
-#ifdef WINDOWS32
+#if MK_OS_W32
void
sync_Path_environment ()
{
@@ -2028,7 +2028,7 @@ sync_Path_environment ()
if (!path)
return;
- /* Convert the value of PATH into something WINDOWS32 world can grok.
+ /* Convert the value of PATH into something Windows32 world can grok.
Note: convert_Path_to_windows32 must see only the value of PATH,
and see it from its first character, to do its tricky job. */
convert_Path_to_windows32 (path + CSTRLEN ("PATH="), ';');
diff --git a/src/vpath.c b/src/vpath.c
index 0b9cd3d2..9bfd9420 100644
--- a/src/vpath.c
+++ b/src/vpath.c
@@ -17,7 +17,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"
#include "filedef.h"
#include "variable.h"
-#ifdef WINDOWS32
+#if MK_OS_W32
#include "pathstuff.h"
#endif
@@ -185,7 +185,7 @@ construct_vpath_list (char *pattern, char *dirpath)
return;
}
-#ifdef WINDOWS32
+#if MK_OS_W32
convert_vpath_to_windows32 (dirpath, ';');
#endif
diff --git a/src/w32/compat/dirent.c b/src/w32/compat/dirent.c
index 7e32e336..41bcba1a 100644
--- a/src/w32/compat/dirent.c
+++ b/src/w32/compat/dirent.c
@@ -96,7 +96,7 @@ closedir(DIR *pDir)
return;
}
- /* close the WINDOWS32 directory handle */
+ /* close the Windows32 directory handle */
if (pDir->dir_hDirHandle != INVALID_HANDLE_VALUE)
FindClose(pDir->dir_hDirHandle);
@@ -159,7 +159,7 @@ rewinddir(DIR* pDir)
return;
}
- /* close the WINDOWS32 directory handle */
+ /* close the Windows32 directory handle */
if (pDir->dir_hDirHandle != INVALID_HANDLE_VALUE)
if (!FindClose(pDir->dir_hDirHandle))
errno = EBADF;
diff --git a/src/w32/include/dirent.h b/src/w32/include/dirent.h
index 32e352ca..2ad285b6 100644
--- a/src/w32/include/dirent.h
+++ b/src/w32/include/dirent.h
@@ -60,7 +60,7 @@ enum
struct dirent
{
- ino_t d_ino; /* unused - no equivalent on WINDOWS32. */
+ ino_t d_ino; /* unused - no equivalent on Windows32. */
unsigned char d_type;
char d_name[NAME_MAX+1]; /* must come last due to dir.c assumptions. */
};
diff --git a/src/w32/pathstuff.c b/src/w32/pathstuff.c
index efde4540..e7e0afd6 100644
--- a/src/w32/pathstuff.c
+++ b/src/w32/pathstuff.c
@@ -196,7 +196,7 @@ convert_path_to_nutc(char *path)
p = ++etok;
continue;
} else if ((etok = strpbrk(etok+1, ":;")) == NULL)
- break; /* thing found was a WINDOWS32 pathname */
+ break; /* thing found was a Windows32 pathname */
/* save separator */
sep = *etok;