Index: /trunk/Config.kmk
===================================================================
--- /trunk/Config.kmk	(revision 808)
+++ /trunk/Config.kmk	(revision 809)
@@ -84,35 +84,35 @@
 
 ifeq ($(filter-out win nt,$(BUILD_TARGET)),)
-include $(PATH_KBUILD)/tools/VCC70.kmk	# fixme! template expanding does something bad to _LIBS /me thinks.
-TEMPLATE_BIN_TOOL               = VCC70
-TEMPLATE_BIN_DEFS               = WINDOWS32 _CONSOLE WIN32 __WIN32__
-TEMPLATE_BIN_DEFS.release       = NDEBUG
-TEMPLATE_BIN_SDKS               = WINPSDK
-TEMPLATE_BIN_CFLAGS             = -W3 -Zi -Zl
-TEMPLATE_BIN_CFLAGS.release     = -O2
-TEMPLATE_BIN_CFLAGS.profile     = -O2 -GH -Gh
-TEMPLATE_BIN_INCS              += \
+ include $(PATH_KBUILD)/tools/VCC70.kmk	# fixme! template expanding does something bad to _LIBS /me thinks.
+ TEMPLATE_BIN_TOOL              = VCC70
+ TEMPLATE_BIN_DEFS              = WINDOWS32 _CONSOLE WIN32 __WIN32__
+ TEMPLATE_BIN_DEFS.release      = NDEBUG
+ TEMPLATE_BIN_SDKS              = WINPSDK
+ TEMPLATE_BIN_CFLAGS            = -W3 -Zi -Zl
+ TEMPLATE_BIN_CFLAGS.release    = -O2
+ TEMPLATE_BIN_CFLAGS.profile    = -O2 -GH -Gh
+ TEMPLATE_BIN_INCS             += \
 	. \
 	$(PATH_ROOT)/src/gmake/w32/include \
 	$(PATH_ROOT)/src/gmake/glob
-TEMPLATE_BIN_LDFLAGS            = /SUBSYSTEM:console /INCREMENTAL:no /NOD /DEBUG
-ifeq (1,0)
-TEMPLATE_BIN_CFLAGS            += -MT
-TEMPLATE_BIN_LIBS               = \
+ TEMPLATE_BIN_LDFLAGS           = /SUBSYSTEM:console /INCREMENTAL:no /NOD /DEBUG
+ ifeq (1,0)
+ TEMPLATE_BIN_CFLAGS           += -MT
+ TEMPLATE_BIN_LIBS              = \
 	$(PATH_TOOL_VCC70_LIB)/oldnames.lib \
 	$(PATH_TOOL_VCC70_LIB)/libcmt.lib \
 	$(PATH_TOOL_VCC70_LIB)/libcpmt.lib
-else
-TEMPLATE_BIN_CFLAGS            += -MD
-TEMPLATE_BIN_LIBS               = \
+ else
+ TEMPLATE_BIN_CFLAGS           += -MD
+ TEMPLATE_BIN_LIBS              = \
 	$(PATH_TOOL_VCC70_LIB)/oldnames.lib \
 	$(PATH_TOOL_VCC70_LIB)/msvcrt.lib
-#	$(PATH_TOOL_VCC70_LIB)/msvcprt.lib
-endif
-TEMPLATE_BIN_LIBS.profile       = g:/coding/vbox/trunk/out/win32/debug/lib/kPrf2.lib
+ #	$(PATH_TOOL_VCC70_LIB)/msvcprt.lib
+ endif
+ TEMPLATE_BIN_LIBS.profile      = g:/coding/vbox/trunk/out/win32/debug/lib/kPrf2.lib
  ifdef NIX_INSTALL_DIR
-TEMPLATE_BIN_INST               = $(NIX_INSTALL_DIR_BIN)/
+ TEMPLATE_BIN_INST              = $(NIX_INSTALL_DIR_BIN)/
  else
-TEMPLATE_BIN_INST               = kBuild/bin/win.$(BUILD_TARGET_ARCH)/
+ TEMPLATE_BIN_INST              = kBuild/bin/win.$(BUILD_TARGET_ARCH)/
  endif
 endif
@@ -121,12 +121,15 @@
 TEMPLATE_BIN_TOOL               = GCC3
 TEMPLATE_BIN_CFLAGS.release     = -O3
-ifeq ($(BUILD_TARGET),linux)
-TEMPLATE_BIN_LIBS              += rt
-endif
-ifeq ($(BUILD_TARGET),freebsd)
+ endif
+ ifeq ($(BUILD_TARGET),freebsd)
 TEMPLATE_BIN_LIBS              += iconv intl
 TEMPLATE_BIN_LIBPATH           += /usr/local/lib
 TEMPLATE_BIN_INCS              += $(PATH_ROOT)/src/gmake/glob /usr/local/include
-endif
+ endif
+ ifeq ($(BUILD_TARGET),linux)
+TEMPLATE_BIN_LIBS              += rt
+ ifeq ($(BUILD_TARGET),solaris)
+TEMPLATE_BIN_LIBS              += rt
+ endif
  ifdef NIX_INSTALL_DIR
 TEMPLATE_BIN_INST               = $(NIX_INSTALL_DIR_BIN)/
Index: /trunk/src/ash/Makefile.kmk
===================================================================
--- /trunk/src/ash/Makefile.kmk	(revision 808)
+++ /trunk/src/ash/Makefile.kmk	(revision 809)
@@ -16,4 +16,5 @@
 kmk_ash_DEFS = lint SHELL SMALL
 kmk_ash_DEFS.linux = BSD
+kmk_ash_DEFS.solaris = BSD
 kmk_ash_DEFS.win = \
 	BSD PC_PATH_SEP PC_DRIVE_LETTERS PC_EXE_EXTS
@@ -67,4 +68,8 @@
 	win/err.c \
 	win/dirent.c \
+	sys_signame.c \
+	strlcpy.c \
+	setmode.c
+kmk_ash_SOURCES.solaris = \
 	sys_signame.c \
 	strlcpy.c \
Index: /trunk/src/ash/alias.c
===================================================================
--- /trunk/src/ash/alias.c	(revision 808)
+++ /trunk/src/ash/alias.c	(revision 809)
@@ -33,5 +33,7 @@
  */
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#endif
 #ifndef lint
 #if 0
Index: /trunk/src/ash/arith.y
===================================================================
--- /trunk/src/ash/arith.y	(revision 808)
+++ /trunk/src/ash/arith.y	(revision 809)
@@ -34,5 +34,7 @@
  */
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#endif
 #ifndef lint
 #if 0
Index: /trunk/src/ash/arith_lex.l
===================================================================
--- /trunk/src/ash/arith_lex.l	(revision 808)
+++ /trunk/src/ash/arith_lex.l	(revision 809)
@@ -35,5 +35,7 @@
  */
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#endif
 #ifndef lint
 #if 0
Index: /trunk/src/ash/bltin/kill.c
===================================================================
--- /trunk/src/ash/bltin/kill.c	(revision 808)
+++ /trunk/src/ash/bltin/kill.c	(revision 809)
@@ -30,5 +30,7 @@
  */
 
+#ifndef __sun__
 #include <sys/cdefs.h>
+#endif
 #if !defined(lint) && !defined(SHELL)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1993, 1994\n\
@@ -45,5 +47,7 @@
 
 #include <ctype.h>
+#ifndef __sun__
 #include <err.h>
+#endif
 #include <errno.h>
 #include <signal.h>
Index: /trunk/src/ash/bltin/test.c
===================================================================
--- /trunk/src/ash/bltin/test.c	(revision 808)
+++ /trunk/src/ash/bltin/test.c	(revision 809)
@@ -11,5 +11,7 @@
  */
 
+#ifndef __sun__
 #include <sys/cdefs.h>
+#endif
 #ifndef lint
 __RCSID("$NetBSD: test.c,v 1.26 2005/02/10 06:56:55 simonb Exp $");
@@ -20,5 +22,7 @@
 
 #include <ctype.h>
+#ifndef __sun__
 #include <err.h>
+#endif
 #include <errno.h>
 #include <stdio.h>
Index: /trunk/src/ash/cd.c
===================================================================
--- /trunk/src/ash/cd.c	(revision 808)
+++ /trunk/src/ash/cd.c	(revision 809)
@@ -33,5 +33,7 @@
  */
 
+#ifndef __sun__
 #include <sys/cdefs.h>
+#endif
 #ifndef lint
 #if 0
Index: /trunk/src/ash/error.c
===================================================================
--- /trunk/src/ash/error.c	(revision 808)
+++ /trunk/src/ash/error.c	(revision 809)
@@ -33,5 +33,7 @@
  */
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#endif
 #ifndef lint
 #if 0
Index: /trunk/src/ash/eval.c
===================================================================
--- /trunk/src/ash/eval.c	(revision 808)
+++ /trunk/src/ash/eval.c	(revision 809)
@@ -33,5 +33,7 @@
  */
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#endif
 #ifndef lint
 #if 0
@@ -53,4 +55,7 @@
 #ifdef HAVE_SYSCTL_H
 #include <sys/sysctl.h>
+#endif
+#ifdef __sun__
+#include <iso/limits_iso.h>
 #endif
 
@@ -609,5 +614,5 @@
 	static char *sys_path = NULL;
 	static int mib[] = {CTL_USER, USER_CS_PATH};
-#endif 
+#endif
 #ifdef PC_PATH_SEP
 	static char def_path[] = "PATH=/usr/bin;/bin;/usr/sbin;/sbin";
@@ -632,5 +637,5 @@
 #else
     return def_path;
-#endif 
+#endif
 }
 
Index: /trunk/src/ash/exec.c
===================================================================
--- /trunk/src/ash/exec.c	(revision 808)
+++ /trunk/src/ash/exec.c	(revision 809)
@@ -33,5 +33,7 @@
  */
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#endif
 #ifndef lint
 #if 0
Index: /trunk/src/ash/expand.c
===================================================================
--- /trunk/src/ash/expand.c	(revision 808)
+++ /trunk/src/ash/expand.c	(revision 809)
@@ -33,5 +33,7 @@
  */
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#endif
 #ifndef lint
 #if 0
@@ -51,4 +53,7 @@
 #include <stdlib.h>
 #include <stdio.h>
