diff -ru make-3.79.1/Makefile.in make-3.79.1-patched/Makefile.in
--- make-3.79.1/Makefile.in	Fri Jun 23 18:35:23 2000
+++ make-3.79.1-patched/Makefile.in	Thu Jan 24 01:33:46 2002
@@ -30,6 +30,7 @@
 localstatedir = @localstatedir@
 libdir = @libdir@
 infodir = @infodir@
+htmldir = $(prefix)/share/html/make
 mandir = @mandir@
 includedir = @includedir@
 oldincludedir = /usr/include
@@ -87,7 +88,7 @@
 bin_PROGRAMS = make
 
 # These source files also have gettext references
-SRCS = ar.c arscan.c commands.c dir.c expand.c file.c function.c 		getopt.c implicit.c job.c main.c misc.c read.c remake.c 		rule.c signame.c variable.c vpath.c
+SRCS = ar.c arscan.c commands.c dir.c expand.c file.c function.c 		getopt.c implicit.c job.c main.c misc.c read.c remake.c 		rule.c signame.c variable.c vpath.c next.c
 
 
 make_SOURCES = $(SRCS) default.c remote-$(REMOTE).c version.c 		getopt1.c
@@ -155,7 +156,7 @@
 make_OBJECTS =  ar.o arscan.o commands.o dir.o expand.o file.o \
 function.o getopt.o implicit.o job.o main.o misc.o read.o remake.o \
 rule.o signame.o variable.o vpath.o default.o remote-$(REMOTE).o \
-version.o getopt1.o
+version.o getopt1.o next.o
 make_DEPENDENCIES =  @LIBOBJS@ @ALLOCA@
 make_LDFLAGS = 
 CFLAGS = @CFLAGS@
@@ -163,8 +164,10 @@
 CCLD = $(CC)
 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
 TEXI2DVI = texi2dvi
+TEXI2HTML = texi2html
 INFO_DEPS = make.info
 DVIS = make.dvi
+HTML = make.html
 TEXINFOS = make.texinfo
 man1dir = $(mandir)/man1
 MANS = $(man_MANS)
@@ -186,7 +189,8 @@
 SOURCES = $(make_SOURCES)
 OBJECTS = $(make_OBJECTS)
 
-all: all-redirect
+all: all-recursive-am all-am
+
 .SUFFIXES:
 .SUFFIXES: .S .c .dvi .info .o .ps .s .texi .texinfo .txi
 $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
@@ -284,6 +288,7 @@
 
 make.info: make.texinfo
 make.dvi: make.texinfo
+make.html: make.texinfo
 
 
 DVIPS = dvips
@@ -316,6 +321,10 @@
 	TEXINPUTS=.:$$TEXINPUTS \
 	  MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
 
+.texinfo.html:
+	TEXINPUTS=$(srcdir):$$TEXINPUTS \
+	  MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2HTML) -split_chapter $<
+
 .txi.info:
 	@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
 	cd $(srcdir) \
@@ -332,6 +341,13 @@
 .dvi.ps:
 	$(DVIPS) $< -o $@
 
+install-html:
+	TEXINPUTS=$(srcdir):$$TEXINPUTS \
+	  MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2HTML) -split_chapter $(srcdir)/make.texinfo
+	@$(NORMAL_INSTALL)
+	$(mkinstalldirs) $(DESTDIR)$(htmldir)
+	$(INSTALL_DATA) *.html $(DESTDIR)$(htmldir)
+
 install-info-am: $(INFO_DEPS)
 	@$(NORMAL_INSTALL)
 	$(mkinstalldirs) $(DESTDIR)$(infodir)
@@ -625,6 +641,7 @@
 	commands.h variable.h rule.h
 version.o: version.c config.h
 vpath.o: vpath.c make.h config.h gettext.h filedef.h variable.h
+next.o: make.h filedef.h variable.h dep.h commands.h
 
 info-am: $(INFO_DEPS)
 info: info-recursive
@@ -638,10 +655,12 @@
 all-recursive-am: config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-recursive
 
+all-am: Makefile $(INFO_DEPS) $(PROGRAMS) $(MANS) config.h
+
 install-exec-am: install-binPROGRAMS install-exec-local
 install-exec: install-exec-recursive
 
-install-data-am: install-info-am install-man
+install-data-am: install-html install-man
 install-data: install-data-recursive
 
 install-am: all-am
@@ -721,9 +740,9 @@
 maintainer-clean-generic clean mostlyclean distclean maintainer-clean
 
 
