Index: trunk/kBuild/env.sh
===================================================================
--- trunk/kBuild/env.sh	(revision 3061)
+++ trunk/kBuild/env.sh	(revision 3062)
@@ -330,4 +330,46 @@
             KBUILD_HOST_ARCH='x86'
             ;;
+        alpha)
+            KBUILD_HOST_ARCH='alpha'
+            ;;
+        aarch32|arm|arm1|arm2|arm3|arm6|armv1|armv2|armv3*|armv4*|armv5*|armv6*|armv7*)
+            KBUILD_HOST_ARCH='arm32'
+            ;;
+        aarch64*)
+            KBUILD_HOST_ARCH='arm64'
+            ;;
+        hppa32|parisc32|parisc)
+            KBUILD_HOST_ARCH='hppa32'
+            ;;
+        hppa64|parisc64)
+            KBUILD_HOST_ARCH='hppa64'
+            ;;
+        ia64)
+            KBUILD_HOST_ARCH='ia64'
+            ;;
+        ppc32|ppc|powerpc)
+            KBUILD_HOST_ARCH='ppc32'
+            ;;
+        ppc64|ppc64le|powerpc64|powerpc64le)
+            KBUILD_HOST_ARCH='ppc64'
+            ;;
+        mips32|mips)
+            KBUILD_HOST_ARCH='mips32'
+            ;;
+        mips64)
+            KBUILD_HOST_ARCH='mips64'
+            ;;
+        s390)
+            KBUILD_HOST_ARCH='s390'
+            ;;
+        s390x)
+            KBUILD_HOST_ARCH='s390x'
+            ;;
+	sh|sh2|sh2a|sh3|sh3|sh4|sh4a|sh4al|sh4al-dsp|shmedia)
+	    KBUILD_HOST_ARCH='sh32'
+	    ;;
+        sh64)
+	    KBUILD_HOST_ARCH='sh64'
+	    ;;
         sparc32|sparc|sparcv8|sparcv7|sparcv8e)
             KBUILD_HOST_ARCH='sparc32'
@@ -335,37 +377,4 @@
         sparc64|sparcv9)
             KBUILD_HOST_ARCH='sparc64'
-            ;;
-        s390)
-            KBUILD_HOST_ARCH='s390'
-            ;;
-        s390x)
-            KBUILD_HOST_ARCH='s390x'
-            ;;
-        ppc32|ppc|powerpc)
-            KBUILD_HOST_ARCH='ppc32'
-            ;;
-        ppc64|powerpc64)
-            KBUILD_HOST_ARCH='ppc64'
-            ;;
-        mips32|mips)
-            KBUILD_HOST_ARCH='mips32'
-            ;;
-        mips64)
-            KBUILD_HOST_ARCH='mips64'
-            ;;
-        ia64)
-            KBUILD_HOST_ARCH='ia64'
-            ;;
-        hppa32|parisc32|parisc)
-            KBUILD_HOST_ARCH='hppa32'
-            ;;
-        hppa64|parisc64)
-            KBUILD_HOST_ARCH='hppa64'
-            ;;
-        arm|armv4l|armv5tel|armv5tejl)
-            KBUILD_HOST_ARCH='arm'
-            ;;
-        alpha)
-            KBUILD_HOST_ARCH='alpha'
             ;;
 
Index: trunk/kBuild/header.kmk
===================================================================
--- trunk/kBuild/header.kmk	(revision 3061)
+++ trunk/kBuild/header.kmk	(revision 3062)
@@ -197,8 +197,9 @@
 # build types. (PORTME)
 #
-KBUILD_OSES      := darwin dos dragonfly freebsd haiku l4 linux netbsd nt openbsd os2 solaris win os-agnostic
-KBUILD_ARCHES    := x86 amd64 sparc32 sparc64 s390 s390x ppc32 ppc64 mips32 mips64 ia64 hppa32 hppa64 arm alpha noarch
-KBUILD_ARCHES_64 := amd64 sparc64 s390x ppc64 mips64 ia64 hppa64 alpha
-KBUILD_ARCHES_32 := x86 sparc32 s390 ppc32 mips32 hppa32 arm
+KBUILD_OSES      := darwin dos dragonfly freebsd gnukfbsd gnuknbsd haiku l4 linux netbsd nt openbsd os2 solaris win os-agnostic
+KBUILD_ARCHES    := x86 amd64 noarch alpha arm32 arm64 hppa32 hppa64 ia64 mips32 mips64 ppc32 ppc64 s390 s390x sh32 sh64 sparc32 sparc64
+KBUILD_ARCHES_64 := amd64 alpha arm64 hppa64 ia64 mips64 ppc64 s390x sh64 sparc64
+KBUILD_ARCHES_32 := x86 arm32 hppa32 mips32 ppc32 s390 sh32 sparc32
+
 
 
@@ -602,5 +603,5 @@
 HOST_PATH_SEP       := $(SEMICOLON)
 
-else if1of ($(KBUILD_HOST), freebsd dragonfly linux openbsd netbsd)
+else if1of ($(KBUILD_HOST), dragonfly freebsd gnukfbsd gnuknbsd linux openbsd netbsd)
 # Unix (like) systems with wine.
 EXEC_X86_WIN32      := wine