+#ifdef __sun__
+#include <iso/limits_iso.h>
+#endif
 
 /*
@@ -101,5 +106,5 @@
 STATIC void varvalue(char *, int, int, int);
 STATIC void recordregion(int, int, int);
-STATIC void removerecordregions(int); 
+STATIC void removerecordregions(int);
 STATIC void ifsbreakup(char *, struct arglist *);
 STATIC void ifsfree(void);
@@ -305,5 +310,5 @@
 
 
-STATIC void 
+STATIC void
 removerecordregions(int endoff)
 {
@@ -328,5 +333,5 @@
 		return;
 	}
-	
+
 	ifslastp = &ifsfirst;
 	while (ifslastp->next && ifslastp->next->begoff < endoff)
@@ -562,5 +567,5 @@
 			loc--;
 			if ((varflags & VSQUOTE) && loc > startp &&
-			    *(loc - 1) == CTLESC) { 
+			    *(loc - 1) == CTLESC) {
 				for (q = startp; q < loc; q++)
 					if (*q == CTLESC)
@@ -740,7 +745,7 @@
 		if (subevalvar(p, var, 0, subtype, startloc, varflags)) {
 			varflags &= ~VSNUL;
-			/* 
-			 * Remove any recorded regions beyond 
-			 * start of variable 
+			/*
+			 * Remove any recorded regions beyond
+			 * start of variable
 			 */
 			removerecordregions(startloc);
Index: /trunk/src/ash/histedit.c
===================================================================
--- /trunk/src/ash/histedit.c	(revision 808)
+++ /trunk/src/ash/histedit.c	(revision 809)
@@ -33,5 +33,7 @@
  */
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#endif
 #ifndef lint
 #if 0
@@ -43,5 +45,7 @@
 
 #include <sys/param.h>
+#ifndef __sun__
 #include <paths.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
@@ -154,5 +158,5 @@
 			else if (Eflag)
 				el_set(el, EL_EDITOR, "emacs");