-all-local: $(srcdir)/stamp-pot
+all-local: stamp-pot
 
-$(srcdir)/stamp-pot: $(POTFILES)
+stamp-pot: $(POTFILES)
 	@echo "$(POTFILES)" > $@
 
 install-exec-local:
diff -ru make-3.79.1/default.c make-3.79.1-patched/default.c
--- make-3.79.1/default.c	Mon Mar 27 05:51:27 2000
+++ make-3.79.1-patched/default.c	Thu Jan 24 01:33:46 2002
@@ -42,7 +42,7 @@
 .s .ss .i .ii .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
 .w .ch .cweb .web .com .sh .elc .el";
 #else
-  = ".out .a .ln .o .c .cc .C .cpp .p .f .F .r .y .l .s .S \
+  = ".out .a .ln .o .c .cc .C .cpp .p .f .F .m .r .y .l .ym .lm .s .S \
 .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
 .w .ch .web .sh .elc .el";
 #endif
@@ -187,6 +187,8 @@
     "$(LINK.cpp) $^ $(LOADLIBES) $(LDLIBS) -o $@",
     ".f",
     "$(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@",
+    ".m",
+    "$(LINK.m) $^ $(LOADLIBES) $(LDLIBS) -o $@",
     ".p",
     "$(LINK.p) $^ $(LOADLIBES) $(LDLIBS) -o $@",
     ".F",
@@ -216,6 +218,8 @@
     "$(COMPILE.cpp) $(OUTPUT_OPTION) $<",
     ".f.o",
     "$(COMPILE.f) $(OUTPUT_OPTION) $<",
+    ".m.o",
+    "$(COMPILE.m) $(OUTPUT_OPTION) $<",
     ".p.o",
     "$(COMPILE.p) $(OUTPUT_OPTION) $<",
     ".F.o",
@@ -245,6 +249,11 @@
     ".l.c",
     "@$(RM) $@ \n $(LEX.l) $< > $@",
 
+    ".ym.m",
+    "$(YACC.m) $< \n mv -f y.tab.c $@",
+    ".lm.m",
+    "@$(RM) $@ \n $(LEX.m) $< > $@",
+
     ".F.f",
     "$(PREPROCESS.F) $(OUTPUT_OPTION) $<",
     ".r.f",
