* 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.
[*-*-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.])
])
# endif
#endif
-#if !defined _AMIGA && !MK_OS_VMS && !defined WINDOWS32
+#if !defined _AMIGA && !MK_OS_VMS && !MK_OS_W32
# include <pwd.h>
#endif
#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
# 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. */
/* 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
{
char *newp;
dirlen = filename - pattern;
-#if defined __MSDOS__ || defined WINDOWS32
+#if defined __MSDOS__ || MK_OS_W32
if (*filename == ':'
|| (filename > pattern + 1 && filename[-1] == ':'))
{
++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] != '/')
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
home_dir = "~"; /* No luck. */
}
# endif /* MK_OS_VMS */
-# endif /* WINDOWS32 */
+# endif /* MK_OS_W32 */
# endif
/* Now construct the full directory. */
if (dirname[1] == '\0')
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, '/');
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. */
{
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
/* 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] == ':')
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
# define __AR_BIG__
#endif
-#ifndef WINDOWS32
+#if !MK_OS_W32
# if !defined (__ANDROID__) && !defined (__BEOS__) && !defined(MK_OS_ZOS)
# include <ar.h>
# else
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))
#include "variable.h"
#include "job.h"
#include "commands.h"
-#ifdef WINDOWS32
+#if MK_OS_W32
#include <windows.h>
#include "w32err.h"
#endif
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
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
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__ */
}
\f
#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. */
".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",
# 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
}
#endif /* __MSDOS__ */
-#ifdef WINDOWS32
+#if MK_OS_W32
#include "pathstuff.h"
#endif
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
# 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. */
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;
# else
hash = ((unsigned int) key->dev << 4) ^ (unsigned int) key->ino;
# endif
-#endif /* WINDOWS32 */
+#endif /* MK_OS_W32 */
return hash;
}
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;
# else
hash = ((unsigned int) key->dev << 4) ^ (unsigned int) ~key->ino;
# endif
-#endif /* WINDOWS32 */
+#endif /* MK_OS_W32 */
return hash;
}
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;
if (result)
return result;
# endif
-#endif /* WINDOWS32 */
+#endif /* MK_OS_W32 */
return MAKECMP(x->dev, y->dev);
}
struct stat st;
int r;
-#ifdef WINDOWS32
+#if MK_OS_W32
char *w32_path;
#endif
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);
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
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;
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),
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);
}
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
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
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.
unsigned int impossible;
struct directory **dir_slot;
struct directory **dir_end;
-#ifdef WINDOWS32
+#if MK_OS_W32
char buf[INTSTR_LENGTH + 1];
#endif
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));
++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));
* 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);
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
#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);
# endif
# endif
# define local_lstat lstat
-#elif defined(WINDOWS32)
+#elif MK_OS_W32
/* Windows doesn't support lstat(). */
# define local_lstat local_stat
#else
define_variable_cname (".SHELLSTATUS", buf, o_override, 0);
}
-#ifdef WINDOWS32
+#if MK_OS_W32
/*untested*/
#include <windows.h>
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. */
&batch_filename);
if (command_argv == 0)
{
-#ifdef WINDOWS32
+#if MK_OS_W32
just_print_flag = j_p_f;
#endif
return o;
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;
#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
#include "shuffle.h"
/* Default shell to use. */
-#ifdef WINDOWS32
+#if MK_OS_W32
# include <windows.h>
const char *default_shell = "sh.exe";
static void vmsWaitForChildren (int *);
#endif
-#ifdef WINDOWS32
+#if MK_OS_W32
# include <windows.h>
# include <io.h>
# include <process.h>
# include "w32err.h"
# include "pathstuff.h"
# define WAIT_NOHANG 1
-#endif /* WINDOWS32 */
+#endif /* MK_OS_W32 */
#ifdef __EMX__
# include <process.h>
#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 ();
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);
unsigned int jobserver_tokens = 0;
\f
-#ifdef WINDOWS32
+#if MK_OS_W32
/*
* The macro which references this function is defined in makeint.h.
*/
/* not reached */
return NULL;
}
-#endif /* WINDOWS32 */
+#endif /* MK_OS_W32 */
#ifdef __EMX__
/* returns whether path is assumed to be a unix like shell. */
/* 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)
void
reap_children (int block, int err)
{
-#ifndef WINDOWS32
+#if !MK_OS_W32
WAIT_T status;
#endif
/* Initially, assume we have some. */
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
/* We got a remote child. */
remote = 1;
}
-#endif /* !__MSDOS__, !WINDOWS32. */
+#endif /* !__MSDOS__, !MK_OS_W32. */
#ifdef __MSDOS__
/* Life is very different on MSDOS. */
exit_sig = WIFSIGNALED (status) ? WTERMSIG (status) : 0;
coredump = 0;
#endif /* __MSDOS__ */
-#ifdef WINDOWS32
+#if MK_OS_W32
{
HANDLE hPID;
HANDLE hcTID, hcPID;
pid = (pid_t) hPID;
}
-#endif /* WINDOWS32 */
+#endif /* MK_OS_W32 */
}
/* Some child finished: increment the command count. */
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. */
#endif /* !MK_OS_VMS */
}
-#else /* __MSDOS__ or WINDOWS32 */
+#else /* __MSDOS__ or MK_OS_W32 */
#ifdef __MSDOS__
{
int proc_return;
child->pid = dos_pid++;
}
#endif /* __MSDOS__ */
-#ifdef WINDOWS32
+#if MK_OS_W32
{
HANDLE hPID;
char* arg0;
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)
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
))
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;
return;
}
\f
-#ifndef WINDOWS32
+#if !MK_OS_W32
/* EMX: Start a child process. This function returns the new pid. */
# if defined __EMX__
return pid;
}
#endif /* !__MSDOS__ && !MK_OS_VMS */
-#endif /* !WINDOWS32 */
+#endif /* !MK_OS_W32 */
\f
/* Replace the current process with one running the command in ARGV,
with environment ENVP. This function does not return. */
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;
/* Use the child's exit code as our exit code */
exit (exit_code);
-#else /* !WINDOWS32 */
+#else /* !MK_OS_W32 */
pid_t pid = -1;
}
return pid;
-#endif /* !WINDOWS32 */
+#endif /* !MK_OS_W32 */
#endif /* !MK_OS_VMS */
}
\f
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
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
# 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 = "#;\"*?[]&|<>(){}$`^~!";
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)
sh_cmds = sh_cmds_sh;
sh_chars = sh_chars_sh;
}
-#endif /* WINDOWS32 */
+#endif /* MK_OS_W32 */
if (restp != NULL)
*restp = NULL;
/* 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);
}
if (slow_flag)
goto slow;
-#else /* not WINDOWS32 */
+#else /* not MK_OS_W32 */
#if defined (__MSDOS__) || defined (__EMX__)
else if (strcasecmp (shell, default_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)
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
)
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)
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)
{
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)
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
*
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
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
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
}
*t = '\0';
}
-#ifdef WINDOWS32
+#if MK_OS_W32
else /* non-Posix shell (cmd.exe etc.) */
{
const char *f = line;
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;
ap = mempcpy (ap, shellflags, sflags_len);
*(ap++) = ' ';
}
-#ifdef WINDOWS32
+#if MK_OS_W32
command_ptr = ap;
#endif
for (p = line; *p != '\0'; ++p)
/* 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
}
*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. */
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,
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.
#include "shuffle.h"
#include <assert.h>
-#ifdef WINDOWS32
+#if MK_OS_W32
# include <windows.h>
# include <io.h>
# include "pathstuff.h"
die (bad ? MAKE_FAILURE : MAKE_SUCCESS);
}
-#ifdef WINDOWS32
+#if MK_OS_W32
/*
* HANDLE runtime exceptions by avoiding a requestor on the GUI. Capture
return (sh_found);
}
-#endif /* WINDOWS32 */
+#endif /* MK_OS_W32 */
#ifdef __MSDOS__
static void
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;
/* 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)
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))
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
*/
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
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], '\\'))
{
)
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. */
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;
}
}
-#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.
* 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)
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. */
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"
# include <direct.h>
#endif
-#ifdef WINDOWS32
+#if MK_OS_W32
# include <fcntl.h>
# include <malloc.h>
# define pipe(_p) _pipe((_p), 512, O_BINARY)
# 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)
/* 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 ();
#include <assert.h>
#include <stdarg.h>
-#ifdef WINDOWS32
+#if MK_OS_W32
# include <windows.h>
# include <io.h>
#endif
{
fprintf (stderr, "SPIN on %s\n", filenm);
do
-#ifdef WINDOWS32
+#if MK_OS_W32
Sleep (1000);
#else
sleep (1);
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
# 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
#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);
# 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;
{
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
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);
#include "hash.h"
-#ifdef WINDOWS32
+#if MK_OS_W32
# include <windows.h>
# include "sub_proc.h"
#elif MK_OS_VMS
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 "."
/* 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))
/* 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')
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 ();
home_dir = p->pw_dir;
}
}
-# endif /* !WINDOWS32 */
+# endif /* !MK_OS_W32 */
if (home_dir != 0)
{
char *new = xstrdup (concat (2, home_dir, name + 1));
return new;
}
}
-# if !defined(WINDOWS32)
+# if !MK_OS_W32
else
{
struct passwd *pwent;
else if (userend != 0)
*userend = '/';
}
-# endif /* !WINDOWS32 */
+# endif /* !MK_OS_W32 */
#endif /* !MK_OS_VMS */
return 0;
}
#if MK_OS_VMS
#include <starlet.h>
#endif
-#ifdef WINDOWS32
+#if MK_OS_W32
#include <windows.h>
#include <io.h>
#include <sys/stat.h>
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. */
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);
tend = &tem[0];
}
-#if defined(WINDOWS32)
+#if MK_OS_W32
e = STAT (tem, &st);
#else
e = stat (tem, &st);
{
"/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.
#include "variable.h"
#include "os.h"
#include "rule.h"
-#ifdef WINDOWS32
+#if MK_OS_W32
#include "pathstuff.h"
#endif
#include "hash.h"
/* 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);
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);
}
}
-#ifdef WINDOWS32
+#if MK_OS_W32
if (streq (v->name, "Path") || streq (v->name, "PATH"))
{
if (!cp)
}
else
#endif /* __MSDOS__ */
-#ifdef WINDOWS32
+#if MK_OS_W32
if ((origin == o_file || origin == o_override || origin == o_command)
&& streq (varname, "SHELL"))
{
}
}
-#ifdef WINDOWS32
+#if MK_OS_W32
void
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="), ';');
#include "makeint.h"
#include "filedef.h"
#include "variable.h"
-#ifdef WINDOWS32
+#if MK_OS_W32
#include "pathstuff.h"
#endif
return;
}
-#ifdef WINDOWS32
+#if MK_OS_W32
convert_vpath_to_windows32 (dirpath, ';');
#endif
return;
}
- /* close the WINDOWS32 directory handle */
+ /* close the Windows32 directory handle */
if (pDir->dir_hDirHandle != INVALID_HANDLE_VALUE)
FindClose(pDir->dir_hDirHandle);
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;
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. */
};
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;