-			el_set(el, EL_BIND, "^I", 
+			el_set(el, EL_BIND, "^I",
 			    tabcomplete ? "rl-complete" : "ed-insert", NULL);
 			el_source(el, NULL);
Index: /trunk/src/ash/input.c
===================================================================
--- /trunk/src/ash/input.c	(revision 808)
+++ /trunk/src/ash/input.c	(revision 809)
@@ -33,5 +33,7 @@
  */
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#endif
 #ifndef lint
 #if 0
@@ -48,4 +50,7 @@
 #include <stdlib.h>
 #include <string.h>
+#ifdef __sun__
+#include <iso/limits_iso.h>
+#endif
 
 /*
Index: /trunk/src/ash/jobs.c
===================================================================
--- /trunk/src/ash/jobs.c	(revision 808)
+++ /trunk/src/ash/jobs.c	(revision 809)
@@ -33,5 +33,9 @@
  */
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#else
+#define _PATH_DEVNULL "/dev/null"
+#endif
 #ifndef lint
 #if 0
@@ -43,12 +47,17 @@
 
 #include <fcntl.h>
+#ifdef __sun__
+#define sys_siglist _sys_siglist
+#endif
 #include <signal.h>
 #include <errno.h>
 #include <unistd.h>
 #include <stdlib.h>
+#ifndef __sun__
 #include <paths.h>
+#endif
 #include <sys/types.h>
 #include <sys/param.h>
-#ifdef BSD
+#if defined(BSD) || defined(__sun__)
 #include <sys/wait.h>
 #include <sys/time.h>
@@ -688,5 +697,5 @@
 	int i;
 	const char *err_msg = "No such job: %s";
-		
+
 	if (name == NULL) {
 #if JOBS
Index: /trunk/src/ash/mail.c
===================================================================
--- /trunk/src/ash/mail.c	(revision 808)
+++ /trunk/src/ash/mail.c	(revision 809)
@@ -33,5 +33,7 @@
  */
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#endif
 #ifndef lint
 #if 0
Index: /trunk/src/ash/main.c
===================================================================
--- /trunk/src/ash/main.c	(revision 808)
+++ /trunk/src/ash/main.c	(revision 809)
@@ -33,5 +33,7 @@
  */
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#endif
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\
@@ -179,5 +181,5 @@
         init_syntax();
     }
-#endif 
+#endif
 	init();
 	setstackmark(&smark);
@@ -202,5 +204,5 @@
 	if (sflag == 0 || minusc) {
 		static int sigs[] =  {
-		    SIGINT, SIGQUIT, SIGHUP, 
+		    SIGINT, SIGQUIT, SIGHUP,
 #ifdef SIGTSTP
 		    SIGTSTP,
Index: /trunk/src/ash/memalloc.c
===================================================================
--- /trunk/src/ash/memalloc.c	(revision 808)
+++ /trunk/src/ash/memalloc.c	(revision 809)
@@ -33,5 +33,7 @@
  */
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#endif
 #ifndef lint
 #if 0
@@ -224,5 +226,5 @@
 		/*
 		 * Stack marks pointing to the start of the old block
-		 * must be relocated to point to the new block 
+		 * must be relocated to point to the new block
 		 */
 		xmark = markp;
Index: /trunk/src/ash/miscbltin.c
===================================================================
--- /trunk/src/ash/miscbltin.c	(revision 808)
+++ /trunk/src/ash/miscbltin.c	(revision 809)
@@ -33,5 +33,7 @@
  */
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#endif
 #ifndef lint
 #if 0
Index: /trunk/src/ash/mkbuiltins
===================================================================
--- /trunk/src/ash/mkbuiltins	(revision 808)
+++ /trunk/src/ash/mkbuiltins	(revision 809)
@@ -1,3 +1,3 @@
-#!/bin/sh -
+#!/bin/sh -x
 #	$NetBSD: mkbuiltins,v 1.21 2004/06/06 07:03:11 christos Exp $
 #
@@ -66,5 +66,7 @@
  */
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#endif
 
 struct builtincmd {
Index: /trunk/src/ash/mystring.c
===================================================================
--- /trunk/src/ash/mystring.c	(revision 808)
+++ /trunk/src/ash/mystring.c	(revision 809)
@@ -33,5 +33,7 @@
  */
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#endif
 #ifndef lint
 #if 0
Index: /trunk/src/ash/options.c
===================================================================
--- /trunk/src/ash/options.c	(revision 808)
+++ /trunk/src/ash/options.c	(revision 809)
@@ -33,5 +33,7 @@
  */
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#endif
 #ifndef lint
 #if 0
Index: /trunk/src/ash/output.c
===================================================================
--- /trunk/src/ash/output.c	(revision 808)
+++ /trunk/src/ash/output.c	(revision 809)
@@ -33,5 +33,7 @@
  */
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#endif
 #ifndef lint
 #if 0
Index: /trunk/src/ash/parser.c
===================================================================
--- /trunk/src/ash/parser.c	(revision 808)
+++ /trunk/src/ash/parser.c	(revision 809)
@@ -33,5 +33,7 @@
  */
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#endif
 #ifndef lint
 #if 0
@@ -43,4 +45,7 @@
 
 #include <stdlib.h>
+#ifdef __sun__
+#include <iso/limits_iso.h>
+#endif
 
 #include "shell.h"
@@ -746,5 +751,5 @@
 				if (**pp == *wordtext && equal(*pp, wordtext))
 				{
-					lasttoken = t = pp - 
+					lasttoken = t = pp -
 					    parsekwd + KWDOFFSET;
 					TRACE(("keyword %s recognized\n", tokname[t]));
Index: /trunk/src/ash/redir.c
===================================================================
--- /trunk/src/ash/redir.c	(revision 808)
+++ /trunk/src/ash/redir.c	(revision 809)
@@ -33,5 +33,7 @@
  */
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#endif
 #ifndef lint
 #if 0
Index: /trunk/src/ash/shell.h
===================================================================
--- /trunk/src/ash/shell.h	(revision 808)
+++ /trunk/src/ash/shell.h	(revision 809)
@@ -70,5 +70,7 @@
 #define MKINIT	/* empty */
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#endif
 
 extern char nullstr[1];		/* null string */
Index: /trunk/src/ash/show.c
===================================================================
--- /trunk/src/ash/show.c	(revision 808)
+++ /trunk/src/ash/show.c	(revision 809)
@@ -33,5 +33,7 @@
  */
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#endif
 #ifndef lint
 #if 0
Index: /trunk/src/ash/syntax.c
===================================================================
--- /trunk/src/ash/syntax.c	(revision 808)
+++ /trunk/src/ash/syntax.c	(revision 809)
@@ -1,3 +1,8 @@
 /*	$NetBSD: syntax.c,v 1.1 2004/01/17 17:38:12 dsl Exp $	*/
+
+#ifdef __sun__
+#include <stdio.h>
+#include <iso/limits_iso.h>
+#endif
 
 #include "shell.h"
Index: /trunk/src/ash/syntax.h
===================================================================
--- /trunk/src/ash/syntax.h	(revision 808)
+++ /trunk/src/ash/syntax.h	(revision 809)
@@ -33,5 +33,7 @@
  */
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#endif
 #include <ctype.h>
 
@@ -89,3 +91,3 @@
 extern const char arisyntax[];
 extern const char is_type[];
-#endif 
+#endif
Index: /trunk/src/ash/trap.c
===================================================================
--- /trunk/src/ash/trap.c	(revision 808)
+++ /trunk/src/ash/trap.c	(revision 809)
@@ -33,5 +33,7 @@
  */
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#endif
 #ifndef lint
 #if 0
@@ -64,5 +66,5 @@
 extern void init_sys_signame(void);
 extern char sys_signame[NSIG][16];
-#endif 
+#endif
 
 /*
@@ -84,4 +86,7 @@
 int pendingsigs;		/* indicates some signal received */
 
+#ifdef __sun__
+typedef void (*sig_t) (int);
+#endif
 static int getsigaction(int, sig_t *);
 
@@ -101,5 +106,5 @@
 	if (strcasecmp(p, "exit") == 0 )
 		return 0;
-	
+
 	if (strncasecmp(p, "sig", 3) == 0)
 		p += 3;
@@ -107,5 +112,5 @@
 #ifndef HAVE_SYS_SIGNAME
 	init_sys_signame();
-#endif 
+#endif
 	for (i = 0; i < NSIG; ++i)
 		if (strcasecmp (p, sys_signame[i]) == 0)
@@ -125,5 +130,5 @@
 #ifndef HAVE_SYS_SIGNAME
 	init_sys_signame();
-#endif 
+#endif
 
 	for (n = 1; n < NSIG; n++) {
@@ -148,5 +153,5 @@
 #ifndef HAVE_SYS_SIGNAME
 	init_sys_signame();
-#endif 
+#endif
 
 	if (argc <= 1) {
Index: /trunk/src/ash/var.c
===================================================================
--- /trunk/src/ash/var.c	(revision 808)
+++ /trunk/src/ash/var.c	(revision 809)
@@ -33,5 +33,7 @@
  */
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#endif
 #ifndef lint
 #if 0
@@ -45,5 +47,10 @@
 #include <stdlib.h>
 #include <strings.h>
+#ifndef __sun__
 #include <paths.h>
+#else
+#define _PATH_DEFPATH        "/usr/bin:/usr/sbin"
+#include <iso/limits_iso.h>
+#endif
 
 #ifdef PC_OS2_LIBPATHS
@@ -123,5 +130,5 @@
 #ifdef _MSC_VER
 struct var vpath2;
-#endif 
+#endif
 struct var vps1;
 struct var vps2;
@@ -155,5 +162,5 @@
 	{ &vpath2,	VSTRFIXED|VTEXTFIXED,		"Path=",
 	  changepath },
-#endif 
+#endif
 	/*
 	 * vps1 depends on uid
Index: /trunk/src/gmake/Makefile.kmk
===================================================================
--- /trunk/src/gmake/Makefile.kmk	(revision 808)
+++ /trunk/src/gmake/Makefile.kmk	(revision 809)
@@ -5,4 +5,74 @@
 include $(PATH_KBUILD)/header.kmk
 
+
+#
+# Template for kmk and the kmk_* binaries in this makefile.
+#
+TEMPLATE_BIN-KMK = Template for src/gmake binaries
+TEMPLATE_BIN-KMK_EXTENDS = BIN
+TEMPLATE_BIN-KMK_DEFS = HAVE_CONFIG_H $(TEMPLATE_BIN_DEFS)
+TEMPLATE_BIN-KMK_DEPS = $(PATH_TARGET)/config.h
+TEMPLATE_BIN-KMK_DEPS.solaris = \
+	$(PATH_TARGET)/fts.h \
+	$(PATH_TARGET)/paths.h
+TEMPLATE_BIN-KMK_DEPS.win     = \
+	$(PATH_TARGET)/fts.h \
+	$(PATH_TARGET)/sysexits.h \
+	$(PATH_TARGET)/unistd.h \
+	$(PATH_TARGET)/paths.h \
+	$(PATH_TARGET)/grp.h \
+	$(PATH_TARGET)/pwd.h \
+	$(PATH_TARGET)/inttypes.h
+TEMPLATE_BIN-KMK_INCS = $(PATH_TARGET) . $(TEMPLATE_BIN_INCS)
+TEMPLATE_BIN-KMK_INCS.darwin = glob
+TEMPLATE_BIN-KMK_INCS.freebsd = glob
+TEMPLATE_BIN-KMK_INCS.solaris = glob
+TEMPLATE_BIN-KMK_LIBS = $(TEMPLATE_BIN_LIBS) $(TARGET_kmkmissing)
+
+
+#
+# A library containing the missing features needed by kmk and the
+# kmk_* binaries. Saves a bit of work later on.
+#
+LIBRARIES += kmkmissing
+kmkmissing_TEMPLATE = BIN-KMK
+kmkmissing_NOINST = 1
+kmkmissing_SOURCES = \
+	kmkbuiltin/err.c \
+	kmkbuiltin/setmode.c \
+	kmkbuiltin/strmode.c \
+	kmkbuiltin/strlcpy.c
+
+kmkmissing_SOURCES.darwin = \
+	kmkbuiltin/darwin.c \
+	glob/glob.c \
+	glob/fnmatch.c
+
+kmkmissing_SOURCES.freebsd = \
+	glob/glob.c \
+	glob/fnmatch.c
+
+kmkmissing_SOURCES.solaris = \
+	kmkbuiltin/solfakes.c \
+	kmkbuiltin/fts.c \
+	glob/glob.c \
+	glob/fnmatch.c \
+	getopt.c \
+	getopt1.c
+
+kmkmissing_SOURCES.win += \
+	glob/glob.c \
+	glob/fnmatch.c \
+	getopt.c \
+	getopt1.c \
+	getloadavg.c \
+	w32/subproc/misc.c \
+	w32/subproc/sub_proc.c \
+	w32/subproc/w32err.c \
+	w32/compat/dirent.c \
+	w32/pathstuff.c \
+	kmkbuiltin/mscfakes.c \
+	kmkbuiltin/fts.c
+
 #
 # kmk
@@ -10,16 +80,14 @@
 PROGRAMS += kmk
 
-kmk_TEMPLATE = BIN
-kmk_DEPS = $(PATH_TARGET)/config.h
-kmk_INCS = $(PATH_TARGET) .
-kmk_INCS.darwin = glob
-kmk_INCS.freebsd = glob
-#ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
-#kmk_INCS += kmkbuiltin/w32
-#endif
+kmk_TEMPLATE = BIN-KMK
 
 kmk_DEFS = \
-	HAVE_CONFIG_H \
 	NO_ARCHIVES \
+	EXPERIMENTAL \
+	CONFIG_WITH_TOUPPER_TOLOWER \
+	\
+	KMK \
+	KMK_HELPERS \
+	VARIABLE_HASH \
 	CONFIG_NO_DEFAULT_SUFFIXES \
 	CONFIG_NO_DEFAULT_PATTERN_RULES	\
@@ -29,22 +97,17 @@
 	CONFIG_WITH_EXTENDED_NOTPARALLEL \
 	CONFIG_WITH_INCLUDEDEP \
-	CONFIG_WITH_TOUPPER_TOLOWER \
-	CONFIG_WITH_ABSPATHEX \
-	CONFIG_PRETTY_COMMAND_PRINTING \
-	KMK \
-	\
-	KMK_HELPERS \
-	VARIABLE_HASH \
 	CONFIG_WITH_OPTIMIZATION_HACKS \
 	CONFIG_WITH_VALUE_LENGTH \
+	CONFIG_WITH_ABSPATHEX \
 	CONFIG_WITH_COMPARE \
 	CONFIG_WITH_STACK \
 	CONFIG_WITH_MATH \
-	EXPERIMENTAL \
+	CONFIG_PRETTY_COMMAND_PRINTING \
 	\
 	BUILD_PLATFORM=\"$(BUILD_TARGET)\" \
 	BUILD_PLATFORM_ARCH=\"$(BUILD_TARGET_ARCH)\" \
 	BUILD_PLATFORM_CPU=\"$(BUILD_TARGET_CPU)\"
-kmk_DEFS.win = CONFIG_NEW_WIN32_CTRL_EVENT
+kmk_DEFS.win = \
+	CONFIG_NEW_WIN32_CTRL_EVENT
 
 kmk_SOURCES = \
@@ -73,26 +136,4 @@
 	kbuild.c
 
-ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
-kmk_SOURCES += \
-	getopt.c \
-	getopt1.c \
-	getloadavg.c \
-	w32/subproc/misc.c \
-	w32/subproc/sub_proc.c \
-	w32/subproc/w32err.c \
-	glob/glob.c \
-	glob/fnmatch.c \
-	w32/compat/dirent.c \
-	w32/pathstuff.c
-endif
-
-kmk_SOURCES.freebsd = \
-	glob/glob.c \
-	glob/fnmatch.c
-
-kmk_SOURCES.darwin = \
-	glob/glob.c \
-	glob/fnmatch.c
-
 #
 # kmkbuiltin commands
@@ -113,18 +154,4 @@
 	kmkbuiltin/rm.c \
 	kmkbuiltin/rmdir.c \
-	\
-	kmkbuiltin/err.c \
-	kmkbuiltin/setmode.c \
-	kmkbuiltin/strmode.c \
-	kmkbuiltin/strlcpy.c
-
-ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
-kmk_SOURCES += \
-	kmkbuiltin/mscfakes.c \
-	kmkbuiltin/fts.c
-endif
-
-kmk_SOURCES.darwin += \
-	kmkbuiltin/darwin.c
 
 
@@ -132,161 +159,63 @@
 # Standalone kmkbuiltin commands.
 #
+## @todo should probably put all those
 PROGRAMS += kmk_append kmk_cat kmk_cp kmk_echo kmk_mkdir kmk_mv kmk_install kmk_ln kmk_printf kmk_rm kmk_rmdir
 
-kmk_append_TEMPLATE = BIN
+kmk_append_TEMPLATE = BIN-KMK
 kmk_append_DEFS = kmk_builtin_append=main
 kmk_append_INCS = .
 kmk_append_SOURCES = \
-	kmkbuiltin/append.c \
-	kmkbuiltin/err.c
-
-kmk_cat_TEMPLATE = BIN
+	kmkbuiltin/append.c
+
+kmk_cat_TEMPLATE = BIN-KMK
 kmk_cat_DEFS = kmk_builtin_cat=main
 kmk_cat_SOURCES = \
-	kmkbuiltin/cat.c \
-	kmkbuiltin/err.c
-ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
-kmk_cat_INCS += $(PATH_TARGET) .
-kmk_cat_DEFS += HAVE_CONFIG_H
-kmk_cat_SOURCES += \
-	kmkbuiltin/mscfakes.c \
-	getopt.c \
-	getopt1.c
-endif
-
-kmk_cp_TEMPLATE = BIN
+	kmkbuiltin/cat.c
+
+kmk_cp_TEMPLATE = BIN-KMK
 kmk_cp_DEFS = kmk_builtin_cp=main
 kmk_cp_SOURCES = \
 	kmkbuiltin/cp.c \
-	kmkbuiltin/cp_utils.c \
-	kmkbuiltin/strlcpy.c \
-	kmkbuiltin/err.c
-ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
-kmk_cp_INCS += $(PATH_TARGET) .
-kmk_cp_DEFS += HAVE_CONFIG_H
-kmk_cp_SOURCES += \
-	kmkbuiltin/mscfakes.c \
-	kmkbuiltin/fts.c \
-	w32/compat/dirent.c \
-	getopt.c \
-	getopt1.c
-endif
-kmk_cp_SOURCES.darwin = \
-	kmkbuiltin/darwin.c
-
-kmk_echo_TEMPLATE = BIN
+	kmkbuiltin/cp_utils.c
+
+kmk_echo_TEMPLATE = BIN-KMK
 kmk_echo_DEFS = kmk_builtin_echo=main
 kmk_echo_SOURCES = \
 	kmkbuiltin/echo.c
-ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
-kmk_echo_SOURCES += \
-	kmkbuiltin/mscfakes.c \
-	kmkbuiltin/err.c
-endif
-
-kmk_install_TEMPLATE = BIN
+
+kmk_install_TEMPLATE = BIN-KMK
 kmk_install_DEFS = kmk_builtin_install=main
 kmk_install_SOURCES = \
-	kmkbuiltin/install.c \
-	kmkbuiltin/err.c \
-	kmkbuiltin/strmode.c \
-	kmkbuiltin/setmode.c
-ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
-kmk_install_INCS += $(PATH_TARGET) .
-kmk_install_DEFS += HAVE_CONFIG_H
-kmk_install_SOURCES += \
-	kmkbuiltin/mscfakes.c \
-	getopt.c \
-	getopt1.c
-endif
-
-kmk_ln_TEMPLATE = BIN
+	kmkbuiltin/install.c
+
+kmk_ln_TEMPLATE = BIN-KMK
 kmk_ln_DEFS = kmk_builtin_ln=main
 kmk_ln_SOURCES = \
-	kmkbuiltin/ln.c \
-	kmkbuiltin/err.c
-ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
-kmk_ln_INCS += $(PATH_TARGET) .
-kmk_ln_DEFS += HAVE_CONFIG_H
-kmk_ln_SOURCES += \
-	kmkbuiltin/mscfakes.c\
-	getopt.c \
-	getopt1.c
-endif
-
-kmk_mkdir_TEMPLATE = BIN
+	kmkbuiltin/ln.c
+
+kmk_mkdir_TEMPLATE = BIN-KMK
 kmk_mkdir_DEFS = kmk_builtin_mkdir=main
 kmk_mkdir_SOURCES = \
-	kmkbuiltin/mkdir.c \
-	kmkbuiltin/err.c \
-	kmkbuiltin/setmode.c
-ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
-kmk_mkdir_INCS += $(PATH_TARGET) .
-kmk_mkdir_DEFS += HAVE_CONFIG_H
-kmk_mkdir_SOURCES += \
-	kmkbuiltin/mscfakes.c \
-	getopt.c \
-	getopt1.c
-endif
-
-kmk_mv_TEMPLATE = BIN
+	kmkbuiltin/mkdir.c
+
+kmk_mv_TEMPLATE = BIN-KMK
 kmk_mv_DEFS = kmk_builtin_mv=main
 kmk_mv_SOURCES = \
-	kmkbuiltin/mv.c \
-	kmkbuiltin/err.c \
-	kmkbuiltin/strmode.c
-ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
-kmk_mv_INCS += $(PATH_TARGET) .
-kmk_mv_DEFS += HAVE_CONFIG_H
-kmk_mv_SOURCES += \
-	kmkbuiltin/mscfakes.c \
-	getopt.c \
-	getopt1.c
-endif
-
-kmk_printf_TEMPLATE = BIN
+	kmkbuiltin/mv.c
+
+kmk_printf_TEMPLATE = BIN-KMK
 kmk_printf_DEFS = kmk_builtin_printf=main
 kmk_printf_SOURCES = \
-	kmkbuiltin/printf.c \
-	kmkbuiltin/err.c
-ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
-kmk_printf_INCS += $(PATH_TARGET) .
-kmk_printf_DEFS += HAVE_CONFIG_H
-kmk_printf_SOURCES += \
-	kmkbuiltin/mscfakes.c \
-	getopt.c \
-	getopt1.c
-endif
-
-kmk_rm_TEMPLATE = BIN
+	kmkbuiltin/printf.c
+
+kmk_rm_TEMPLATE = BIN-KMK
 kmk_rm_DEFS = kmk_builtin_rm=main
 kmk_rm_SOURCES = \
-	kmkbuiltin/rm.c \
-	kmkbuiltin/err.c \
-	kmkbuiltin/strmode.c
-ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
-kmk_rm_INCS += $(PATH_TARGET) .
-kmk_rm_DEFS += HAVE_CONFIG_H
-kmk_rm_SOURCES += \
-	kmkbuiltin/mscfakes.c\
-	getopt.c \
-	getopt1.c
-endif
-
-kmk_rmdir_TEMPLATE = BIN
+	kmkbuiltin/rm.c
+
+kmk_rmdir_TEMPLATE = BIN-KMK
 kmk_rmdir_DEFS = kmk_builtin_rmdir=main
 kmk_rmdir_SOURCES = \
-	kmkbuiltin/rmdir.c \
-	kmkbuiltin/err.c \
-	kmkbuiltin/setmode.c
-ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
-kmk_rmdir_INCS += $(PATH_TARGET) .
-kmk_rmdir_DEFS += HAVE_CONFIG_H
-kmk_rmdir_SOURCES += \
-	kmkbuiltin/mscfakes.c \
-	getopt.c \
-	getopt1.c
-endif
-
+	kmkbuiltin/rmdir.c
 
 
@@ -295,11 +224,6 @@
 #
 PROGRAMS += kmk_gmake
-kmk_gmake_TEMPLATE = BIN
-kmk_gmake_DEPS = $(PATH_TARGET)/config.h
-kmk_gmake_INCS = $(PATH_TARGET) .
-kmk_gmake_INCS.darwin = glob
-kmk_gmake_INCS.freebsd = glob
-
-
+
+kmk_gmake_TEMPLATE = BIN-KMK
 kmk_gmake_DEFS = \
 	HAVE_CONFIG_H \
@@ -332,27 +256,4 @@
 	remote-stub.c
 
-ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
-kmk_gmake_SOURCES += \
-	getopt.c \
-	getopt1.c \
-	getloadavg.c \
-	w32/subproc/misc.c \
-	w32/subproc/sub_proc.c \
-	w32/subproc/w32err.c \
-	glob/glob.c \
-	glob/fnmatch.c \
-	w32/compat/dirent.c \
-	w32/pathstuff.c
-endif
-
-kmk_gmake_SOURCES.freebsd = \
-	glob/glob.c \
-	glob/fnmatch.c
-
-kmk_gmake_SOURCES.darwin = \
-	glob/glob.c \
-	glob/fnmatch.c
-
-
 
 include $(PATH_KBUILD)/footer.kmk
@@ -364,11 +265,32 @@
 config.h.$(BUILD_TARGET) := config.h.$(BUILD_TARGET)
 config.h.win   := config.h.W32
-config.h.win32 := config.h.W32
-config.h.win64 := config.h.W32
-config.h.nt    := config.h.W32
 
 $(PATH_TARGET)/config.h: $(config.h.$(BUILD_TARGET))
 	$(MKDIR) -p $(dir $@)
 	$(CP) $^ $@
+
+#
+# Some missing headers.
+#
+$(PATH_TARGET)/fts.h: kmkbuiltin/ftsfake.h | $(call DIRDEP,$(PATH_TARGET))
+	$(CP) $^ $@
+
+$(PATH_TARGET)/unistd.h: | $(call DIRDEP,$(PATH_TARGET))
+	$(ECHO_EXT) > $@
+
+$(PATH_TARGET)/sysexits.h: | $(call DIRDEP,$(PATH_TARGET))
+	$(ECHO_EXT) > $@
+
+$(PATH_TARGET)/inttypes.h: | $(call DIRDEP,$(PATH_TARGET))
+	$(ECHO_EXT) > $@
+
+$(PATH_TARGET)/paths.h: | $(call DIRDEP,$(PATH_TARGET))
+	$(ECHO_EXT) > $@
+
+$(PATH_TARGET)/pwd.h: | $(call DIRDEP,$(PATH_TARGET))
+	$(ECHO_EXT) > $@
+
+$(PATH_TARGET)/grp.h: | $(call DIRDEP,$(PATH_TARGET))
+	$(ECHO_EXT) > $@
 
 
@@ -430,2 +352,3 @@
 
 test_all:	test_math test_stack test_shell
+
Index: /trunk/src/gmake/config.h.solaris
===================================================================
--- /trunk/src/gmake/config.h.solaris	(revision 809)
+++ /trunk/src/gmake/config.h.solaris	(revision 809)
@@ -0,0 +1,447 @@
+/* config.h.  Generated by configure.  */
+/* config.h.in.  Generated from configure.in by autoheader.  */
+
+/* Define to 1 if the `closedir' function returns void instead of `int'. */
+/* #undef CLOSEDIR_VOID */
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+   systems. This function is required for `alloca.c' support on those systems.
+   */
+/* #undef CRAY_STACKSEG_END */
+
+/* Define to 1 if using `alloca.c'. */
+/* #undef C_ALLOCA */
+
+/* Define to 1 if using `getloadavg.c'. */
+/* #undef C_GETLOADAVG */
+
+/* Define to 1 for DGUX with <sys/dg_sys_info.h>. */
+/* #undef DGUX */
+
+/* Define to 1 if translation of program messages to the user's native
+   language is requested. */
+/* #undef ENABLE_NLS */
+
+/* Use high resolution file timestamps if nonzero. */
+#define FILE_TIMESTAMP_HI_RES 1
+
+/* Define to 1 if the `getloadavg' function needs to be run setuid or setgid.
+   */
+/* #undef GETLOADAVG_PRIVILEGED */
+
+/* Define to 1 if you have `alloca', as a function or macro. */
+#define HAVE_ALLOCA 1
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+   */
+#define HAVE_ALLOCA_H 1
+
+/* Define if your compiler conforms to the ANSI C standard. */
+#define HAVE_ANSI_COMPILER 1
+
+/* Define to 1 if you have the `atexit' function. */
+#define HAVE_ATEXIT 1
+
+/* Define to 1 if you have the `bsd_signal' function. */
+#define HAVE_BSD_SIGNAL 1
+
+/* Use case insensitive file names */
+/* #undef HAVE_CASE_INSENSITIVE_FS */
+
+/* Define if you have the clock_gettime function. */
+#define HAVE_CLOCK_GETTIME 1
+
+/* Define if the GNU dcgettext() function is already present or preinstalled.
+   */
+/* #undef HAVE_DCGETTEXT */
+
+/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
+   don't. */
+#define HAVE_DECL_SYS_SIGLIST 0
+
+/* Define to 1 if you have the declaration of `_sys_siglist', and to 0 if you
+   don't. */
+#define HAVE_DECL__SYS_SIGLIST 1
+
+/* Define to 1 if you have the declaration of `__sys_siglist', and to 0 if you
+   don't. */
+#define HAVE_DECL___SYS_SIGLIST 0
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+   */
+#define HAVE_DIRENT_H 1
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+#define HAVE_DOPRNT 1
+
+/* Use platform specific coding */
+/* #undef HAVE_DOS_PATHS */
+
+/* Define to 1 if you have the `dup2' function. */
+#define HAVE_DUP2 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the `fdopen' function. */
+#define HAVE_FDOPEN 1
+
+/* Define to 1 if you have the `fork' function. */
+#define HAVE_FORK 1
+
+/* Define to 1 if you have the `getcwd' function. */
+#define HAVE_GETCWD 1
+
+/* Define to 1 if you have the `getgroups' function. */
+#define HAVE_GETGROUPS 1
+
+/* Define to 1 if you have the `gethostbyname' function. */
+/* #undef HAVE_GETHOSTBYNAME */
+
+/* Define to 1 if you have the `gethostname' function. */
+/* #undef HAVE_GETHOSTNAME */
+
+/* Define to 1 if you have the `getloadavg' function. */
+#define HAVE_GETLOADAVG 1
+
+/* Define to 1 if you have the `getrlimit' function. */
+#define HAVE_GETRLIMIT 1
+
+/* Define if the GNU gettext() function is already present or preinstalled. */
+/* #undef HAVE_GETTEXT */
+
+/* Define if you have a standard gettimeofday function */
+#define HAVE_GETTIMEOFDAY 1
+
+/* Define if you have the iconv() function. */
+/* #undef HAVE_ICONV */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `dgc' library (-ldgc). */
+/* #undef HAVE_LIBDGC */
+
+/* Define to 1 if you have the `kstat' library (-lkstat). */
+#define HAVE_LIBKSTAT 1
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the <locale.h> header file. */
+#define HAVE_LOCALE_H 1
+
+/* Define to 1 if you have the `lstat' function. */
+#define HAVE_LSTAT 1
+
+/* Define to 1 if you have the <mach/mach.h> header file. */
+/* #undef HAVE_MACH_MACH_H */
+
+/* Define to 1 if you have the `memcpy' function. */
+#define HAVE_MEMCPY 1
+
+/* Define to 1 if you have the `memmove' function. */
+#define HAVE_MEMMOVE 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mkstemp' function. */
+#define HAVE_MKSTEMP 1
+
+/* Define to 1 if you have the `mktemp' function. */
+#define HAVE_MKTEMP 1
+
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+/* #undef HAVE_NDIR_H */
+
+/* Define to 1 if you have the <nlist.h> header file. */
+/* #undef HAVE_NLIST_H */
+
+/* Define to 1 if you have the `pipe' function. */
+#define HAVE_PIPE 1
+
+/* Define to 1 if you have the `pstat_getdynamic' function. */
+/* #undef HAVE_PSTAT_GETDYNAMIC */
+
+/* Define to 1 if you have the `readlink' function. */
+#define HAVE_READLINK 1
+
+/* Define to 1 if you have the `realpath' function. */
+#define HAVE_REALPATH 1
+
+/* Define if <signal.h> defines the SA_RESTART constant. */
+#define HAVE_SA_RESTART 1
+
+/* Define to 1 if you have the `setegid' function. */
+#define HAVE_SETEGID 1
+
+/* Define to 1 if you have the `seteuid' function. */
+#define HAVE_SETEUID 1
+
+/* Define to 1 if you have the `setlinebuf' function. */
+#define HAVE_SETLINEBUF 1
+
+/* Define to 1 if you have the `setlocale' function. */
+/* #undef HAVE_SETLOCALE */
+
+/* Define to 1 if you have the `setregid' function. */
+#define HAVE_SETREGID 1
+
+/* Define to 1 if you have the `setreuid' function. */
+#define HAVE_SETREUID 1
+
+/* Define to 1 if you have the `setrlimit' function. */
+#define HAVE_SETRLIMIT 1
+
+/* Define to 1 if you have the `setvbuf' function. */
+#define HAVE_SETVBUF 1
+
+/* Define to 1 if you have the `sigaction' function. */
+#define HAVE_SIGACTION 1
+
+/* Define to 1 if you have the `sigsetmask' function. */
+/* #undef HAVE_SIGSETMASK */
+
+/* Define to 1 if you have the `socket' function. */
+/* #undef HAVE_SOCKET */
+
+/* Define to 1 if you have the <stdarg.h> header file. */
+#define HAVE_STDARG_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strcasecmp' function. */
+/* #undef HAVE_STRCASECMP */
+
+/* Define to 1 if you have the `strchr' function. */
+#define HAVE_STRCHR 1
+
+/* Define to 1 if you have the `strcoll' function and it is properly defined.
+   */
+#define HAVE_STRCOLL 1
+
+/* Define to 1 if you have the `strdup' function. */
+#define HAVE_STRDUP 1
+
+/* Define to 1 if you have the `strerror' function. */
+#define HAVE_STRERROR 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strsignal' function. */
+#define HAVE_STRSIGNAL 1
+
+/* Define to 1 if `n_un.n_name' is member of `struct nlist'. */
+/* #undef HAVE_STRUCT_NLIST_N_UN_N_NAME */
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+   */
+/* #undef HAVE_SYS_DIR_H */
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+   */
+/* #undef HAVE_SYS_NDIR_H */
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/resource.h> header file. */
+#define HAVE_SYS_RESOURCE_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/timeb.h> header file. */
+#define HAVE_SYS_TIMEB_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/wait.h> header file. */
+#define HAVE_SYS_WAIT_H 1
+
+/* Define this if you have the \`union wait' type in <sys/wait.h>. */
+/* #undef HAVE_UNION_WAIT */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the <varargs.h> header file. */
+/* #undef HAVE_VARARGS_H */
+
+/* Define to 1 if you have the `vfork' function. */
+#define HAVE_VFORK 1
+
+/* Define to 1 if you have the <vfork.h> header file. */
+/* #undef HAVE_VFORK_H */
+
+/* Define to 1 if you have the `vprintf' function. */
+#define HAVE_VPRINTF 1
+
+/* Define to 1 if you have the `wait3' function. */
+#define HAVE_WAIT3 1
+
+/* Define to 1 if you have the `waitpid' function. */
+#define HAVE_WAITPID 1
+
+/* Define to 1 if `fork' works. */
+#define HAVE_WORKING_FORK 1
+
+/* Define to 1 if `vfork' works. */
+#define HAVE_WORKING_VFORK 1
+
+/* Build host information. */
+#define MAKE_HOST "i386-pc-solaris2.11"
+
+/* Define this to enable job server support in GNU make. */
+#define MAKE_JOBSERVER 1
+
+/* Define this to enable symbolic link timestamp checking. */
+#define MAKE_SYMLINKS 1
+
+/* Define to 1 if your `struct nlist' has an `n_un' member. Obsolete, depend
+   on `HAVE_STRUCT_NLIST_N_UN_N_NAME */
+/* #undef NLIST_NAME_UNION */
+
+/* Define if struct nlist.n_name is a pointer rather than an array. */
+/* #undef NLIST_STRUCT */
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+/* #undef NO_MINUS_C_MINUS_O */
+
+/* Name of package */
+#define PACKAGE "make"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "bug-make@gnu.org"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "GNU make"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "GNU make 3.81"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "make"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "3.81"
+
+/* Define to 1 if the C compiler supports function prototypes. */
+#define PROTOTYPES 1
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#define RETSIGTYPE void
+
+/* Define to the name of the SCCS 'get' command. */
+#define SCCS_GET "get"
+
+/* Define this if the SCCS 'get' command understands the '-G<file>' option. */
+#define SCCS_GET_MINUS_G 1
+
+/* Define to 1 if the `setvbuf' function takes the buffering type as its
+   second argument and the buffer pointer as the third, as on System V before
+   release 3. */
+/* #undef SETVBUF_REVERSED */
+
+/* If using the C implementation of alloca, define if you know the
+   direction of stack growth for your system; otherwise it will be
+   automatically deduced at run-time.
+	STACK_DIRECTION > 0 => grows toward higher addresses
+	STACK_DIRECTION < 0 => grows toward lower addresses
+	STACK_DIRECTION = 0 => direction of growth unknown */
+/* #undef STACK_DIRECTION */
+
+/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
+/* #undef STAT_MACROS_BROKEN */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define if struct stat contains a nanoseconds field */
+#define ST_MTIM_NSEC tv_nsec
+
+/* Define to 1 on System V Release 4. */
+/* #undef SVR4 */
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Define to 1 for Encore UMAX. */
+/* #undef UMAX */
+
+/* Define to 1 for Encore UMAX 4.3 that has <inq_status/cpustats.h> instead of
+   <sys/cpustats.h>. */
+/* #undef UMAX4_3 */
+
+/* Version number of package */
+#define VERSION "3.81"
+
+/* Use platform specific coding */
+/* #undef WINDOWS32 */
+
+/* Define if using the dmalloc debugging malloc package */
+/* #undef WITH_DMALLOC */
+
+/* Define to 1 if on AIX 3.
+   System headers sometimes define this.
+   We just want to avoid a redefinition error message.  */
+#ifndef _ALL_SOURCE
+/* # undef _ALL_SOURCE */
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #define _FILE_OFFSET_BITS 64 */
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+/* Define to 1 if on MINIX. */
+/* #undef _MINIX */
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+/* #undef _POSIX_1_SOURCE */
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+/* #undef _POSIX_SOURCE */
+
+/* Define like PROTOTYPES; this can be used by system headers. */
+#define __PROTOTYPES 1
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+/* #undef gid_t */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef pid_t */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+/* #undef uid_t */
+
+/* Define uintmax_t if not defined in <stdint.h> or <inttypes.h>. */
+/* #undef uintmax_t */
+
+/* Define as `fork' if `vfork' does not work. */
+/* #undef vfork */
+
+/* manually additions:  */
+#define LOCALEDIR ""
+#define LIBDIR ""
+#define INCLUDEDIR ""
+#define ALIASPATH ""
+
Index: /trunk/src/gmake/kmkbuiltin/cat.c
===================================================================
--- /trunk/src/gmake/kmkbuiltin/cat.c	(revision 808)
+++ /trunk/src/gmake/kmkbuiltin/cat.c	(revision 809)
@@ -49,14 +49,14 @@
 #else
 #define NO_UDOM_SUPPORT /* kmk */
-#endif 
+#endif
 
 #ifndef _MSC_VER
-#include <sys/param.h>
+# include <sys/param.h>
 #endif
 #include <sys/stat.h>
 #ifndef NO_UDOM_SUPPORT
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <errno.h>
+# include <sys/socket.h>
+# include <sys/un.h>
+# include <errno.h>
 #endif
 
@@ -68,10 +68,13 @@
 #include <stdlib.h>
 #include <string.h>
-#ifndef _MSC_VER
 #include <unistd.h>
-#else
-#include "mscfakes.h"
-#endif 
 #include <stddef.h>
+
+#ifdef __sun__
+# include "solfakes.h"
+#endif
+#ifdef _MSC_VER
+# include "mscfakes.h"
+#endif
 
 int bflag, eflag, nflag, sflag, tflag, vflag;
@@ -111,5 +114,5 @@
 #ifdef kmk_builtin_cat /* kmk did this already. */
 	setlocale(LC_CTYPE, "");
-#endif 
+#endif
 
 	while ((ch = getopt(argc, argv, "benstuv")) != -1)
@@ -285,5 +288,5 @@
 #else
 		bsize = MAX(sbuf.st_blksize, 1024);
-#endif 
+#endif
 		if ((buf = malloc(bsize)) == NULL)
 			return err(1, "buffer");
Index: /trunk/src/gmake/kmkbuiltin/cp.c
===================================================================
--- /trunk/src/gmake/kmkbuiltin/cp.c	(revision 808)
+++ /trunk/src/gmake/kmkbuiltin/cp.c	(revision 809)
@@ -65,7 +65,5 @@
 #include "err.h"
 #include <errno.h>
-#ifndef _MSC_VER
 #include <fts.h>
-#endif
 #include <limits.h>
 #include <signal.h>
@@ -73,9 +71,8 @@
 #include <stdlib.h>
 #include <string.h>
-#ifndef _MSC_VER
 #include <unistd.h>
-#else
-#include "mscfakes.h"
-#include "ftsfake.h"
+
+#ifdef _MSC_VER
+# include "mscfakes.h"
 #endif
 
@@ -471,5 +468,5 @@
 				if (copy_file(curr, dne))
 					badcp = rval = 1;
-			} else {	
+			} else {
 				if (copy_link(curr, !dne))
 					badcp = rval = 1;
Index: /trunk/src/gmake/kmkbuiltin/cp_utils.c
===================================================================
--- /trunk/src/gmake/kmkbuiltin/cp_utils.c	(revision 808)
+++ /trunk/src/gmake/kmkbuiltin/cp_utils.c	(revision 809)
@@ -37,9 +37,9 @@
 
 #ifndef _MSC_VER
-#include <sys/param.h>
-#endif 
+# include <sys/param.h>
+#endif
 #include <sys/stat.h>
 #ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED
-#include <sys/mman.h>
+# include <sys/mman.h>
 #endif
 
@@ -47,18 +47,18 @@
 #include <errno.h>
 #include <fcntl.h>
-#ifndef _MSC_VER
 #include <fts.h>
-#endif
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <signal.h>
-#ifndef _MSC_VER
 #include <sysexits.h>
 #include <unistd.h>
-#else
-#include "mscfakes.h"
-#include "ftsfake.h"
-#endif 
+
+#ifdef __sun__
+# include "solfakes.h"
+#endif
+#ifdef _MSC_VER
+# include "mscfakes.h"
+#endif
 
 #include "cp_extern.h"
@@ -74,5 +74,5 @@
 #ifndef S_ISVTX
 # define S_ISVTX 0
-#endif 
+#endif
 
 int
@@ -123,5 +123,5 @@
 			}
 		}
-		
+
 		if (fflag) {
 		    /* remove existing destination file name,
@@ -169,5 +169,5 @@
 						entp->fts_path, to.p_path,
 						cp_pct(wtotal, fs->st_size));
-						
+
 				}
 				if (wcount >= (ssize_t)wresid || wcount <= 0)
@@ -199,5 +199,5 @@
 						entp->fts_path, to.p_path,
 						cp_pct(wtotal, fs->st_size));
-						
+
 				}
 				if (wcount >= (ssize_t)wresid || wcount <= 0)
Index: /trunk/src/gmake/kmkbuiltin/fts.c
===================================================================
--- /trunk/src/gmake/kmkbuiltin/fts.c	(revision 808)
+++ /trunk/src/gmake/kmkbuiltin/fts.c	(revision 809)
@@ -56,14 +56,19 @@
 #include <stdlib.h>
 #include <string.h>
-#ifndef _MSC_VER
 #include <unistd.h>
-#else
-#include "mscfakes.h"
-#define dirfd(dir) -1
-#endif 
-#include "ftsfake.h"
+
+#ifdef __sun__
+# include "solfakes.h"
+# define dirfd(dir) -1
+#endif
+#ifdef _MSC_VER
+# include "mscfakes.h"
+# define dirfd(dir) -1
+#endif
 
 #if ! HAVE_NBTOOL_CONFIG_H
+#ifndef __sun__
 #define HAVE_STRUCT_DIRENT_D_NAMLEN 1
+#endif
 #endif
 
@@ -78,5 +83,5 @@
 #endif /* __LIBC12_SOURCE__ */
 #endif /* __weak_alias */
-#endif 
+#endif
 
 #ifdef __LIBC12_SOURCE__
@@ -120,5 +125,5 @@
 #undef HAVE_STRUCT_DIRENT_D_NAMLEN
 #undef HAVE_FCHDIR
-#endif 
+#endif
 
 #if defined(__EMX__) || defined(_MSC_VER)
@@ -268,5 +273,5 @@
 		if ((sp->fts_rdir = getcwd(NULL, 0)) != NULL)
 			SET(FTS_NOCHDIR);
-#endif 
+#endif
 	}
 
@@ -374,7 +379,7 @@
 		if (chdir(sp->fts_rdir))
 			saved_errno =  errno;
-        free(sp->fts_rdir); 
+        free(sp->fts_rdir);
 		sp->fts_rdir = NULL;
-#endif 
+#endif
 	}
 
@@ -467,5 +472,5 @@
 			p->fts_info = FTS_DP;
 			return (p);
-		} 
+		}
 
 		/* Rebuild if only read the names and now traversing. */
@@ -520,5 +525,5 @@
 #else
 			if (CHDIR(sp, sp->fts_rdir)) {
-#endif 
+#endif
 				SET(FTS_STOP);
 				return (NULL);
@@ -587,5 +592,5 @@
 #else
 		if (CHDIR(sp, sp->fts_rdir)) {
-#endif 
+#endif
 			SET(FTS_STOP);
 			return (NULL);
@@ -691,5 +696,5 @@
 		SET(FTS_NAMEONLY);
 		instr = BNAMES;
-	} else 
+	} else
 		instr = BCHILD;
 
@@ -913,5 +918,5 @@
 		} else if (nlinks == 0
 #ifdef DT_DIR
-		    || (nostat && 
+		    || (nostat &&
 		    dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN)
 #endif
@@ -979,5 +984,5 @@
 #else
 	    CHDIR(sp, sp->fts_rdir) :
-#endif 
+#endif
 	    fts_safe_changedir(sp, cur->fts_parent, -1, ".."))) {
 		cur->fts_info = FTS_ERR;
@@ -1039,5 +1044,5 @@
 				errno = 0;
 				return (FTS_SLNONE);
-			} 
+			}
 			p->fts_errno = saved_errno;
 			goto err;