@@ -299,6 +308,14 @@
 
 static char *default_variables[] =
   {
+#if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO)
+    "GNUMAKE", "YES",	/* I'm not sure who uses this.  Dave Payne 8/10/99 */
+#if NeXT_PDO
+    "MAKEFILEPATH", "$(NEXT_ROOT)/Developer/Makefiles",
+#else
+    "MAKEFILEPATH", "$(NEXT_ROOT)/Developer/Makefiles",
+#endif /* NeXT_PDO */
+#endif /* __APPLE__ || NeXT || NeXT_PDO */
 #ifdef VMS
 #ifdef __ALPHA
     "ARCH", "ALPHA",
@@ -459,6 +476,8 @@
     "LINK.o", "$(CC) $(LDFLAGS) $(TARGET_ARCH)",
     "COMPILE.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
     "LINK.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
+    "COMPILE.m", "$(COMPILE.c)",
+    "LINK.m", "$(LINK.c)",
     "COMPILE.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
     "COMPILE.C", "$(COMPILE.cc)",
     "COMPILE.cpp", "$(COMPILE.cc)",
@@ -467,6 +486,8 @@
     "LINK.cpp", "$(LINK.cc)",
     "YACC.y", "$(YACC) $(YFLAGS)",
     "LEX.l", "$(LEX) $(LFLAGS) -t",
+    "YACC.m", "$(YACC) $(YFLAGS)",
+    "LEX.m", "$(LEX) $(LFLAGS) -t",
     "COMPILE.f", "$(FC) $(FFLAGS) $(TARGET_ARCH) -c",
     "LINK.f", "$(FC) $(FFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
     "COMPILE.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
diff -ru make-3.79.1/expand.c make-3.79.1-patched/expand.c
--- make-3.79.1/expand.c	Mon Jun 19 22:23:57 2000
+++ make-3.79.1-patched/expand.c	Thu Jan 24 01:33:46 2002
@@ -75,7 +75,11 @@
 
 /* Return a pointer to the beginning of the variable buffer.  */
 
+#if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO) /* for NEXT_VPATH_FLAG support */
+char *
+#else
 static char *
+#endif
 initialize_variable_output ()
 {
   /* If we don't have a variable output buffer yet, get one.  */
@@ -89,6 +93,40 @@
 
   return variable_buffer;
 }
+
+#if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO) /* for NEXT_VPATH_FLAG support */
+
+char *
+save_variable_output(savelenp)
+    int *savelenp;
+{
+  char *save;
+
+  save = variable_buffer;
+  *savelenp = variable_buffer_length;
+  
+  variable_buffer = 0;
+  variable_buffer_length = 0;
+
+  return (save);
+}
+
+		     
+void
+restore_variable_output (save, savelen)
+    char *save;
+    int savelen;
+{
+
+  if (variable_buffer != 0)
+    free (variable_buffer);
+
+  variable_buffer = save;
+  variable_buffer_length = savelen;
+
+}
+
+#endif /* __APPLE__ || NeXT || NeXT_PDO */
 
 /* Recursively expand V.  The returned string is malloc'd.  */
 
diff -ru make-3.79.1/file.c make-3.79.1-patched/file.c
--- make-3.79.1/file.c	Tue Jun 20 16:00:16 2000
+++ make-3.79.1-patched/file.c	Thu Jan 24 01:33:46 2002
@@ -217,6 +217,9 @@
   rehash_file(file, name);
   while (file)
     {
+#if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO) /* for NEXT_VPATH_FLAG support */
+      file->old_name = file->name;
+#endif  /* __APPLE__ || NeXT || NeXT_PDO */
       file->name = file->hname;
       file = file->prev;
     }
diff -ru make-3.79.1/filedef.h make-3.79.1-patched/filedef.h
--- make-3.79.1/filedef.h	Tue Jun 20 16:00:16 2000
+++ make-3.79.1-patched/filedef.h	Thu Jan 24 01:33:46 2002
@@ -41,6 +41,9 @@
 				   used when there are multiple double-colon
 				   entries for the same file.  */
 
+#if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO) /* for NEXT_VPATH_FLAG support */
+    char *old_name;
+#endif
     /* File that this file was renamed to.  After any time that a
        file could be renamed, call `check_renamed' (below).  */
     struct file *renamed;
diff -ru make-3.79.1/implicit.c make-3.79.1-patched/implicit.c
--- make-3.79.1/implicit.c	Tue Jun 20 16:00:16 2000
+++ make-3.79.1-patched/implicit.c	Thu Jan 24 01:33:47 2002
@@ -494,8 +494,24 @@
 
   /* RULE is nil if the loop went all the way
      through the list and everything failed.  */
+#if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO) /* for NEXT_VPATH_FLAG support */
+  if (rule == 0) {
+      if ((next_flag & NEXT_VPATH_FLAG) && file->old_name != 0) {
+	  int v;
+	  char *save_name = file->name;
+	  file->name = file->old_name;
+	  file->old_name = 0;
+	  v = pattern_search(file, archive, depth, recursions);
+	  file->old_name = file->name;
+	  file->name = save_name;
+	  return v;
+      }
+      return 0;
+  }
+#else
   if (rule == 0)
     return 0;
+#endif	/* __APPLE__ || NeXT || NeXT_PDO */
 
   foundrule = i;
 
diff -ru make-3.79.1/job.c make-3.79.1-patched/job.c
--- make-3.79.1/job.c	Fri Jun 23 17:54:56 2000
+++ make-3.79.1-patched/job.c	Thu Jan 24 01:33:47 2002
@@ -994,8 +994,16 @@
 #else
       (argv[0] && !strcmp (argv[0], "/bin/sh"))
 #endif
+#if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO)
+      /* allow either -ec or -c */
+      && ((argv[1]
+	   && argv[1][0] == '-' && argv[1][1] == 'c' && argv[1][2] == '\0') ||
+          (argv[1]
+	   && argv[1][0] == '-' && argv[1][1] == 'e' && argv[1][2] == 'c' && argv[1][3] == '\0'))
+#else
       && (argv[1]
           && argv[1][0] == '-' && argv[1][1] == 'c' && argv[1][2] == '\0')
+#endif __APPLE__ || NeXT || NeXT_PDO
       && (argv[2] && argv[2][0] == ':' && argv[2][1] == '\0')
       && argv[3] == NULL)
     {
@@ -1447,6 +1455,19 @@
 						     file);
     }
 
