diff --git a/gl/lib/glob.c b/gl/lib/glob.c
index a5bcd8d7..61a208cd 100644
--- a/gl/lib/glob.c
+++ b/gl/lib/glob.c
@@ -416,14 +416,14 @@ glob (const char *pattern, int flags,
 
   /* 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
@@ -460,7 +460,7 @@ glob (const char *pattern, int flags,
     {
       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] == ':'))
 	{
@@ -494,7 +494,7 @@ glob (const char *pattern, int flags,
       ++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] != '/')
@@ -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__ || MK_OS_W32
+#if MK_OS_DOS || 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__ || MK_OS_W32
+#if MK_OS_DOS || MK_OS_W32
   else if (dirlen > 1)
     {
       if (dirname[dirlen - 1] == '/' && dirname[dirlen - 2] == ':')
diff --git a/src/commands.c b/src/commands.c
index 881d9f49..c7121788 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -483,7 +483,7 @@ volatile sig_atomic_t handling_fatal_signal = 0;
 void
 fatal_error_signal (int sig)
 {
-#ifdef __MSDOS__
+#if MK_OS_DOS
   extern int dos_status, dos_command_running;
 
   if (dos_command_running)
@@ -494,7 +494,7 @@ fatal_error_signal (int sig)
     }
   remove_intermediates (1);
   exit (EXIT_FAILURE);
-#else /* not __MSDOS__ */
+#else /* not MK_OS_DOS */
 #if MK_OS_W32
   extern HANDLE main_thread;
 
@@ -593,7 +593,7 @@ fatal_error_signal (int sig)
   if (kill (make_pid (), sig) < 0)
     pfatal_with_name ("kill");
 #endif /* not MK_OS_W32 */
-#endif /* not __MSDOS__  */
+#endif /* not MK_OS_DOS  */
 }
 
 /* Delete FILE unless it's precious or not actually a file (phony),
diff --git a/src/configh.dos b/src/configh.dos
index f49462ac..ae263d90 100644
--- a/src/configh.dos
+++ b/src/configh.dos
@@ -17,7 +17,7 @@ this program.  If not, see <https://www.gnu.org/licenses/>.  */
 
 #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.  */
diff --git a/src/default.c b/src/default.c
index c0972f23..f5cfe8a2 100644
--- a/src/default.c
+++ b/src/default.c
@@ -27,7 +27,7 @@ this program.  If not, see <https://www.gnu.org/licenses/>.  */
 
 /* 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
 
@@ -326,19 +326,19 @@ static const char *default_suffix_rules[] =
     ".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) $< > $@",
@@ -536,7 +536,7 @@ static const char *default_variables[] =
     "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",
@@ -660,7 +660,7 @@ static const char *default_variables[] =
     "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",
diff --git a/src/dir.c b/src/dir.c
index f3e5127b..991f2bd9 100644
--- a/src/dir.c
+++ b/src/dir.c
@@ -60,7 +60,7 @@ const char *vmsify (const char *name, int type);
 # define FAKE_DIR_ENTRY(dp) (dp->d_ino = 1)
 #endif /* POSIX */
 
-#ifdef __MSDOS__
+#if MK_OS_DOS
 #include <ctype.h>
 #include <fcntl.h>
 
@@ -108,7 +108,7 @@ dosify (const char *filename)
   *df = '\0';
   return dos_filename;
 }
-#endif /* __MSDOS__ */
+#endif /* MK_OS_DOS */
 
 #if MK_OS_W32
 #include "pathstuff.h"