@@ -1114,5 +1119,5 @@
 	for (ap = sp->fts_array, p = head; p; p = p->fts_link)
 		*ap++ = p;
-	qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *), 
+	qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *),
 		(int (*)(const void *, const void *))sp->fts_compar);
 	for (head = *(ap = sp->fts_array); --nitems; ++ap)
@@ -1222,5 +1227,5 @@
  * Most systems will allow creation of paths much longer than MAXPATHLEN, even
  * though the kernel won't resolve them.  Round up the new size to a power of 2,
- * so we don't realloc the path 2 bytes at a time. 
+ * so we don't realloc the path 2 bytes at a time.
  */
 static int
Index: /trunk/src/gmake/kmkbuiltin/ftsfake.h
===================================================================
--- /trunk/src/gmake/kmkbuiltin/ftsfake.h	(revision 808)
+++ /trunk/src/gmake/kmkbuiltin/ftsfake.h	(revision 809)
@@ -35,4 +35,8 @@
 #define	_FTS_H_
 
+#ifdef _MSC_VER
+# include "kmkbuiltin/mscfakes.h"
+#endif
+
 typedef struct {
 	struct _ftsent *fts_cur;	/* current node */
@@ -60,5 +64,5 @@
 #ifndef _MSC_VER
 #define	FTS_WHITEOUT	0x080		/* return whiteout information */
-#endif 
+#endif
 #define	FTS_OPTIONMASK	0x0ff		/* valid user option mask */
 
@@ -79,5 +83,5 @@
 #ifndef _MSC_VER
 	int fts_symfd;			/* fd for symlink */
-#endif 
+#endif
 	u_short fts_pathlen;		/* strlen(fts_path) */
 	u_short fts_namelen;		/* strlen(fts_name) */
@@ -92,5 +96,5 @@
 #else
 	int fts_nlink;		/* link count */
-#endif 
+#endif
 #endif
 
@@ -121,5 +125,5 @@
 #ifndef _MSC_VER
 #define	FTS_ISW		 0x04		/* this is a whiteout object */
-#endif 
+#endif
 	u_short fts_flags;		/* private flags for FTSENT structure */
 
@@ -138,12 +142,14 @@
 } FTSENT;
 