+#if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO) /* for NEXT_VPATH_FLAG support */
+  if (next_flag & NEXT_VPATH_FLAG) {
+      for (i = 0; i < cmds->ncommand_lines; ++i) {
+	  char *line;
+	  if (lines[i] != 0) {
+	      line = allocated_vpath_expand_for_file (lines[i], file);
+	      free (lines[i]);
+	      lines[i] = line;
+	  }
+      }
+  }
+#endif	/* __APPLE__ || NeXT || NeXT_PDO */
+
   /* Start the command sequence, record it in a new
      `struct child', and add that to the chain.  */
 
@@ -2790,22 +2811,39 @@
        argument list.  */
 
     unsigned int shell_len = strlen (shell);
+    unsigned int line_len = strlen (line);
+    char *new_line;
+    char *command_ptr = NULL; /* used for batch_mode_shell mode */
+
+#if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO)
+    char *minus_c;
+    int minus_c_len;
+
+    if (next_flag & NEXT_ERREXIT_FLAG) {
+      minus_c = " -ec ";
+      minus_c_len = 5;
+    } else {
+      minus_c = " -c ";
+      minus_c_len = 4;
+    }
+#else
 #ifndef VMS
     static char minus_c[] = " -c ";
+    int minus_c_len = 4;
 #else
     static char minus_c[] = "";
+    int minus_c_len = 0;
 #endif
-    unsigned int line_len = strlen (line);
+#endif /* __APPLE__ || NeXT || NeXT_PDO */
 
-    char *new_line = (char *) alloca (shell_len + (sizeof (minus_c) - 1)
-				      + (line_len * 2) + 1);
-    char *command_ptr = NULL; /* used for batch_mode_shell mode */
+    new_line = (char *) alloca (shell_len + minus_c_len
+				+ (line_len * 2) + 1);
 
     ap = new_line;
     bcopy (shell, ap, shell_len);
     ap += shell_len;
-    bcopy (minus_c, ap, sizeof (minus_c) - 1);
-    ap += sizeof (minus_c) - 1;
+    bcopy (minus_c, ap, minus_c_len);
+    ap += minus_c_len;
     command_ptr = ap;
     for (p = line; *p != '\0'; ++p)
       {
@@ -2853,7 +2891,7 @@
 #endif
 	*ap++ = *p;
       }
-    if (ap == new_line + shell_len + sizeof (minus_c) - 1)
+    if (ap == new_line + shell_len + minus_c_len)
       /* Line was empty.  */
       return 0;
     *ap = '\0';
@@ -2921,10 +2959,10 @@
          instead of recursively calling ourselves, because we
          cannot backslash-escape the special characters (see above).  */
       new_argv = (char **) xmalloc (sizeof (char *));
-      line_len = strlen (new_line) - shell_len - sizeof (minus_c) + 1;
+      line_len = strlen (new_line) - shell_len - minus_c_len;
       new_argv[0] = xmalloc (line_len + 1);
       strncpy (new_argv[0],
-               new_line + shell_len + sizeof (minus_c) - 1, line_len);
+               new_line + shell_len + minus_c_len, line_len);
       new_argv[0][line_len] = '\0';
       }
 #else
diff -ru make-3.79.1/main.c make-3.79.1-patched/main.c
--- make-3.79.1/main.c	Tue Jun 13 16:24:45 2000
+++ make-3.79.1-patched/main.c	Thu Jan 24 01:33:47 2002
@@ -78,6 +78,27 @@
 
 /* The structure that describes an accepted command switch.  */
 
+#if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO)
+/*
+ * The various Apple, NeXT, and NeXT PDO hacks are no longer enabled by
+ * default, so that default behaves matches GNU make.
+ *
+ * The hacks can be enabled selectively enabling the following options.
+ * They can be enabled by setting the variable USE_APPLE_PB_SUPPORT to one
+ * or more of the options, or by specify "-N <option>" on the command line.
+ *
+ *	all		Turn on all NeXT features.
+ *
+ *	makefiles	DON'T remake Makefiles
+ *
+ *	quiet		Be quiet: warn about using vpath compatibility
+ *			mode or missing targets or overriding implicit rules.
+ *
+ *	vpath		Use the System V vpath compatibility mode.
+ *
+ *	errexit		Use "sh -ec" (instead of "sh -c") to execute rules.
+ */
+#endif
 struct command_switch
   {
     int c;			/* The switch character.  */
@@ -197,6 +218,13 @@
 
 static struct stringlist *makefiles = 0;
 
+#if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO)
+/* Apple's hacks are OFF by default, and are enabled by putting the
+   "use-apple-pbhacks-*" directives in the pb_makefiles. */
+unsigned int next_flag = 0;
+static struct stringlist *next_flag_list = 0;
+#endif
+
 /* Number of job slots (commands that can be run at once).  */
 
 unsigned int job_slots = 1;
@@ -356,6 +384,11 @@
     { CHAR_MAX+4, flag, (char *) &warn_undefined_variables_flag, 1, 1, 0, 0, 0,
 	"warn-undefined-variables", 0,
 	N_("Warn when an undefined variable is referenced") },
+#if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO)
+    { 'N', string, (char *) &next_flag_list, 0, 0, 0, 0, 0,
+	"NeXT-option", N_("OPTION"),
+	N_("Turn on value of NeXT OPTION") },
+#endif /* __APPLE__ || NeXT || NeXT_PDO */
     { '\0', }
   };
 
