/* Find the filename. */
filename = strrchr (pattern, '/');
-#if defined __MSDOS__ || MK_OS_W32
+#if MK_OS_DOS || 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__ || MK_OS_W32 */
+#endif /* MK_OS_DOS || 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__ || MK_OS_W32
+#if MK_OS_DOS || MK_OS_W32
if (*filename == ':'
|| (filename > pattern + 1 && filename[-1] == ':'))
{
++filename;
if (filename[0] == '\0'
-#if defined __MSDOS__ || MK_OS_W32
+#if MK_OS_DOS || MK_OS_W32
&& dirname[dirlen - 1] != ':'
&& (dirlen < 3 || dirname[dirlen - 2] != ':'
|| dirname[dirlen - 1] != '/')
{
size_t i;
size_t dirlen = strlen (dirname);
-#if defined __MSDOS__ || MK_OS_W32
+#if MK_OS_DOS || 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__ || MK_OS_W32
+#if MK_OS_DOS || MK_OS_W32
else if (dirlen > 1)
{
if (dirname[dirlen - 1] == '/' && dirname[dirlen - 2] == ':')
void
fatal_error_signal (int sig)
{
-#ifdef __MSDOS__
+#if MK_OS_DOS
extern int dos_status, dos_command_running;
if (dos_command_running)
}
remove_intermediates (1);
exit (EXIT_FAILURE);
-#else /* not __MSDOS__ */
+#else /* not MK_OS_DOS */
#if MK_OS_W32
extern HANDLE main_thread;
if (kill (make_pid (), sig) < 0)
pfatal_with_name ("kill");
#endif /* not MK_OS_W32 */
-#endif /* not __MSDOS__ */
+#endif /* not MK_OS_DOS */
}
\f
/* Delete FILE unless it's precious or not actually a file (phony),
#include "mkconfig.h"
-#define MK_DJGPP 1
+#define MK_OS_DOS 1
/* Include this header to make __DJGPP_MINOR__ available because DJGPP ports
of GCC 4.3.0 and later no longer do it automatically. */
/* Define GCC_IS_NATIVE if gcc is the native development environment on
your system (gcc/bison/flex vs cc/yacc/lex). */
-#if defined(__MSDOS__) || defined(__EMX__)
+#if MK_OS_DOS || defined(__EMX__)
# define GCC_IS_NATIVE
#endif
".c.ln",
"$(LINT.c) -C$* $<",
".y.ln",
-#ifndef __MSDOS__
- "$(YACC.y) $< \n $(LINT.c) -C$* y.tab.c \n $(RM) y.tab.c",
-#else
+#if MK_OS_DOS
"$(YACC.y) $< \n $(LINT.c) -C$* y_tab.c \n $(RM) y_tab.c",
+#else
+ "$(YACC.y) $< \n $(LINT.c) -C$* y.tab.c \n $(RM) y.tab.c",
#endif
".l.ln",
"@$(RM) $*.c\n $(LEX.l) $< > $*.c\n$(LINT.c) -i $*.c -o $@\n $(RM) $*.c",
".y.c",
-#ifndef __MSDOS__
- "$(YACC.y) $< \n mv -f y.tab.c $@",
-#else
+#if MK_OS_DOS
"$(YACC.y) $< \n mv -f y_tab.c $@",
+#else
+ "$(YACC.y) $< \n mv -f y.tab.c $@",
#endif
".l.c",
"@$(RM) $@ \n $(LEX.l) $< > $@",
"CXX", MAKE_CXX,
#else
# ifdef GCC_IS_NATIVE
-# ifdef __MSDOS__
+# ifdef MK_OS_DOS
"CXX", "gpp", /* g++ is an invalid name on MSDOS */
# else
"CXX", "gcc",
"SCCS_OUTPUT_OPTION", "-G$@",
#endif
-#if defined(__MSDOS__)
+#if MK_OS_DOS
".LIBPATTERNS", "lib%.a $(DJDIR)/lib/lib%.a",
#elif defined(__APPLE__)
".LIBPATTERNS", "lib%.dylib lib%.a",
# define FAKE_DIR_ENTRY(dp) (dp->d_ino = 1)
#endif /* POSIX */
\f
-#ifdef __MSDOS__
+#if MK_OS_DOS
#include <ctype.h>
#include <fcntl.h>
*df = '\0';
return dos_filename;
}
-#endif /* __MSDOS__ */
+#endif /* MK_OS_DOS */
#if MK_OS_W32
#include "pathstuff.h"
/* The directory could not be stat'd or opened. */
return 0;
-#ifdef __MSDOS__
+#if MK_OS_DOS
filename = dosify (filename);
#endif
/* There are no files entered for this directory. */
return 0;
-#ifdef __MSDOS__
+#if MK_OS_DOS
filename = dosify (filename);
#endif
#ifdef HAVE_CASE_INSENSITIVE_FS
#endif
-#ifdef __MSDOS__
+#if MK_OS_DOS
FILE *
msdos_openpipe (int* pipedes, int *pidp, char *text)
{
struct childbase child = {0};
char *batch_filename = NULL;
int errfd;
-#ifdef __MSDOS__
+#if MK_OS_DOS
FILE *fpipe;
#endif
char **command_argv = NULL;
int pipedes[2];
pid_t pid;
-#ifndef __MSDOS__
+#if !MK_OS_DOS
#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
#endif
return o;
}
-#endif /* !__MSDOS__ */
+#endif /* !MK_OS_DOS */
/* Set up the output in case the shell writes something. */
output_start ();
child.environment = target_environment (NULL, 0);
-#if defined(__MSDOS__)
+#if MK_OS_DOS
fpipe = msdos_openpipe (pipedes, &pid, argv[0]);
if (pipedes[0] < 0)
{
/* Record the PID for reap_children. */
shell_function_pid = pid;
-#ifndef __MSDOS__
+#if !MK_OS_DOS
shell_function_completed = 0;
/* Close the write side of the pipe. We test for -1, since
buffer[i] = '\0';
/* Close the read side of the pipe. */
-#ifdef __MSDOS__
+#if MK_OS_DOS
if (fpipe)
{
int st = pclose (fpipe);
int batch_mode_shell = 1;
HANDLE main_thread;
-#elif defined (__MSDOS__)
+#elif MK_OS_DOS
/* The default shell is a pointer so we can change it if Makefile
says so. It is without an explicit path so we get a chance
#endif
-#ifdef __MSDOS__
+#if MK_OS_DOS
# include <process.h>
static int execute_by_shell;
static int dos_pid = 123;
int dos_status;
int dos_command_running;
-#endif /* __MSDOS__ */
+#endif /* MK_OS_DOS */
#if MK_OS_VMS
# ifndef __GNUC__
/* this should be able to deal with extensions on Windows-like systems */
for (s = unix_shells; *s != NULL; ++s)
{
-#if MK_OS_W32 || defined(__MSDOS__)
+#if MK_OS_W32 || MK_OS_DOS
size_t len = strlen (*s);
if ((strlen (cp) >= len && STOP_SET (cp[len], MAP_DOT|MAP_NUL))
&& strncasecmp (cp, *s, len) == 0)
else
{
/* No remote children. Check for local children. */
-#if !defined(__MSDOS__) && !MK_OS_W32
+#if !MK_OS_DOS && !MK_OS_W32
if (any_local)
{
#if MK_OS_VMS
/* We got a remote child. */
remote = 1;
}
-#endif /* !__MSDOS__, !MK_OS_W32. */
+#endif /* !MK_OS_DOS, !MK_OS_W32. */
-#ifdef __MSDOS__
+#if MK_OS_DOS
/* Life is very different on MSDOS. */
pid = dos_pid - 1;
status = dos_status;
exit_code = -1;
exit_sig = WIFSIGNALED (status) ? WTERMSIG (status) : 0;
coredump = 0;
-#endif /* __MSDOS__ */
+#endif /* MK_OS_DOS */
#if MK_OS_W32
{
HANDLE hPID;
if (argv == 0)
{
next_command:
-#ifdef __MSDOS__
+#if MK_OS_DOS
execute_by_shell = 0; /* in case construct_command_argv sets it */
#endif
/* This line has no commands. Go to the next. */
#if !MK_OS_VMS
if (
-#if defined __MSDOS__ || defined (__EMX__)
+#if MK_OS_DOS || defined (__EMX__)
unixy_shell /* the test is complicated and we already did it */
#else
(argv[0] && is_bourne_compatible_shell (argv[0]))
child->environment = target_environment (child->file,
child->file->cmds->any_recurse);
-#if !defined(__MSDOS__) && !MK_OS_W32
+#if !MK_OS_DOS && !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 MK_OS_W32 */
-#ifdef __MSDOS__
+#else /* MK_OS_DOS or MK_OS_W32 */
+#if MK_OS_DOS
{
int proc_return;
++dead_children;
child->pid = dos_pid++;
}
-#endif /* __MSDOS__ */
+#endif /* MK_OS_DOS */
#if MK_OS_W32
{
HANDLE hPID;
}
}
#endif /* MK_OS_W32 */
-#endif /* __MSDOS__ or MK_OS_W32 */
+#endif /* MK_OS_DOS or MK_OS_W32 */
/* Bump the number of jobs started in this second. */
if (child->pid >= 0)
static int
load_too_high (void)
{
-#if defined(__MSDOS__) || MK_OS_VMS || defined(__riscos__)
+#if MK_OS_DOS || MK_OS_VMS || defined(__riscos__)
return 1;
#else
static double last_sec;
return pid;
}
-#elif !defined (__MSDOS__) && !MK_OS_VMS
+#elif !MK_OS_DOS && !MK_OS_VMS
/* POSIX:
Create a child process executing the command in ARGV.
return pid;
}
-#endif /* !__MSDOS__ && !MK_OS_VMS */
+#endif /* !MK_OS_DOS && !MK_OS_VMS */
#endif /* !MK_OS_W32 */
\f
/* Replace the current process with one running the command in ARGV,
const char *shellflags, const char *ifs,
int flags, char **batch_filename UNUSED)
{
-#ifdef __MSDOS__
+#if MK_OS_DOS
/* MSDOS supports both the stock DOS shell and ports of Unixy shells.
We call 'system' for anything that requires ''slow'' processing,
because DOS shells are too dumb. When $SHELL points to a real
if (slow_flag)
goto slow;
#else /* not MK_OS_W32 */
-#if defined (__MSDOS__) || defined (__EMX__)
+#if MK_OS_DOS || defined (__EMX__)
else if (strcasecmp (shell, default_shell))
{
extern int _is_unixy_shell (const char *_path);
}
# endif
}
-#else /* !__MSDOS__ */
+#else /* !MK_OS_DOS */
else if (strcmp (shell, default_shell))
goto slow;
-#endif /* !__MSDOS__ && !__EMX__ */
+#endif /* !MK_OS_DOS && !__EMX__ */
#endif /* not MK_OS_W32 */
if (ifs)
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__) || MK_OS_W32
+#if MK_OS_DOS || defined (__EMX__) || MK_OS_W32
|| !unixy_shell
#endif
)
else if (one_shell && *p == '\n')
/* In .ONESHELL mode \n is a separator like ; or && */
goto slow;
-#ifdef __MSDOS__
+#if MK_OS_DOS
else if (*p == '.' && p[1] == '.' && p[2] == '.' && p[3] != '.')
/* '...' is a wildcard in DJGPP. */
goto slow;
still leaves a small window for problems, but at least it
should work for the vast majority of naive users. */
-#ifdef __MSDOS__
+#if MK_OS_DOS
/* A dot is only special as part of the "..."
wildcard. */
if (strneq (p + 1, ".\\.\\.", 5))
free (new_argv);
}
-#ifdef __MSDOS__
+#if MK_OS_DOS
execute_by_shell = 1; /* actually, call 'system' if shell isn't unixy */
#endif
/* Remove and ignore interior prefix chars [@+-] because they're
meaningless given a single shell. */
-#if defined __MSDOS__ || defined (__EMX__)
+#if MK_OS_DOS || defined (__EMX__)
if (unixy_shell) /* the test is complicated and we already did it */
#else
if (is_bourne_compatible_shell (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__) || MK_OS_W32
+#if MK_OS_DOS || defined (__EMX__) || MK_OS_W32
# define PRESERVE_BSNL unixy_shell
#else
# define PRESERVE_BSNL 1
|| ISSPACE (*p)
|| strchr (sh_chars, *p) != 0))
*ap++ = '\\';
-#ifdef __MSDOS__
+#if MK_OS_DOS
else if (unixy_shell && strneq (p, "...", 3))
{
/* The case of '...' wildcard again. */
new_argv[3] = NULL;
}
}
-#elif defined(__MSDOS__)
+#elif MK_OS_DOS
else
{
/* With MSDOS shells, we must construct the command line here
}
#endif /* MK_OS_W32 */
-#ifdef __MSDOS__
+#if MK_OS_DOS
static void
msdos_return_to_initial_directory (void)
{
if (directory_before_chdir)
chdir (directory_before_chdir);
}
-#endif /* __MSDOS__ */
+#endif /* MK_OS_DOS */
static void
reset_jobserver (void)
verify_flag = 1;
#endif
-#if defined (__MSDOS__) && !defined (_POSIX_SOURCE)
+#if MK_OS_DOS && !defined (_POSIX_SOURCE)
/* Request the most powerful version of 'system', to
make up for the dumb default shell. */
__system_flags = (__system_redirect
FATAL_SIG (SIGINT);
FATAL_SIG (SIGTERM);
-#ifdef __MSDOS__
+#if MK_OS_DOS
/* Windows 9X delivers FP exceptions in child programs to their
parent! We don't want Make to die when a child divides by zero,
so we work around that lossage by catching SIGFPE. */
else
directory_before_chdir = xstrdup (current_directory);
-#ifdef __MSDOS__
+#if MK_OS_DOS
/* Make sure we will return to the initial directory, come what may. */
atexit (msdos_return_to_initial_directory);
#endif
value of SHELL given to subprocesses. */
if (streq (v->name, "SHELL"))
{
-#ifndef __MSDOS__
+#if !MK_OS_DOS
export = v_noexport;
#endif
shell_var.name = xstrdup ("SHELL");
|| strneq (argv[0], "//", 2))
argv[0] = xstrdup (w32ify (argv[0], 1));
#else /* MK_OS_W32 */
-#if defined (__MSDOS__) || defined (__EMX__)
+#if MK_OS_DOS || defined (__EMX__)
if (strchr (argv[0], '\\'))
{
char *p;
# endif
)
argv[0] = xstrdup (concat (3, current_directory, "/", argv[0]));
-#else /* !__MSDOS__ */
+#else /* !MK_OS_DOS */
if (current_directory[0] != '\0'
&& argv[0] != 0 && argv[0][0] != '/' && strchr (argv[0], '/') != 0
#ifdef HAVE_DOS_PATHS
#endif
)
argv[0] = xstrdup (concat (3, current_directory, "/", argv[0]));
-#endif /* !__MSDOS__ */
+#endif /* !MK_OS_DOS */
#endif /* MK_OS_W32 */
#endif
no_default_sh_exe = !find_and_set_default_shell (NULL);
#endif /* MK_OS_W32 */
-#if defined (__MSDOS__) || defined (__EMX__) || MK_OS_VMS
+#if MK_OS_DOS || defined (__EMX__) || MK_OS_VMS
/* We need to know what kind of shell we will be using. */
{
extern int _is_unixy_shell (const char *_path);
default_shell = shell_path;
}
}
-#endif /* __MSDOS__ || __EMX__ */
+#endif /* MK_OS_DOS || __EMX__ */
/* Final jobserver configuration.
else
job_slots = arg_job_slots;
-#if defined (__MSDOS__) || defined (__EMX__) || MK_OS_VMS
+#if MK_OS_DOS || defined (__EMX__) || MK_OS_VMS
if (job_slots != 1
# ifdef __EMX__
&& _osmode != OS2_MODE /* turn off -j if we are in DOS mode */
if (!tmpdir)
{
-#if defined (__MSDOS__) || MK_OS_W32 || defined (__EMX__)
+#if MK_OS_DOS || MK_OS_W32 || defined (__EMX__)
# define TMP_EXTRAS "TMP", "TEMP",
#else
# define TMP_EXTRAS
#define IO_STDOUT_OK 0x0008
#define IO_STDERR_OK 0x0010
-#if MK_OS_VMS || defined(__MSDOS__)
+#if MK_OS_VMS || MK_OS_DOS
# define check_io_state() (IO_STDIN_OK|IO_STDOUT_OK|IO_STDERR_OK)
# define fd_inherit(_i) (0)
# define fd_noinherit(_i) (0)
#endif /* NO_OUTPUT_SYNC */
/* Create a "bad" file descriptor for stdin when parallel jobs are run. */
-#if MK_OS_VMS || MK_OS_W32 || defined(__MSDOS__)
+#if MK_OS_VMS || MK_OS_W32 || MK_OS_DOS
# define get_bad_stdin() (-1)
#else
int get_bad_stdin (void);
continue;
}
-#if !defined (__MSDOS__) && !defined (__EMX__)
+#if !MK_OS_DOS && !defined (__EMX__)
if (!one_shell && streq (nm, ".ONESHELL"))
{
one_shell = 1;
/* We got a newline, so add one to the count of lines. */
++nlines;
-#if !MK_OS_W32 && !defined(__MSDOS__) && !defined(__EMX__)
+#if !MK_OS_W32 && !MK_OS_DOS && !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')
for (cpp = arg_dirs; *cpp != 0; ++cpp)
++idx;
-#ifdef __MSDOS__
+#if MK_OS_DOS
/* Add one for $DJDIR. */
++idx;
#endif
/* Now add the standard default dirs at the end. */
if (!disable)
{
-#ifdef __MSDOS__
+#if MK_OS_DOS
/* The environment variable $DJDIR holds the root of the DJGPP directory
tree; add ${DJDIR}/include. */
struct variable *djdir = lookup_variable ("DJDIR", 5);
FILE_TIMESTAMP adjusted_mtime = mtime;
-#if MK_OS_W32 || defined(__MSDOS__)
+#if MK_OS_W32 || MK_OS_DOS
/* Experimentation has shown that FAT filesystems can set file times
up to 3 seconds into the future! Play it safe. */
define_variable_cname ("MAKE_VERSION", buf, o_default, 0);
define_variable_cname ("MAKE_HOST", make_host, o_default, 0);
-#ifdef __MSDOS__
+#if MK_OS_DOS
/* Allow to specify a special shell just for Make,
and use $COMSPEC as the default $SHELL when appropriate. */
{
/* This won't override any definition, but it will provide one if there
isn't one there. */
v = define_variable_cname ("SHELL", default_shell, o_default, 0);
-#ifdef __MSDOS__
+#if MK_OS_DOS
v->export = v_export; /* Export always SHELL. */
#endif
environment variable on MSDOS, so whoever sets it, does that on purpose.
On OS/2 we do not use SHELL from environment but we have already handled
that problem above. */
-#if !defined(__MSDOS__) && !defined(__EMX__)
+#if !MK_OS_DOS && !defined(__EMX__)
/* Don't let SHELL come from the environment. */
if (*v->value == '\0' || v->origin == o_env || v->origin == o_env_override)
{
/* Define the magic D and F variables in terms of
the automatic variables they are variations of. */
-#if defined(__MSDOS__) || MK_OS_W32
+#if MK_OS_DOS || 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 MK_OS_W32 */
+#else /* not MK_OS_DOS, 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);
assert (newval);
-#ifdef __MSDOS__
+#if MK_OS_DOS
/* Many Unix Makefiles include a line saying "SHELL=/bin/sh", but
non-Unix systems don't conform to this default configuration (in
fact, most of them don't even have '/bin'). On the other hand,
}
}
else
-#endif /* __MSDOS__ */
+#endif /* MK_OS_DOS */
#if MK_OS_W32
if ((origin == o_file || origin == o_override || origin == o_command)
&& streq (varname, "SHELL"))
len = p - v;
/* Make sure there's no trailing slash,
but still allow "/" as a directory. */
-#if defined(__MSDOS__) || defined(__EMX__) || defined(HAVE_DOS_PATHS)
+#if MK_OS_DOS || defined(__EMX__) || defined(HAVE_DOS_PATHS)
/* We need also to leave alone a trailing slash in "d:/". */
if (len > 3 || (len > 1 && v[1] != ':'))
#endif