+#ifndef __sun__
 #ifndef _MSC_VER
 #include <sys/cdefs.h>
 __BEGIN_DECLS
 #else
-#define __RENAME(a) 
-#endif 
+#define __RENAME(a)
+#endif
+#endif
 
-#ifdef __LIBC12_SOURCE__
+#if defined(__LIBC12_SOURCE__) || defined(__sun__)
 FTSENT	*fts_children(FTS *, int);
 int	 fts_close(FTS *);
@@ -162,7 +168,9 @@
 #endif
 
+#ifndef __sun__
 #ifndef _MSC_VER
 __END_DECLS
 #endif
+#endif
 
 #endif /* !_FTS_H_ */
Index: /trunk/src/gmake/kmkbuiltin/install.c
===================================================================
--- /trunk/src/gmake/kmkbuiltin/install.c	(revision 808)
+++ /trunk/src/gmake/kmkbuiltin/install.c	(revision 809)
@@ -48,12 +48,12 @@
 
 #ifndef _MSC_VER
-#include <sys/param.h>
-#ifdef USE_MMAP
-#include <sys/mman.h>
-#endif
-#include <sys/mount.h>
-#include <sys/wait.h>
-#include <sys/time.h>
-#endif
+# include <sys/param.h>
+# ifdef USE_MMAP
+#  include <sys/mman.h>
+# endif
+# include <sys/mount.h>
+# include <sys/wait.h>
+# include <sys/time.h>
+#endif /* !_MSC_VER */
 #include <sys/stat.h>
 