@@ -645,7 +645,7 @@ dir_contents_file_exists_p (struct directory *dir,
     /* The directory could not be stat'd or opened.  */
     return 0;
 
-#ifdef __MSDOS__
+#if MK_OS_DOS
   filename = dosify (filename);
 #endif
 
@@ -1047,7 +1047,7 @@ file_impossible_p (const char *filename)
     /* 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
diff --git a/src/function.c b/src/function.c
index 3b6bc203..8b966484 100644
--- a/src/function.c
+++ b/src/function.c
@@ -1748,7 +1748,7 @@ windows32_openpipe (int *pipedes, int errfd, pid_t *pid_p, char **command_argv,
 #endif
 
 
-#ifdef __MSDOS__
+#if MK_OS_DOS
 FILE *
 msdos_openpipe (int* pipedes, int *pidp, char *text)
 {
@@ -1828,14 +1828,14 @@ func_shell_base (char *o, char **argv, int trim_newlines)
   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
@@ -1854,7 +1854,7 @@ func_shell_base (char *o, char **argv, int trim_newlines)
 #endif
       return o;
     }
-#endif /* !__MSDOS__ */
+#endif /* !MK_OS_DOS */
 
   /* Set up the output in case the shell writes something.  */
   output_start ();
@@ -1864,7 +1864,7 @@ func_shell_base (char *o, char **argv, int trim_newlines)
 
   child.environment = target_environment (NULL, 0);
 
-#if defined(__MSDOS__)
+#if MK_OS_DOS
   fpipe = msdos_openpipe (pipedes, &pid, argv[0]);
   if (pipedes[0] < 0)
     {
@@ -1919,7 +1919,7 @@ func_shell_base (char *o, char **argv, int trim_newlines)
 
     /* 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
@@ -1950,7 +1950,7 @@ func_shell_base (char *o, char **argv, int trim_newlines)
     buffer[i] = '\0';
 
     /* Close the read side of the pipe.  */
-#ifdef  __MSDOS__
+#if MK_OS_DOS
     if (fpipe)
       {
         int st = pclose (fpipe);
diff --git a/src/job.c b/src/job.c
index 459ae7e2..6a116044 100644
--- a/src/job.c
+++ b/src/job.c
@@ -37,7 +37,7 @@ int no_default_sh_exe = 1;
 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
@@ -75,13 +75,13 @@ int batch_mode_shell = 0;
 
 #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__
@@ -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 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)
@@ -724,7 +724,7 @@ reap_children (int block, int err)
       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
@@ -783,9 +783,9 @@ reap_children (int block, int err)
               /* 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;
@@ -794,7 +794,7 @@ reap_children (int block, int err)
             exit_code = -1;
           exit_sig = WIFSIGNALED (status) ? WTERMSIG (status) : 0;
           coredump = 0;
-#endif /* __MSDOS__ */
+#endif /* MK_OS_DOS */
 #if MK_OS_W32
           {
             HANDLE hPID;
@@ -1299,7 +1299,7 @@ start_job_command (struct child *child)
   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.  */
@@ -1353,7 +1353,7 @@ start_job_command (struct child *child)
 
 #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]))
@@ -1408,7 +1408,7 @@ start_job_command (struct child *child)
     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.  */
@@ -1457,8 +1457,8 @@ start_job_command (struct child *child)
 #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;
 
@@ -1513,7 +1513,7 @@ start_job_command (struct child *child)
     ++dead_children;
     child->pid = dos_pid++;
   }
-#endif /* __MSDOS__ */
+#endif /* MK_OS_DOS */
 #if MK_OS_W32
   {
       HANDLE hPID;
@@ -1558,7 +1558,7 @@ start_job_command (struct child *child)
         }
   }
 #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)
@@ -2017,7 +2017,7 @@ job_next_command (struct child *child)
 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;
@@ -2268,7 +2268,7 @@ child_execute_job (struct childbase *child, int good_stdin, char **argv)
   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.
@@ -2467,7 +2467,7 @@ child_execute_job (struct childbase *child, int good_stdin, char **argv)
 
   return pid;
 }
-#endif /* !__MSDOS__ && !MK_OS_VMS */
+#endif /* !MK_OS_DOS && !MK_OS_VMS */
 #endif /* !MK_OS_W32 */
 
 /* Replace the current process with one running the command in ARGV,
@@ -2684,7 +2684,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
                                  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
@@ -2856,7 +2856,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
   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);
@@ -2885,10 +2885,10 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
         }
 # 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)
@@ -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__) || MK_OS_W32
+#if MK_OS_DOS || defined (__EMX__) || MK_OS_W32
                   || !unixy_shell
 #endif
                   )
@@ -2978,7 +2978,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
       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;
@@ -3030,7 +3030,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
                    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))
@@ -3156,7 +3156,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
       free (new_argv);
     }
 
-#ifdef __MSDOS__
+#if MK_OS_DOS
   execute_by_shell = 1; /* actually, call 'system' if shell isn't unixy */
 #endif
 
@@ -3218,7 +3218,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
 
         /* 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)
@@ -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__) || MK_OS_W32
+#if MK_OS_DOS || defined (__EMX__) || MK_OS_W32
 # define PRESERVE_BSNL  unixy_shell
 #else
 # define PRESERVE_BSNL  1
@@ -3439,7 +3439,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
              || 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.  */
@@ -3584,7 +3584,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
           new_argv[3] = NULL;
         }
       }