@@ -1052,6 +1085,28 @@
   decode_env_switches ("MFLAGS", 6);
 #endif
   decode_switches (argc, argv, 0);
+#if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO)
+  if (next_flag_list != 0) {
+        char **p;
+      next_flag = 0;
+      for (p = next_flag_list->list; *p != 0; p++) {
+	  if (strcmp(*p, "vpath") == 0) {
+	      next_flag |= NEXT_VPATH_FLAG;
+	  } else if (strcmp(*p, "quiet") == 0) {
+	      next_flag |= NEXT_QUIET_FLAG;
+	  } else if (strcmp(*p, "makefiles") == 0) {
+	      next_flag |= NEXT_MAKEFILES_FLAG;
+	  } else if (strcmp(*p, "errexit") == 0) {
+	      next_flag |= NEXT_ERREXIT_FLAG;
+	  } else if (strcmp(*p, "all") == 0) {
+	      next_flag = NEXT_ALL_FLAGS;
+	  } else {
+	      error ("Unrecognized flag `%s'.", *p);
+	  }
+      }
+  }
+#endif	/* __APPLE__ || NeXT || NeXT_PDO */
+
 #ifdef WINDOWS32
   if (suspend_flag) {
         fprintf(stderr, "%s (pid = %d)\n", argv[0], GetCurrentProcessId());
@@ -1208,9 +1263,11 @@
       makelevel = 0;
   }
 
+#if ! (defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO))
   /* Except under -s, always do -w in sub-makes and under -C.  */
   if (!silent_flag && (directories != 0 || makelevel > 0))
     print_directory_flag = 1;
+#endif
 
   /* Let the user disable that with --no-print-directory.  */
   if (inhibit_print_directory_flag)
@@ -1602,6 +1659,9 @@
   remote_setup ();
 
   if (read_makefiles != 0)
+#if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO)
+      if (!(next_flag & NEXT_MAKEFILES_FLAG))
+#endif
     {
       /* Update any makefiles if necessary.  */
 
diff -ru make-3.79.1/make.h make-3.79.1-patched/make.h
--- make-3.79.1/make.h	Thu Jun 15 07:25:37 2000
+++ make-3.79.1-patched/make.h	Thu Jan 24 01:33:47 2002
@@ -502,6 +502,21 @@
 extern int warn_undefined_variables_flag, posix_pedantic, not_parallel;
 extern int clock_skew_detected;
 
+#if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO)
+extern unsigned int next_flag;
+#define NEXT_VPATH_FLAG			(1 << 0)
+#define NEXT_QUIET_FLAG			(1 << 1)
+#define NEXT_MAKEFILES_FLAG		(1 << 2)
+#define NEXT_ERREXIT_FLAG		(1 << 3)
+#define NEXT_ALL_FLAGS			(NEXT_VPATH_FLAG | 	\
+					 NEXT_QUIET_FLAG | 	\
+					 NEXT_MAKEFILES_FLAG |	\
+					 NEXT_ERREXIT_FLAG)
+
+extern int general_vpath_search();
+extern char *allocated_vpath_expand_for_file();
+#endif	/* __APPLE__ || NeXT || NeXT_PDO */
+
 /* can we run commands via 'sh -c xxx' or must we use batch files? */
 extern int batch_mode_shell;
 
diff -ru make-3.79.1/read.c make-3.79.1-patched/read.c
--- make-3.79.1/read.c	Wed Jun 21 21:33:30 2000
+++ make-3.79.1-patched/read.c	Thu Jan 24 01:33:47 2002
@@ -1643,6 +1643,9 @@
 	    fatal (flocp,
                    _("target file `%s' has both : and :: entries"), f->name);
 