@@ -62,20 +62,21 @@
 #include <errno.h>
 #include <fcntl.h>
-#ifndef _MSC_VER
 #include <grp.h>
 #include <paths.h>
 #include <pwd.h>
-#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#ifndef _MSC_VER
 #include <sysexits.h>
 #include <unistd.h>
-#else
-#include "mscfakes.h"
-#endif
 #if defined(__EMX__) || defined(_MSC_VER)
 # include <process.h>
+#endif
+
+#ifdef __sun__
+# include "solfakes.h"
+#endif
+#ifdef _MSC_VER
+# include "mscfakes.h"
 #endif
 
Index: /trunk/src/gmake/kmkbuiltin/ln.c
===================================================================
--- /trunk/src/gmake/kmkbuiltin/ln.c	(revision 808)
+++ /trunk/src/gmake/kmkbuiltin/ln.c	(revision 809)
@@ -43,5 +43,5 @@
 
 #ifndef _MSC_VER
-#include <sys/param.h>
+# include <sys/param.h>
 #endif
 #include <sys/stat.h>
@@ -53,8 +53,11 @@
 #include <stdlib.h>
 #include <string.h>
-#ifndef _MSC_VER
 #include <unistd.h>
-#else
-#include "mscfakes.h"
+
+#ifdef __sun__
+# include "getopt.h"
+#endif
+#ifdef _MSC_VER
+# include "mscfakes.h"
 #endif
 