@@ -648,5 +649,5 @@
 SUFF_DLL    := .so
 SUFF_EXE    :=
- if1of ($(KBUILD_TARGET), dragonfly freebsd linux netbsd openbsd) ## @todo check netbsd and openbsd.
+ if1of ($(KBUILD_TARGET), dragonfly freebsd gnukfbsd gnuknbsd linux netbsd openbsd) ## @todo check netbsd, gnuknbsd and openbsd.
 SUFF_SYS    := .ko
  else
@@ -1382,5 +1383,5 @@
  KBUILD_LIB_SEARCH_SUBS  := lib/
 
-else if1of ($(KBUILD_TARGET), freebsd netbsd openbsd dragonfly)
+else if1of ($(KBUILD_TARGET), freebsd openbsd dragonfly)
  KBUILD_LIB_SEARCH_ROOTS := \
 	/ \
@@ -1389,5 +1390,13 @@
  KBUILD_LIB_SEARCH_SUBS := lib/
 
-else ifeq ($(KBUILD_TARGET),linux)
+else ifeq ($(KBUILD_TARGET),netbsd)
+ KBUILD_LIB_SEARCH_ROOTS := \
+	/ \
+	/usr/ \
+	/usr/pkg/ \
+	/usr/local/
+ KBUILD_LIB_SEARCH_SUBS := lib/
+
+else if1of ($(KBUILD_TARGET), gnukfbsd gnuknbsd linux)
  ifeq ($(realpath /bin),/usr/bin)
   KBUILD_LIB_SEARCH_ROOTS := \
Index: trunk/kBuild/tools/GCC32.kmk
===================================================================
--- trunk/kBuild/tools/GCC32.kmk	(revision 3061)
+++ trunk/kBuild/tools/GCC32.kmk	(revision 3062)
@@ -47,5 +47,5 @@
 TOOL_GCC32_LDFLAGS.dll ?= $(TOOL_GCC32_LDFLAGS.$(KBUILD_TARGET))
 endif
-TOOL_GCC32_LDFLAGS.sysmod ?= -r -m elf_i386$(if-expr "$(KBUILD_TARGET)" == "freebsd",_fbsd,)
+TOOL_GCC32_LDFLAGS.sysmod ?= -r -m elf_i386$(if-expr "$(KBUILD_TARGET)" == "freebsd" || "$(KBUILD_TARGET)" == "gnukfbsd",_fbsd,)
 TOOL_GCC32_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
 ifeq ($(KBUILD_TARGET),os2)
Index: trunk/kBuild/tools/GCC64.kmk
===================================================================
--- trunk/kBuild/tools/GCC64.kmk	(revision 3061)
+++ trunk/kBuild/tools/GCC64.kmk	(revision 3062)
@@ -47,5 +47,5 @@
 TOOL_GCC64_LDFLAGS.dll ?= $(TOOL_GCC64_LDFLAGS.$(KBUILD_TARGET))
 endif
-TOOL_GCC64_LDFLAGS.sysmod ?= -r -m elf_x86_64$(if-expr "$(KBUILD_TARGET)" == "freebsd",_fbsd,)
+TOOL_GCC64_LDFLAGS.sysmod ?= -r -m elf_x86_64$(if-expr "$(KBUILD_TARGET)" == "freebsd" || "$(KBUILD_TARGET)" == "gnukfbsd",_fbsd,)
 TOOL_GCC64_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
 ifeq ($(KBUILD_TARGET),os2)
Index: trunk/kBuild/tools/GXX32.kmk
===================================================================
--- trunk/kBuild/tools/GXX32.kmk	(revision 3061)
+++ trunk/kBuild/tools/GXX32.kmk	(revision 3062)
@@ -47,5 +47,5 @@
 TOOL_GXX32_LDFLAGS.dll ?= $(TOOL_GXX32_LDFLAGS.$(KBUILD_TARGET))
 endif
-TOOL_GXX32_LDFLAGS.sysmod ?= -r -m elf_i386$(if-expr "$(KBUILD_TARGET)" == "freebsd",_fbsd,)
+TOOL_GXX32_LDFLAGS.sysmod ?= -r -m elf_i386$(if-expr "$(KBUILD_TARGET)" == "freebsd" || "$(KBUILD_TARGET)" == "gnukfbsd",_fbsd,)
 TOOL_GXX32_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
 ifeq ($(KBUILD_TARGET),os2)
Index: trunk/kBuild/tools/GXX64.kmk
===================================================================
--- trunk/kBuild/tools/GXX64.kmk	(revision 3061)
+++ trunk/kBuild/tools/GXX64.kmk	(revision 3062)
@@ -47,5 +47,5 @@
 TOOL_GXX64_LDFLAGS.dll ?= $(TOOL_GXX64_LDFLAGS.$(KBUILD_TARGET))
 endif
-TOOL_GXX64_LDFLAGS.sysmod ?= -r -m elf_x86_64$(if-expr "$(KBUILD_TARGET)" == "freebsd",_fbsd,)
+TOOL_GXX64_LDFLAGS.sysmod ?= -r -m elf_x86_64$(if-expr "$(KBUILD_TARGET)" == "freebsd" || "$(KBUILD_TARGET)" == "gnukfbsd",_fbsd,)
 TOOL_GXX64_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
 ifeq ($(KBUILD_TARGET),os2)