-#elif defined(__MSDOS__)
+#elif MK_OS_DOS
     else
       {
         /* With MSDOS shells, we must construct the command line here
diff --git a/src/main.c b/src/main.c
index 6eb308b2..1d5651d4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1119,14 +1119,14 @@ find_and_set_default_shell (const char *token)
 }
 #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)
@@ -1222,7 +1222,7 @@ main (int argc, char **argv, char **envp)
   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
@@ -1271,7 +1271,7 @@ main (int argc, char **argv, char **envp)
   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.  */
@@ -1416,7 +1416,7 @@ main (int argc, char **argv, char **envp)
   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
@@ -1531,7 +1531,7 @@ main (int argc, char **argv, char **envp)
            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");
@@ -1694,7 +1694,7 @@ main (int argc, char **argv, char **envp)
       || 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;
@@ -1716,7 +1716,7 @@ main (int argc, char **argv, char **envp)
 # 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
@@ -1725,7 +1725,7 @@ main (int argc, char **argv, char **envp)
 #endif
       )
     argv[0] = xstrdup (concat (3, current_directory, "/", argv[0]));
-#endif /* !__MSDOS__ */
+#endif /* !MK_OS_DOS */
 #endif /* MK_OS_W32 */
 #endif
 
@@ -2110,7 +2110,7 @@ main (int argc, char **argv, char **envp)
     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);
@@ -2130,7 +2130,7 @@ main (int argc, char **argv, char **envp)
           default_shell = shell_path;
       }
   }
-#endif /* __MSDOS__ || __EMX__ */
+#endif /* MK_OS_DOS || __EMX__ */
 
   /* Final jobserver configuration.
 
@@ -2155,7 +2155,7 @@ main (int argc, char **argv, char **envp)
   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 */
diff --git a/src/misc.c b/src/misc.c
index cbd2cacf..3ab44b34 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -585,7 +585,7 @@ get_tmpdir ()
 
   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
diff --git a/src/os.h b/src/os.h
index 6e2a6961..cce9d34a 100644
--- a/src/os.h
+++ b/src/os.h
@@ -20,7 +20,7 @@ this program.  If not, see <https://www.gnu.org/licenses/>.  */
 #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)
@@ -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 || 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);
diff --git a/src/read.c b/src/read.c
index 0a2dc53a..f07cce15 100644
--- a/src/read.c
+++ b/src/read.c
@@ -1895,7 +1895,7 @@ check_specials (struct nameseq *files, int set_default)
           continue;
         }
 
-#if !defined (__MSDOS__) && !defined (__EMX__)
+#if !MK_OS_DOS && !defined (__EMX__)
       if (!one_shell && streq (nm, ".ONESHELL"))
         {
           one_shell = 1;
@@ -2673,7 +2673,7 @@ readline (struct ebuffer *ebuf)
       /* 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')
@@ -2952,7 +2952,7 @@ construct_include_path (const char **arg_dirs)
     for (cpp = arg_dirs; *cpp != 0; ++cpp)
       ++idx;
 
-#ifdef  __MSDOS__
+#if MK_OS_DOS
   /* Add one for $DJDIR.  */
   ++idx;
 #endif
@@ -3006,7 +3006,7 @@ construct_include_path (const char **arg_dirs)
   /* 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);
diff --git a/src/remake.c b/src/remake.c
index fb51811c..b8aaab93 100644
--- a/src/remake.c
+++ b/src/remake.c
@@ -1469,7 +1469,7 @@ f_mtime (struct file *file, int search)
 
       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.  */
 
diff --git a/src/variable.c b/src/variable.c
index b3569461..269d229b 100644
--- a/src/variable.c
+++ b/src/variable.c
@@ -871,7 +871,7 @@ define_automatic_variables (void)
   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.  */
   {
@@ -946,7 +946,7 @@ define_automatic_variables (void)
   /* 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
 
@@ -954,7 +954,7 @@ define_automatic_variables (void)
      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)
     {
@@ -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__) || 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);
@@ -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 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);
@@ -1442,7 +1442,7 @@ do_variable_definition (const floc *flocp, const char *varname,
 
   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,
@@ -1522,7 +1522,7 @@ do_variable_definition (const floc *flocp, const char *varname,
         }
     }
   else
-#endif /* __MSDOS__ */
+#endif /* MK_OS_DOS */
 #if MK_OS_W32
   if ((origin == o_file || origin == o_override || origin == o_command)
       && streq (varname, "SHELL"))
diff --git a/src/vpath.c b/src/vpath.c
index 9bfd9420..a9f3f827 100644
--- a/src/vpath.c
+++ b/src/vpath.c
@@ -231,7 +231,7 @@ construct_vpath_list (char *pattern, char *dirpath)
       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