Index: /trunk/src/gmake/kmkbuiltin/mkdir.c
===================================================================
--- /trunk/src/gmake/kmkbuiltin/mkdir.c	(revision 808)
+++ /trunk/src/gmake/kmkbuiltin/mkdir.c	(revision 809)
@@ -48,15 +48,18 @@
 #include <errno.h>
 #ifndef _MSC_VER
-#include <libgen.h>
+# include <libgen.h>
 #endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#ifndef _MSC_VER
 #include <sysexits.h>
 #include <unistd.h>
-#else
-#include "mscfakes.h"
-#include <malloc.h>
+
+#ifdef __sun__
+# include "getopt.h"
+#endif
+#ifdef _MSC_VER
+# include <malloc.h>
+# include "mscfakes.h"
 #endif
 
@@ -81,5 +84,5 @@
     /* reinitialize globals */
     vflag = 0;
-    
+
     /* kmk: reset getopt and set progname */
     g_progname = argv[0];
@@ -136,5 +139,5 @@
 		} else if (vflag)
 			(void)printf("%s\n", *argv);
-		
+
 		if (!success)
 			exitval = 1;
@@ -172,5 +175,5 @@
 		p = strchr(p, '\\');
 	}
-#endif 
+#endif
 
 	p = path;
Index: /trunk/src/gmake/kmkbuiltin/mscfakes.h
===================================================================
--- /trunk/src/gmake/kmkbuiltin/mscfakes.h	(revision 808)
+++ /trunk/src/gmake/kmkbuiltin/mscfakes.h	(revision 809)
@@ -32,4 +32,5 @@
 #include <time.h>
 #include <stdarg.h>
+#include <malloc.h>
 #undef setmode
 #include "getopt.h"
Index: /trunk/src/gmake/kmkbuiltin/mv.c
===================================================================
--- /trunk/src/gmake/kmkbuiltin/mv.c	(revision 808)
+++ /trunk/src/gmake/kmkbuiltin/mv.c	(revision 809)
@@ -49,11 +49,11 @@
 #include <sys/types.h>
 #ifndef _MSC_VER
-#ifndef __OS2__
-#include <sys/acl.h>
-#endif
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/wait.h>
-#include <sys/mount.h>
+# ifndef __OS2__
+#  include <sys/acl.h>
+# endif
+# include <sys/param.h>
+# include <sys/time.h>
+# include <sys/wait.h>
+# include <sys/mount.h>
 #endif
 #include <sys/stat.h>
@@ -62,20 +62,19 @@
 #include <errno.h>
 #include <fcntl.h>
-#ifndef _MSC_VER
 #include <grp.h>
-#endif
 #include <limits.h>
-#ifndef _MSC_VER
 #include <paths.h>
 #include <pwd.h>
-#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#ifndef _MSC_VER
 #include <sysexits.h>
 #include <unistd.h>
-#else
-#include "mscfakes.h"
+
+#ifdef __sun__
+# include "solfakes.h"
+#endif
+#ifdef _MSC_VER
+# include "mscfakes.h"
 #endif
 
Index: /trunk/src/gmake/kmkbuiltin/printf.c
===================================================================
--- /trunk/src/gmake/kmkbuiltin/printf.c	(revision 808)
+++ /trunk/src/gmake/kmkbuiltin/printf.c	(revision 809)
@@ -51,7 +51,5 @@
 #include "err.h"
 #include <errno.h>
-#ifndef _MSC_VER
 #include <inttypes.h>
-#endif
 #include <limits.h>
 #include <locale.h>
@@ -60,8 +58,11 @@
 #include <stdlib.h>
 #include <string.h>
-#ifndef _MSC_VER
 #include <unistd.h>
-#else
-#include "mscfakes.h"
+
+#ifdef __sun__
+# include "solfakes.h"
+#endif
+#ifdef _MSC_VER
+# include "mscfakes.h"
 #endif
 
Index: /trunk/src/gmake/kmkbuiltin/rm.c
===================================================================
--- /trunk/src/gmake/kmkbuiltin/rm.c	(revision 808)
+++ /trunk/src/gmake/kmkbuiltin/rm.c	(revision 809)
@@ -47,6 +47,6 @@
 #include <sys/stat.h>
 #ifndef _MSC_VER
-#include <sys/param.h>
-#include <sys/mount.h>
+# include <sys/param.h>
+# include <sys/mount.h>
 #endif
 
@@ -55,18 +55,19 @@
 #include <fcntl.h>
 #ifdef DO_RMTREE
-#include <fts.h>
-#endif
-#ifndef _MSC_VER
+# include <fts.h>
+#endif
 #include <grp.h>
 #include <pwd.h>
-#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#ifndef _MSC_VER
 #include <sysexits.h>
 #include <unistd.h>
-#else
-#include "mscfakes.h"
+
+#ifdef __sun__
+# include "getopt.h"
+#endif
+#ifdef _MSC_VER
+# include "mscfakes.h"
 #endif
 
Index: /trunk/src/gmake/kmkbuiltin/rmdir.c
===================================================================
--- /trunk/src/gmake/kmkbuiltin/rmdir.c	(revision 808)
+++ /trunk/src/gmake/kmkbuiltin/rmdir.c	(revision 809)
@@ -49,11 +49,10 @@
 #include <string.h>
 #include <errno.h>
-#ifndef _MSC_VER
 #include <unistd.h>
-#else
-#include <malloc.h>
-#include "mscfakes.h"
-#endif 
-#include <getopt.h>
+#include "getopt.h"
+
+#ifdef _MSC_VER
+# include "mscfakes.h"
+#endif
 
 static int rm_path(char *);
@@ -82,5 +81,5 @@
 	/* reinitialize globals */
 	ignore_fail_on_not_exist = ignore_fail_on_non_empty = vflag = pflag = 0;
-	
+
 	/* kmk: reset getopt and set progname */
 	g_progname = argv[0];
@@ -150,5 +149,5 @@
 		p = strchr(p, '\\');
 	}
-#endif 
+#endif
 
 	p = path + len;
@@ -166,5 +165,5 @@
 		if (p[-1] == ':' && p - 2 == path)
 			break;