+#if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO)
+          if (!(next_flag & NEXT_QUIET_FLAG))
+#endif
 	  /* If CMDS == F->CMDS, this target was listed in this rule
 	     more than once.  Just give a warning since this is harmless.  */
 	  if (cmds != 0 && cmds == f->cmds)
@@ -1655,12 +1658,18 @@
 	     whose commands were preinitialized.  */
 	  else if (cmds != 0 && f->cmds != 0 && f->is_target)
 	    {
+#if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO)
+	      if (!(next_flag & NEXT_QUIET_FLAG)) {
+#endif
 	      error (&cmds->fileinfo,
                      _("warning: overriding commands for target `%s'"),
                      f->name);
 	      error (&f->cmds->fileinfo,
                      _("warning: ignoring old commands for target `%s'"),
                      f->name);
+#if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO)
+	      }
+#endif
 	    }
 
 	  f->is_target = 1;
diff -ruN -x CVS make-3.79/next.c make/next.c
--- make-3.79/next.c	Thu Jan  1 01:00:00 1970
+++ make/next.c	Fri Jan 28 05:50:18 2000
@@ -0,0 +1,226 @@
+#if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO) /* for NEXT_VPATH_FLAG support */
+#include "make.h"
+#include "job.h"
+#include "commands.h"
+#include "filedef.h"
+#include "variable.h"
+#include "dep.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#if !__STDC__
+#define const
+#endif
+
+/* Search through a pathlist for a file.  `search_path' will parse `path',
+ * a list of pathnames separated by colons, prepending each pathname to
+ * `filename'.  The resulting filename will be checked for existence via
+ * stat().
+ */
+static int
+search_path(path, file)
+    const char *path;
+    char **file;
+{
+    int n, length;
+    char *filename, *name;
+    const char *nextchar, *lastchar;
+
+    filename = *file;
+    n = strlen(filename);
+    length = strlen(path) + n + 10;
+    name = alloca(length) + length - 1;
+    *name = '\0';
+
+    filename += n;
+    while (--n >= 0)
+	*--name = *--filename;
+
+    if (*name == '/' || path == 0)
+	path = "";
+
+    /* Strip off leading './'s, if any. */
+    while (*name == '.' && *(name + 1) == '/')
+	name += 2;
+
+    do {
+	/* Advance to the end of the next path in our path list. */
+	nextchar = path;
+#if defined (__MSDOS__) || defined (WIN32)
+	while ((*nextchar != '\0' && *nextchar != ':' && !isspace (*nextchar))
+	|| (*nextchar == ':' && nextchar - path == 1
+	  && (nextchar[1] == '/' || nextchar[1] == '\\')))
+	    nextchar++;
+#else
+	while (*nextchar != '\0' && *nextchar != ':' && !isspace (*nextchar))
+	    nextchar++;
+#endif
+
+	lastchar = nextchar;
+	filename = name;
+
+	/* If we actually have a path, prepend the file name with a '/'. */
+	if (nextchar != path)
+	    *--filename = '/';
+
+	/* Prepend the file name with the path. */
+	while (nextchar != path)
+	    *--filename = *--nextchar;
+
+	path = (*lastchar) ? lastchar + 1 : lastchar;
+
+	{
+	    struct stat s;
+	    if (stat(filename, &s) >= 0) {
+		/* We have found a file.
+		 * Store the name we found into *FILE for the caller.  */
+		*file = savestring(filename, strlen(filename));
+		return (1);
+	    }
+	}
+    } while (*path != 0);
+    return (0);
+}
+
+int
+general_vpath_search(file)
+    char **file;
+{
+    int s;
+    int savelen;
+    char *vpath, *save;
+    
+    save = save_variable_output(&savelen);
+    vpath = variable_expand ("$(VPATH)");
+    if (**file == '/' || *vpath == '\0') {
+	restore_variable_output(save, savelen);
+	return 0;
+    }
+    s = search_path(vpath, file);
+    restore_variable_output(save, savelen);
+    return s;
+}
+
+static int
+match_dep(filename, file)
+    char **filename;
+    struct file *file;
+{
+    struct dep *d;
+
+    /* don't substitute for . or .. */
+    if (!strcmp (*filename, ".") || !strcmp (*filename, ".."))
+        return 0;
+    
+    for (d = file->deps; d != 0; d = d->next) {
+	if (d->file->old_name != 0) {
+	    if (strcmp(*filename, d->file->old_name) == 0) {
+		*filename = dep_name(d);
+		return 1;
+	    }
+	}
+	if (strcmp(*filename, dep_name(d)) == 0) {
+	    if (general_vpath_search(filename))
+		return 1;
+	}
+    }
+    return 0;
+}
+
+/* Scan LINE for vpath references. */
+
+static char *
+vpath_expand(line, file)
+    char *line;
+    struct file *file;
+{
+    struct variable *v;
+    char *p, *p1, *o;
+    static char *meta = 0;
+
+    if (meta == 0) {
+	static char buffer[256] = {0};
+	meta = buffer;
+	meta['\0'] = 1;
+	for (p = "=|^();&<>*?[]:$`'\"\\\n"; *p != 0; p++)
+	    meta[*p] = 1;
+    }
+
+    p = line;
+    o = initialize_variable_output ();
+
+    while (1) {
+	/* Copy all following uninteresting chars all at once to the
+	   variable output buffer, and skip them.  Uninteresting chars end
+	   at the next space or semicolon. */
+
+	for (p1 = p; *p1 != 0 && (isspace(*p1) || meta[*p1]); p1++)
+	    ;
+	o = variable_buffer_output (o, p, p1 - p);
+	if (*p1 == 0)
+	    break;
+	p = p1;
+	while (*p1 != 0 && !(isspace(*p1) || meta[*p1]))
+	    p1++;
+	{
+	    unsigned int n = p1 - p;
+	    char *buffer = malloc(n + 1);
+	    char *filename = buffer;
+	    struct dep *dep;
+
+	    strncpy(filename, p, n);
+	    filename[n] = 0;
+
+	    if (match_dep(&filename, file)) {
+		static struct file *last_file = 0;
+		if (last_file != file) {
+		    last_file = file;
+		    if (!(next_flag & NEXT_QUIET_FLAG)) {
+		      error(&file->cmds->fileinfo,
+			    "Using old-style VPATH substitution.");
+		      error(&file->cmds->fileinfo,
+			    "Consider using automatic variable substitution instead.");
+		    }
+		}
+		o = variable_buffer_output (o, filename, strlen(filename));
+	    } else {
+		o = variable_buffer_output (o, filename, n);
+	    }
+	    p = p1;
+	    free(buffer);
+	}
+	if (*p == '\0')
+	    break;
+    }
+    (void) variable_buffer_output (o, "", 1);
+    return initialize_variable_output ();
+}
+
+char *
+allocated_vpath_expand_for_file(line, file)
+    char *line;
+    struct file *file;
+{
+    char *save, *value;
+    struct variable_set_list *save_set_list;
+    int savelen;
+
+    if (file == 0)
+	fatal(NILF, "Can't do VPATH expansion on a null file.\n");
+    
+    save = save_variable_output (&savelen);
+    
+    save_set_list = current_variable_set_list;
+    current_variable_set_list = file->variables;
+    reading_file = &file->cmds->fileinfo;
+    value = vpath_expand (line, file);
+    current_variable_set_list = save_set_list;
+    reading_file = 0;
+
+    value = savestring (value, strlen (value));
+    
+    restore_variable_output (save, savelen);
+    
+    return value;
+}
+#endif	/* __APPLE__ || NeXT || NeXT_PDO */
diff -ru make-3.79.1/remake.c make-3.79.1-patched/remake.c
--- make-3.79.1/remake.c	Tue Jun 20 16:00:17 2000
+++ make-3.79.1-patched/remake.c	Thu Jan 24 01:33:47 2002
@@ -225,6 +225,9 @@
 		     any commands were actually started for this goal.  */
 		  && file->update_status == 0 && !g->changed
 		  /* Never give a message under -s or -q.  */
