Index: config.h.W32.template
===================================================================
RCS file: /sources/make/make/config.h.W32.template,v
retrieving revision 2.27
diff -u -p -r2.27 config.h.W32.template
--- config.h.W32.template	25 Oct 2009 18:56:44 -0000	2.27
+++ config.h.W32.template	5 Jul 2010 19:43:20 -0000
@@ -426,7 +426,11 @@ this program.  If not, see <http://www.g
 /* Define to `int' if <sys/types.h> does not define. */
 /* GCC 4.x reportedly defines pid_t.  */
 #ifndef _PID_T_
+#ifndef _WIN64
 #define pid_t int
+#else
+#define pid_t __int64
+#endif
 #endif
 
 /* Define to `int' if <sys/types.h> doesn't define. */
Index: function.c
===================================================================
RCS file: /sources/make/make/function.c,v
retrieving revision 1.116
diff -u -p -r1.116 function.c
--- function.c	25 Oct 2009 18:56:44 -0000	1.116
+++ function.c	5 Jul 2010 19:43:21 -0000
@@ -1434,7 +1434,7 @@ int shell_function_pid = 0, shell_functi
 
 
 void
-windows32_openpipe (int *pipedes, int *pid_p, char **command_argv, char **envp)
+windows32_openpipe (int *pipedes, pid_t *pid_p, char **command_argv, char **envp)
 {
   SECURITY_ATTRIBUTES saAttr;
   HANDLE hIn;
@@ -1489,13 +1489,13 @@ windows32_openpipe (int *pipedes, int *p
     process_register(hProcess);
 
     /* set the pid for returning to caller */
-    *pid_p = (int) hProcess;
+    *pid_p = (pid_t) hProcess;
 
   /* set up to read data from child */
-  pipedes[0] = _open_osfhandle((long) hChildOutRd, O_RDONLY);
+  pipedes[0] = _open_osfhandle((intptr_t) hChildOutRd, O_RDONLY);
 
   /* this will be closed almost right away */
-  pipedes[1] = _open_osfhandle((long) hChildOutWr, O_APPEND);
+  pipedes[1] = _open_osfhandle((intptr_t) hChildOutWr, O_APPEND);
   } else {
     /* reap/cleanup the failed process */
 	process_cleanup(hProcess);
@@ -1510,7 +1510,7 @@ windows32_openpipe (int *pipedes, int *p
 
     /* set status for return */
     pipedes[0] = pipedes[1] = -1;
-    *pid_p = -1;
+    *pid_p = (pid_t) -1;
   }
 }
 #endif
@@ -1594,7 +1594,7 @@ func_shell (char *o, char **argv, const 
   const char *error_prefix;
   char **envp;
   int pipedes[2];
-  int pid;
+  pid_t pid;
 
 #ifndef __MSDOS__
   /* Construct the argument list.  */
Index: job.c
===================================================================
RCS file: /sources/make/make/job.c,v
retrieving revision 1.201
diff -u -p -r1.201 job.c
--- job.c	5 Jul 2010 18:32:03 -0000	1.201
+++ job.c	5 Jul 2010 19:43:22 -0000
@@ -247,7 +247,7 @@ unsigned int jobserver_tokens = 0;
  * The macro which references this function is defined in make.h.
  */
 int
-w32_kill(int pid, int sig)
+w32_kill(pid_t pid, int sig)
 {
   return ((process_kill((HANDLE)pid, sig) == TRUE) ? 0 : -1);
 }
@@ -315,7 +315,7 @@ create_batch_file (char const *base, int
           const unsigned final_size = path_size + size + 1;
           char *const path = xmalloc (final_size);
           memcpy (path, temp_path, final_size);
-          *fd = _open_osfhandle ((long)h, 0);
+          *fd = _open_osfhandle ((intptr_t)h, 0);
           if (unixy)
             {
               char *p;
@@ -1393,7 +1393,7 @@ start_job_command (struct child *child)
       hPID = process_easy(argv, child->environment);
 
       if (hPID != INVALID_HANDLE_VALUE)
-        child->pid = (int) hPID;
+        child->pid = (pid_t) hPID;
       else {
         int i;
         unblock_sigs();
Index: main.c
===================================================================
RCS file: /sources/make/make/main.c,v
retrieving revision 1.238
diff -u -p -r1.238 main.c
--- main.c	1 Jul 2010 07:16:00 -0000	1.238
+++ main.c	5 Jul 2010 19:43:24 -0000
@@ -681,23 +681,23 @@ handle_runtime_exceptions( struct _EXCEP
   if (! ISDB (DB_VERBOSE))
     {
       sprintf(errmsg,
-              _("%s: Interrupt/Exception caught (code = 0x%lx, addr = 0x%lx)\n"),
-              prg, exrec->ExceptionCode, (DWORD)exrec->ExceptionAddress);
+              _("%s: Interrupt/Exception caught (code = 0x%lx, addr = 0x%Iu)\n"),
+              prg, exrec->ExceptionCode, (DWORD_PTR)exrec->ExceptionAddress);
       fprintf(stderr, errmsg);
       exit(255);
     }
 
   sprintf(errmsg,
-          _("\nUnhandled exception filter called from program %s\nExceptionCode = %lx\nExceptionFlags = %lx\nExceptionAddress = %lx\n"),
+          _("\nUnhandled exception filter called from program %s\nExceptionCode = %lx\nExceptionFlags = %lx\nExceptionAddress = %Iu\n"),
           prg, exrec->ExceptionCode, exrec->ExceptionFlags,
-          (DWORD)exrec->ExceptionAddress);
+          (DWORD_PTR)exrec->ExceptionAddress);
 
   if (exrec->ExceptionCode == EXCEPTION_ACCESS_VIOLATION
       && exrec->NumberParameters >= 2)
     sprintf(&errmsg[strlen(errmsg)],
             (exrec->ExceptionInformation[0]
-             ? _("Access violation: write operation at address %lx\n")
-             : _("Access violation: read operation at address %lx\n")),
+             ? _("Access violation: write operation at address %Iu\n")
+             : _("Access violation: read operation at address %Iu\n")),
             exrec->ExceptionInformation[1]);
 
   /* turn this on if we want to put stuff in the event log too */
@@ -978,7 +978,7 @@ main (int argc, char **argv, char **envp
   fatal_signal_mask = 0;
 #define	ADD_SIG(sig)	fatal_signal_mask |= sigmask (sig)
 #else
-#define	ADD_SIG(sig)
+#define	ADD_SIG(sig)	(void)sig
 #endif
 #endif
 
@@ -1399,7 +1399,7 @@ main (int argc, char **argv, char **envp
           /* WINDOWS32 chdir() doesn't work if the directory has a trailing '/'
              But allow -C/ just in case someone wants that.  */
           {
-            char *p = dir + strlen (dir) - 1;
+            char *p = (char *)dir + strlen (dir) - 1;
             while (p > dir && (p[0] == '/' || p[0] == '\\'))
               --p;
             p[1] = '\0';
Index: make.h
===================================================================
RCS file: /sources/make/make/make.h,v
retrieving revision 1.138
diff -u -p -r1.138 make.h
--- make.h	1 Jul 2010 05:59:09 -0000	1.138
+++ make.h	5 Jul 2010 19:43:24 -0000
@@ -31,6 +31,8 @@ this program.  If not, see <http://www.g
 /* AIX requires this to be the first thing in the file.  */
 #if HAVE_ALLOCA_H
 # include <alloca.h>
+#elif defined(_WIN32)
+# include <malloc.h>
 #else
 # ifdef _AIX
  #pragma alloca
@@ -326,7 +328,7 @@ char *strsignal (int signum);
 # define kill(_pid,_sig) w32_kill((_pid),(_sig))
 
 void sync_Path_environment (void);
-int w32_kill (int pid, int sig);
+int w32_kill (pid_t pid, int sig);
 char *end_of_token_w32 (const char *s, char stopchar);
 int find_and_set_default_shell (const char *token);
 
Index: w32/subproc/sub_proc.c
===================================================================
RCS file: /sources/make/make/w32/subproc/sub_proc.c,v
retrieving revision 1.21
diff -u -p -r1.21 sub_proc.c
--- w32/subproc/sub_proc.c	25 Oct 2009 18:56:46 -0000	1.21
+++ w32/subproc/sub_proc.c	5 Jul 2010 19:43:24 -0000
@@ -31,9 +31,9 @@ static char *make_command_line(char *she
 extern char *xmalloc (unsigned int);
 
 typedef struct sub_process_t {
-	int sv_stdin[2];
-	int sv_stdout[2];
-	int sv_stderr[2];
+	intptr_t sv_stdin[2];
+	intptr_t sv_stdout[2];
+	intptr_t sv_stderr[2];
 	int using_pipes;
 	char *inp;
 	DWORD incnt;
@@ -41,7 +41,7 @@ typedef struct sub_process_t {
 	volatile DWORD outcnt;
 	char * volatile errp;
 	volatile DWORD errcnt;
-	int pid;
+	pid_t pid;
 	int exit_code;
 	int signal;
 	long last_err;
@@ -310,12 +310,12 @@ process_init()
 		pproc->lerrno = E_SCALL;
 		return((HANDLE)pproc);
 	}
-	pproc->sv_stdin[0]  = (int) stdin_pipes[0];
-	pproc->sv_stdin[1]  = (int) stdin_pipes[1];
-	pproc->sv_stdout[0] = (int) stdout_pipes[0];
-	pproc->sv_stdout[1] = (int) stdout_pipes[1];
-	pproc->sv_stderr[0] = (int) stderr_pipes[0];
-	pproc->sv_stderr[1] = (int) stderr_pipes[1];
+	pproc->sv_stdin[0]  = (intptr_t) stdin_pipes[0];
+	pproc->sv_stdin[1]  = (intptr_t) stdin_pipes[1];
+	pproc->sv_stdout[0] = (intptr_t) stdout_pipes[0];
+	pproc->sv_stdout[1] = (intptr_t) stdout_pipes[1];
+	pproc->sv_stderr[0] = (intptr_t) stderr_pipes[0];
+	pproc->sv_stderr[1] = (intptr_t) stderr_pipes[1];
 
 	pproc->using_pipes = 1;
 
@@ -337,9 +337,9 @@ process_init_fd(HANDLE stdinh, HANDLE st
 	 * Just pass the provided file handles to the 'child side' of the
 	 * pipe, bypassing pipes altogether.
 	 */
-	pproc->sv_stdin[1]  = (int) stdinh;
-	pproc->sv_stdout[1] = (int) stdouth;
-	pproc->sv_stderr[1] = (int) stderrh;
+	pproc->sv_stdin[1]  = (intptr_t) stdinh;
+	pproc->sv_stdout[1] = (intptr_t) stdouth;
+	pproc->sv_stderr[1] = (intptr_t) stderrh;
 
 	pproc->last_err = pproc->lerrno = 0;
 
@@ -575,7 +575,7 @@ process_begin(
 		}
 	}
 
-	pproc->pid = (int)procInfo.hProcess;
+	pproc->pid = (pid_t)procInfo.hProcess;
 	/* Close the thread handle -- we'll just watch the process */
 	CloseHandle(procInfo.hThread);
 