-#endif 
+#endif
 
 		if (rmdir(path) < 0) {
Index: /trunk/src/gmake/kmkbuiltin/solfakes.c
===================================================================
--- /trunk/src/gmake/kmkbuiltin/solfakes.c	(revision 809)
+++ /trunk/src/gmake/kmkbuiltin/solfakes.c	(revision 809)
@@ -0,0 +1,77 @@
+/* $Id: $ */
+/** @file
+ *
+ * Fake Unix stuff for Solaris.
+ *
+ * Copyright (c) 2005-2007 knut st. osmundsen <bird-kBuild-spam@anduin.net>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with This program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+
+#include <stdio.h>
+#include <stdarg.h>
+#ifdef __sun__
+# undef va_copy /* why? */
+#endif
+#include "solfakes.h"
+
+
+int asprintf(char **strp, const char *fmt, ...)
+{
+    int rc;
+    va_list va;
+    va_start(va, fmt);
+    rc = vasprintf(strp, fmt, va);
+    va_end(va);
+    return rc;
+}
+
+
+int vasprintf(char **strp, const char *fmt, va_list va)
+{
+    int rc;
+    char *psz;
+    size_t cb = 1024;
+
+    *strp = NULL;
+    for (;;)
+    {
+        va_list va2;
+
+        psz = malloc(cb);
+        if (!psz)
+            return -1;
+
+#ifdef va_copy
+        va_copy(va2, va);
+        rc = snprintf(psz, cb, fmt, va2);
+        va_end(vaCopy);
+#else
+        va2 = va;
+        rc = snprintf(psz, cb, fmt, va2);
+#endif
+        if (rc < 0 || (size_t)rc < cb)
+            break;
+        cb *= 2;
+        free(psz);
+    }
+
+    *strp = psz;
+    return rc;
+}
+
Index: /trunk/src/gmake/kmkbuiltin/solfakes.h
===================================================================
--- /trunk/src/gmake/kmkbuiltin/solfakes.h	(revision 809)
+++ /trunk/src/gmake/kmkbuiltin/solfakes.h	(revision 809)
@@ -0,0 +1,41 @@
+/* $Id: mscfakes.h 805 2007-01-25 00:56:27Z bird $ */
+/** @file
+ *
+ * Unix fakes for Solaris.
+ *
+ * Copyright (c) 2005-2007 knut st. osmundsen <bird-kBuild-spam@anduin.net>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with This program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#ifndef __solfakes_h__
+#define __solfakes_h__
+#ifdef __sun__
+
+#include "getopt.h"
+#define _PATH_DEVNULL "/dev/null"
+#define ALLPERMS 0000777
+#define lutimes(path, tvs) utimes(path, tvs)
+#define lchmod(path, mod) chmod(path, mod)
+#define MAX(a,b) ((a) >= (b) ? (a) : (b))
+#ifndef USHRT_MAX
+# define USHRT_MAX 65535
+#endif
+
+#endif /* __sun__ */
+#endif /* __solfakes_h__ */
+
Index: /trunk/src/sed/Makefile.kmk
===================================================================
--- /trunk/src/sed/Makefile.kmk	(revision 808)
+++ /trunk/src/sed/Makefile.kmk	(revision 809)
@@ -32,14 +32,17 @@
 	lib/utils.c \
 	lib/regex.c
-kmk_sed_SOURCES.darwin += \
+kmk_sed_SOURCES.darwin = \
 	lib/strverscmp.c \
 	lib/obstack.c \
 	lib/getline.c
-kmk_sed_SOURCES.freebsd += \
+kmk_sed_SOURCES.freebsd = \
 	lib/strverscmp.c \
 	lib/obstack.c \
 	lib/getline.c
-ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
-kmk_sed_SOURCES += \
+kmk_sed_SOURCES.solaris = \
+	lib/strverscmp.c \
+	lib/obstack.c \
+	lib/getline.c
+kmk_sed_SOURCES.win = \
 	lib/strverscmp.c \
 	lib/obstack.c \
@@ -47,5 +50,4 @@
 	lib/getline.c \
 	../lib/startuphacks-win.c
-endif
 
 include $(PATH_KBUILD)/footer.kmk
@@ -55,7 +57,4 @@
 #
 config.h.$(BUILD_TARGET) := config.h.$(BUILD_TARGET)
-config.h.win32 := config.h.win
-config.h.win64 := config.h.win
-config.h.nt    := config.h.win
 
 $(PATH_TARGET)/config.h: $(config.h.$(BUILD_TARGET)) | $(call DIRDEP,$(PATH_TARGET))
Index: /trunk/src/sed/config.h.solaris
===================================================================
--- /trunk/src/sed/config.h.solaris	(revision 809)
+++ /trunk/src/sed/config.h.solaris	(revision 809)
@@ -0,0 +1,374 @@
+/* config.h.  Generated by configure.  */
+/* config_h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+   systems. This function is required for `alloca.c' support on those systems.
+   */
+/* #undef CRAY_STACKSEG_END */
+
+/* Define to 1 if using `alloca.c'. */
+/* #undef C_ALLOCA */
+
+/* Define to 1 if translation of program messages to the user's native
+   language is requested. */
+/* #undef ENABLE_NLS */
+
+/* Define to 1 if you have `alloca', as a function or macro. */
+#define HAVE_ALLOCA 1
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+   */
+#define HAVE_ALLOCA_H 1
+
+/* Define to 1 if you have the <argz.h> header file. */
+/* #undef HAVE_ARGZ_H */
+
+/* Define to 1 if you have the `bcopy' function. */
+#define HAVE_BCOPY 1
+
+/* Define to 1 if you have the `btowc' function. */
+#define HAVE_BTOWC 1
+
+/* Define to 1 if you have the `bzero' function. */
+#define HAVE_BZERO 1
+
+/* Define if the GNU dcgettext() function is already present or preinstalled.
+   */
+/* #undef HAVE_DCGETTEXT */
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+   */
+#define HAVE_DIRENT_H 1
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+#define HAVE_DOPRNT 1
+
+/* Define to 1 if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
+/* Define to 1 if you have the `fchmod' function. */
+#define HAVE_FCHMOD 1
+
+/* Define to 1 if you have the `fchown' function. */
+#define HAVE_FCHOWN 1
+
+/* Define to 1 if you have the `feof_unlocked' function. */
+/* #undef HAVE_FEOF_UNLOCKED */
+
+/* Define to 1 if you have the `fgets_unlocked' function. */
+/* #undef HAVE_FGETS_UNLOCKED */
+
+/* Define to 1 if you have the `getcwd' function. */
+#define HAVE_GETCWD 1
+
+/* Define to 1 if you have the `getc_unlocked' function. */
+#define HAVE_GETC_UNLOCKED 1
+
+/* Define to 1 if you have the `getegid' function. */
+#define HAVE_GETEGID 1
+
+/* Define to 1 if you have the `geteuid' function. */
+#define HAVE_GETEUID 1
+
+/* Define to 1 if you have the `getgid' function. */
+#define HAVE_GETGID 1
+
+/* Define to 1 if you have the `getpagesize' function. */
+#define HAVE_GETPAGESIZE 1
+
+/* Define if the GNU gettext() function is already present or preinstalled. */
+/* #undef HAVE_GETTEXT */
+
+/* Define to 1 if you have the `getuid' function. */
+#define HAVE_GETUID 1
+
+/* Define if you have the iconv() function. */
+#define HAVE_ICONV 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <io.h> header file. */
+/* #undef HAVE_IO_H */
+
+/* Define to 1 if you have the `isascii' function. */
+#define HAVE_ISASCII 1
+
+/* Define to 1 if you have the `isatty' function. */
+#define HAVE_ISATTY 1
+
+/* Define to 1 if you have the `isblank' function. */
+#define HAVE_ISBLANK 1
+
+/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
+#define HAVE_LANGINFO_CODESET 1
+
+/* Define if your <locale.h> file defines LC_MESSAGES. */
+#define HAVE_LC_MESSAGES 1
+
+/* Define to 1 if you have the `regex' library (-lregex). */
+/* #undef HAVE_LIBREGEX */
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the <locale.h> header file. */
+#define HAVE_LOCALE_H 1
+
+/* Define to 1 if you support file names longer than 14 characters. */
+#define HAVE_LONG_FILE_NAMES 1
+
+/* Define to 1 if you have the <malloc.h> header file. */
+#define HAVE_MALLOC_H 1
+
+/* Define to 1 if mbrtowc and mbstate_t are properly declared. */
+#define HAVE_MBRTOWC 1
+
+/* Define to 1 if <wchar.h> declares mbstate_t. */
+#define HAVE_MBSTATE_T 1
+
+/* Define to 1 if you have the <mcheck.h> header file. */
+/* #undef HAVE_MCHECK_H */
+
+/* Define to 1 if you have the `memchr' function. */
+#define HAVE_MEMCHR 1
+
+/* Define to 1 if you have the `memcmp' function. */
+#define HAVE_MEMCMP 1
+
+/* Define to 1 if you have the `memcpy' function. */
+#define HAVE_MEMCPY 1
+
+/* Define to 1 if you have the `memmove' function. */
+#define HAVE_MEMMOVE 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mempcpy' function. */
+/* #undef HAVE_MEMPCPY */
+
+/* Define to 1 if you have the `memset' function. */
+#define HAVE_MEMSET 1
+
+/* Define to 1 if you have the `mkstemp' function. */
+#define HAVE_MKSTEMP 1
+
+/* Define to 1 if you have a working `mmap' system call. */
+#define HAVE_MMAP 1
+
+/* Define to 1 if you have the `munmap' function. */
+#define HAVE_MUNMAP 1
+
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+/* #undef HAVE_NDIR_H */
+
+/* Define to 1 if you have the <nl_types.h> header file. */
+#define HAVE_NL_TYPES_H 1
+
+/* Define to 1 if libc includes obstacks. */
+/* #undef HAVE_OBSTACK */
+
+/* Define to 1 if you have the `pathconf' function. */
+#define HAVE_PATHCONF 1
+
+/* Define to 1 if you have the `popen' function. */
+#define HAVE_POPEN 1
+
+/* Define to 1 if you have the `putenv' function. */
+#define HAVE_PUTENV 1
+
+/* Define to 1 if you have the <regex.h> header file. */
+/* #undef HAVE_REGEX_H */
+
+/* Define to 1 if you have the `setenv' function. */
+#define HAVE_SETENV 1
+
+/* Define to 1 if you have the `setlocale' function. */
+#define HAVE_SETLOCALE 1
+
+/* Define to 1 if you have the <stdarg.h> header file. */
+#define HAVE_STDARG_H 1
+
+/* Define to 1 if stdbool.h conforms to C99. */
+#define HAVE_STDBOOL_H 1
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#define HAVE_STDDEF_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `stpcpy' function. */
+/* #undef HAVE_STPCPY */
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#define HAVE_STRCASECMP 1
+
+/* Define to 1 if you have the `strchr' function. */
+#define HAVE_STRCHR 1
+
+/* Define to 1 if you have the `strdup' function. */
+#define HAVE_STRDUP 1
+
+/* Define to 1 if you have the `strerror' function. */
+#define HAVE_STRERROR 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strtoul' function. */
+#define HAVE_STRTOUL 1
+
+/* Define to 1 if you have the `strverscmp' function. */
+/* #undef HAVE_STRVERSCMP */
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+   */
+/* #undef HAVE_SYS_DIR_H */
+
+/* Define to 1 if you have the <sys/file.h> header file. */
+#define HAVE_SYS_FILE_H 1
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+   */
+/* #undef HAVE_SYS_NDIR_H */
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the `tsearch' function. */
+#define HAVE_TSEARCH 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `vprintf' function. */
+#define HAVE_VPRINTF 1
+
+/* Define to 1 if you have the <wchar.h> header file. */
+#define HAVE_WCHAR_H 1
+
+/* Define to 1 if you have the `wcrtomb' function. */
+#define HAVE_WCRTOMB 1
+
+/* Define to 1 if you have the `wcscoll' function. */
+#define HAVE_WCSCOLL 1
+
+/* Define to 1 if you have the <wctype.h> header file. */
+#define HAVE_WCTYPE_H 1
+
+/* Define to 1 if the system has the type `_Bool'. */
+#define HAVE__BOOL 1
+
+/* Define to 1 if you have the `__argz_count' function. */
+/* #undef HAVE___ARGZ_COUNT */
+
+/* Define to 1 if you have the `__argz_next' function. */
+/* #undef HAVE___ARGZ_NEXT */
+
+/* Define to 1 if you have the `__argz_stringify' function. */
+/* #undef HAVE___ARGZ_STRINGIFY */
+
+/* Define as const if the declaration of iconv() needs const. */
+#define ICONV_CONST const
+
+/* Name of package */
+#define PACKAGE "sed"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "bonzini@gnu.org"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "sed"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "sed 4.1.5"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "sed"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "4.1.5"
+
+/* Define to the version of GNU sed whose features are supported by this sed.
+   */
+#define SED_FEATURE_VERSION "4.1"
+
+/* If using the C implementation of alloca, define if you know the
+   direction of stack growth for your system; otherwise it will be
+   automatically deduced at run-time.
+	STACK_DIRECTION > 0 => grows toward higher addresses
+	STACK_DIRECTION < 0 => grows toward lower addresses
+	STACK_DIRECTION = 0 => direction of growth unknown */
+/* #undef STACK_DIRECTION */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "4.1.5"
+
+/* Define to 1 if on AIX 3.
+   System headers sometimes define this.
+   We just want to avoid a redefinition error message.  */
+#ifndef _ALL_SOURCE
+/* # undef _ALL_SOURCE */
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#define _FILE_OFFSET_BITS 64
+
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+/* Define to 1 if on MINIX. */
+/* #undef _MINIX */
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+/* #undef _POSIX_1_SOURCE */
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+/* #undef _POSIX_SOURCE */
+
+/* Include BSD functions in regex, used by the testsuite */
+#define _REGEX_RE_COMP 1
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to a type if <wchar.h> does not define. */
+/* #undef mbstate_t */
+
+/* Define to `long' if <sys/types.h> does not define. */
+/* #undef off_t */
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef ssize_t */