+#if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO)
+                  && !(next_flag & NEXT_QUIET_FLAG)
+#endif
 		  && !silent_flag && !question_flag)
 		message (1, ((file->phony || file->cmds == 0)
 			     ? _("Nothing to be done for `%s'.")
@@ -433,6 +436,9 @@
 
       if (is_updating (d->file))
 	{
+#if __APPLE__ || NeXT || NeXT_PDO
+         if (!(next_flag & NEXT_QUIET_FLAG))
+#endif
 	  error (NILF, _("Circular %s <- %s dependency dropped."),
 		 file->name, d->file->name);
 	  /* We cannot free D here because our the caller will still have
@@ -638,6 +644,9 @@
 
       while (file)
         {
+#if __APPLE__ || NeXT || NeXT_PDO
+	  file->old_name = file->name;
+#endif	/* __APPLE__ || NeXT || NeXT_PDO */
           file->name = file->hname;
           file = file->prev;
         }
@@ -857,6 +866,9 @@
 	    {
 	      if (is_updating (d->file))
 		{
+#if __APPLE__ || NeXT || NeXT_PDO
+		  if (!(next_flag & NEXT_QUIET_FLAG))
+#endif
 		  error (NILF, _("Circular %s <- %s dependency dropped."),
 			 file->name, d->file->name);
 		  if (lastd == 0)
@@ -972,7 +984,15 @@
 	   Pretend it was successfully remade.  */
 	file->update_status = 0;
       else
-        {
+#if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO)
+      {
+	char *name = file->name;
+	if ((next_flag & NEXT_VPATH_FLAG) && general_vpath_search(&name)) {
+	  free(name);
+	  file->update_status = 0;
+	} else
+#endif /* defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO) */
+	{
           const char *msg_noparent
             = _("%sNo rule to make target `%s'%s");
           const char *msg_parent
@@ -997,6 +1017,9 @@
             }
           file->update_status = 2;
         }
+#if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO)
+      }
+#endif
     }
   else
     {
diff -ru make-3.79.1/variable.c make-3.79.1-patched/variable.c
--- make-3.79.1/variable.c	Fri May 19 18:36:08 2000
+++ make-3.79.1-patched/variable.c	Thu Jan 24 01:33:47 2002
@@ -51,6 +51,41 @@
 
 /* Implement variables.  */
 
+#if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO)
+static void check_apple_pb_support (name, length, value)
+     char *name;
+     unsigned int length;
+     char *value;
+{
+  char *p;
+
+  if (length == 20 && !strncmp (name, "USE_APPLE_PB_SUPPORT", length)) {
+    for (p = value; *p != '\0'; p++) {
+      if (isspace (*p)) {
+	continue;
+      }
+      if (!strncmp (p, "all", 3)) {
+	p += 3;
+	next_flag |= NEXT_ALL_FLAGS;
+      } else if (!strncmp (p, "vpath", 5)) {
+	p += 5;
+	next_flag |= NEXT_VPATH_FLAG;
+      } else if (!strncmp (p, "quiet", 5)) {
+	p += 5;
+	next_flag |= NEXT_QUIET_FLAG;
+      } else if (!strncmp (p, "makefiles", 9)) {
+	p += 9;
+	next_flag |= NEXT_MAKEFILES_FLAG;
+      } else if (!strncmp (p, "errexit", 7)) {
+	p += 7;
+	next_flag |= NEXT_ERREXIT_FLAG;
+      }
+    }
+  }
+}
+#endif /* __APPLE__ || NeXT || NeXT_PDO */
+
+
 /* Define variable named NAME with value VALUE in SET.  VALUE is copied.
    LENGTH is the length of NAME, which does not need to be null-terminated.
    ORIGIN specifies the origin of the variable (makefile, command line
@@ -71,6 +106,10 @@
   register unsigned int i;
   register unsigned int hashval;
   register struct variable *v;
+
+#if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO)
+  check_apple_pb_support (name, length, value);
+#endif /* __APPLE__ || NeXT || NeXT_PDO */
 
   hashval = 0;
   for (i = 0; i < length; ++i)
diff -ru make-3.79.1/variable.h make-3.79.1-patched/variable.h
--- make-3.79.1/variable.h	Thu Feb 24 19:59:14 2000
+++ make-3.79.1-patched/variable.h	Thu Jan 24 01:33:47 2002
@@ -78,6 +78,13 @@
 
 /* expand.c */
 extern char *variable_buffer_output PARAMS ((char *ptr, char *string, unsigned int length));
+
+#if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO)
+extern char *initialize_variable_output PARAMS ((void));
+extern char *save_variable_output PARAMS ((int *savelenp));
+extern void restore_variable_output PARAMS ((char *save, int savelen));
+#endif /* __APPLE__ || NeXT || NeXT_PDO */
+
 extern char *variable_expand PARAMS ((char *line));
 extern char *allocated_variable_expand_for_file PARAMS ((char *line, struct file *file));
 #define	allocated_variable_expand(line) \
