diff -ur old/fpc-2.2.2/rtl/netbsd/Makefile new/fpc-2.2.2/rtl/netbsd/Makefile
--- old/fpc-2.2.2/rtl/netbsd/Makefile	2008-06-27 20:16:43.000000000 +0200
+++ new/fpc-2.2.2/rtl/netbsd/Makefile	2008-08-28 00:22:08.000000000 +0200
@@ -1,8 +1,8 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/06/18]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/08/27]
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx
 LIMIT83fs = go32v2 os2 emx watcom
@@ -168,17 +168,6 @@
 endif
 FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
 FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
-ifeq ($(CPU_TARGET),armeb)
-ARCH=arm
-override FPCOPT+=-Cb
-else
-ifeq ($(CPU_TARGET),armel)
-ARCH=arm
-override FPCOPT+=-CaEABI
-else
-ARCH=$(CPU_TARGET)
-endif
-endif
 ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
 TARGETSUFFIX=$(OS_TARGET)
 SOURCESUFFIX=$(OS_SOURCE)
@@ -200,7 +189,7 @@
 ifeq ($(OS_TARGET),linux)
 linuxHier=1
 endif
-export OS_TARGET OS_SOURCE ARCH CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE
+export OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE
 ifdef FPCDIR
 override FPCDIR:=$(subst \,/,$(FPCDIR))
 ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
@@ -288,178 +277,163 @@
 CPU_UNITS=
 endif
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
-endif
-ifeq ($(FULL_TARGET),i386-haiku)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
-endif
-ifeq ($(FULL_TARGET),arm-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),arm-gba)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),arm-nds)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
-endif
-ifeq ($(FULL_TARGET),avr-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
-endif
-ifeq ($(FULL_TARGET),armeb-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
-endif
-ifeq ($(FULL_TARGET),armeb-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts initc dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings syscall baseunix $(LINUXUNIT) unix rtlconsts ctypes initc  dos crt objects printer matrix sysutils types fgl classes typinfo math varutils fmtbcd charset ucomplex getopts heaptrc lineinfo lnfodwrf errors sockets terminfo dateutils video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) strutils convutils stdconvs dos objects clocale
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_IMPLICITUNITS+=exeinfo
@@ -479,9 +453,6 @@
 ifeq ($(FULL_TARGET),i386-beos)
 override TARGET_IMPLICITUNITS+=exeinfo
 endif
-ifeq ($(FULL_TARGET),i386-haiku)
-override TARGET_IMPLICITUNITS+=exeinfo
-endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override TARGET_IMPLICITUNITS+=exeinfo
 endif
@@ -599,9 +570,6 @@
 ifeq ($(FULL_TARGET),arm-palmos)
 override TARGET_IMPLICITUNITS+=exeinfo
 endif
-ifeq ($(FULL_TARGET),arm-darwin)
-override TARGET_IMPLICITUNITS+=exeinfo
-endif
 ifeq ($(FULL_TARGET),arm-wince)
 override TARGET_IMPLICITUNITS+=exeinfo
 endif
@@ -626,15 +594,6 @@
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 override TARGET_IMPLICITUNITS+=exeinfo
 endif
-ifeq ($(FULL_TARGET),avr-embedded)
-override TARGET_IMPLICITUNITS+=exeinfo
-endif
-ifeq ($(FULL_TARGET),armeb-linux)
-override TARGET_IMPLICITUNITS+=exeinfo
-endif
-ifeq ($(FULL_TARGET),armeb-embedded)
-override TARGET_IMPLICITUNITS+=exeinfo
-endif
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_LOADERS+=prt0 cprt0
 endif
@@ -653,9 +612,6 @@
 ifeq ($(FULL_TARGET),i386-beos)
 override TARGET_LOADERS+=prt0 cprt0
 endif
-ifeq ($(FULL_TARGET),i386-haiku)
-override TARGET_LOADERS+=prt0 cprt0
-endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override TARGET_LOADERS+=prt0 cprt0
 endif
@@ -773,9 +729,6 @@
 ifeq ($(FULL_TARGET),arm-palmos)
 override TARGET_LOADERS+=prt0 cprt0
 endif
-ifeq ($(FULL_TARGET),arm-darwin)
-override TARGET_LOADERS+=prt0 cprt0
-endif
 ifeq ($(FULL_TARGET),arm-wince)
 override TARGET_LOADERS+=prt0 cprt0
 endif
@@ -800,188 +753,164 @@
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 override TARGET_LOADERS+=prt0 cprt0
 endif
-ifeq ($(FULL_TARGET),avr-embedded)
-override TARGET_LOADERS+=prt0 cprt0
-endif
-ifeq ($(FULL_TARGET),armeb-linux)
-override TARGET_LOADERS+=prt0 cprt0
-endif
-ifeq ($(FULL_TARGET),armeb-embedded)
-override TARGET_LOADERS+=prt0 cprt0
-endif
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
-endif
-ifeq ($(FULL_TARGET),i386-haiku)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
-endif
-ifeq ($(FULL_TARGET),arm-darwin)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),arm-gba)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),arm-nds)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
-endif
-ifeq ($(FULL_TARGET),avr-embedded)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
-endif
-ifeq ($(FULL_TARGET),armeb-linux)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
-endif
-ifeq ($(FULL_TARGET),armeb-embedded)
-override TARGET_RSTS+=math varutils typinfo variants classes sysconst fpmkunit
+override TARGET_RSTS+=math varutils typinfo variants classes sysconst
 endif
 override INSTALL_FPCPACKAGE=y y
 ifeq ($(FULL_TARGET),i386-linux)
@@ -1002,9 +931,6 @@
 ifeq ($(FULL_TARGET),i386-beos)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(BSDPROCINC) $(TARGETPROCINC)
 endif
-ifeq ($(FULL_TARGET),i386-haiku)
-override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(BSDPROCINC) $(TARGETPROCINC)
-endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(BSDPROCINC) $(TARGETPROCINC)
 endif
@@ -1122,9 +1048,6 @@
 ifeq ($(FULL_TARGET),arm-palmos)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(BSDPROCINC) $(TARGETPROCINC)
 endif
-ifeq ($(FULL_TARGET),arm-darwin)
-override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(BSDPROCINC) $(TARGETPROCINC)
-endif
 ifeq ($(FULL_TARGET),arm-wince)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(BSDPROCINC) $(TARGETPROCINC)
 endif
@@ -1149,15 +1072,6 @@
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(BSDPROCINC) $(TARGETPROCINC)
 endif
-ifeq ($(FULL_TARGET),avr-embedded)
-override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(BSDPROCINC) $(TARGETPROCINC)
-endif
-ifeq ($(FULL_TARGET),armeb-linux)
-override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(BSDPROCINC) $(TARGETPROCINC)
-endif
-ifeq ($(FULL_TARGET),armeb-embedded)
-override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(BSDPROCINC) $(TARGETPROCINC)
-endif
 ifeq ($(FULL_TARGET),i386-linux)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC)
 endif
@@ -1176,9 +1090,6 @@
 ifeq ($(FULL_TARGET),i386-beos)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC)
 endif
-ifeq ($(FULL_TARGET),i386-haiku)
-override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC)
-endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC)
 endif
@@ -1296,9 +1207,6 @@
 ifeq ($(FULL_TARGET),arm-palmos)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC)
 endif
-ifeq ($(FULL_TARGET),arm-darwin)
-override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC)
-endif
 ifeq ($(FULL_TARGET),arm-wince)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC)
 endif
@@ -1323,15 +1231,6 @@
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC)
 endif
-ifeq ($(FULL_TARGET),avr-embedded)
-override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC)
-endif
-ifeq ($(FULL_TARGET),armeb-linux)
-override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC)
-endif
-ifeq ($(FULL_TARGET),armeb-embedded)
-override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC)
-endif
 ifdef REQUIRE_UNITSDIR
 override UNITSDIR+=$(REQUIRE_UNITSDIR)
 endif
@@ -1621,11 +1520,6 @@
 EXEEXT=
 SHORTSUFFIX=be
 endif
-ifeq ($(OS_TARGET),haiku)
-BATCHEXT=.sh
-EXEEXT=
-SHORTSUFFIX=hai
-endif
 ifeq ($(OS_TARGET),solaris)
 BATCHEXT=.sh
 EXEEXT=
@@ -2085,13 +1979,13 @@
 TAREXT=.tar.gz
 endif
 ifndef NOCPUDEF
-override FPCOPTDEF=$(ARCH)
+override FPCOPTDEF=$(CPU_TARGET)
 endif
 ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 ifneq ($(CPU_TARGET),$(CPU_SOURCE))
-override FPCOPT+=-P$(ARCH)
+override FPCOPT+=-P$(CPU_TARGET)
 endif
 ifeq ($(OS_SOURCE),openbsd)
 override FPCOPT+=-FD$(NEW_BINUTILS_PATH)
@@ -2632,6 +2526,8 @@
 	$(COMPILER) -Us -Sg $(BSDINC)/$(SYSTEMUNIT).pp
 objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
 	$(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp
+dateutils$(PPUEXT): $(OBJPASDIR)/dateutils.pp baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+	$(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/dateutils.pp
 strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
 		   $(PROCINC)/strings.inc $(PROCINC)/stringss.inc\
 		   $(SYSTEMUNIT)$(PPUEXT)
@@ -2682,7 +2578,6 @@
 lnfodwrf$(PPUEXT) : $(INC)/lnfodwrf.pp $(SYSTEMUNIT)$(PPUEXT)
 charset$(PPUEXT) : $(INC)/charset.pp $(SYSTEMUNIT)$(PPUEXT)
 ucomplex$(PPUEXT) : $(INC)/ucomplex.pp math$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
-fpmkunit$(PPUEXT) : $(COMMON)/fpmkunit.pp classes$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 sockets$(PPUEXT) : $(UNIXINC)/sockets.pp $(INC)/textrec.inc $(INC)/filerec.inc \
 		   unix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 errors$(PPUEXT) : $(UNIXINC)/errors.pp strings$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
@@ -2695,3 +2590,17 @@
 	$(COMPILER) $(OBJPASDIR)/sysconst.pp
 sysctl$(PPUEXT) : $(BSDINC)/sysctl.pp unixtype$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 cthreads$(PPUEXT) : $(UNIXINC)/cthreads.pp $(SYSTEMUNIT)$(PPUEXT)
+strutils$(PPUEXT) : $(OBJPASDIR)/strutils.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT) \
+		    sysutils$(PPUEXT)
+	$(COMPILER) $(OBJPASDIR)/strutils.pp
+convutils$(PPUEXT) : $(OBJPASDIR)/convutils.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT) \
+		    sysutils$(PPUEXT)
+	$(COMPILER) $(OBJPASDIR)/convutils.pp
+stdconvs$(PPUEXT) : $(OBJPASDIR)/stdconvs.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT) \
+		    sysutils$(PPUEXT)
+	$(COMPILER) $(OBJPASDIR)/stdconvs.pp
+dynlibs$(PPUEXT) : $(INC)/dynlibs.pas $(UNIXINC)/dynlibs.inc dl$(PPUEXT) objpas$(PPUEXT)
+ctypes$(PPUEXT) :  $(INC)/ctypes.pp $(SYSTEMUNIT)$(PPUEXT)
+variants$(PPUEXT) : $(INC)/variants.pp sysutils$(PPUEXT) sysconst$(PPUEXT) varutils$(PPUEXT) typinfo$(PPUEXT) rtlconsts$(PPUEXT) math$(PPUEXT)
+	$(COMPILER) -Fi$(INC) $(INC)/variants.pp
+cwstring$(PPUEXT) : $(UNIXINC)/cwstring.pp $(SYSTEMUNIT)$(PPUEXT) sysutils$(PPUEXT) baseunix$(PPUEXT) unix$(PPUEXT) unixtype$(PPUEXT) ctypes$(PPUEXT)
diff -ur old/fpc-2.2.2/rtl/netbsd/Makefile.fpc new/fpc-2.2.2/rtl/netbsd/Makefile.fpc
--- old/fpc-2.2.2/rtl/netbsd/Makefile.fpc	2008-07-29 21:38:38.000000000 +0200
+++ new/fpc-2.2.2/rtl/netbsd/Makefile.fpc	2008-08-28 00:21:04.000000000 +0200
@@ -11,15 +11,17 @@
 [target]
 loaders=prt0 cprt0
 units=$(SYSTEMUNIT) objpas macpas strings syscall baseunix \
-      $(LINUXUNIT) unix rtlconsts initc \
+      $(LINUXUNIT) unix rtlconsts ctypes initc  \
       dos crt objects printer matrix \
       sysutils types fgl classes typinfo math varutils fmtbcd \
       charset ucomplex getopts heaptrc lineinfo lnfodwrf \
-      errors sockets terminfo \
-      video mouse keyboard  serial variants types sysctl sysconst fpmkunit $(CPU_UNITS)
-      # ipc
+      errors sockets terminfo dateutils \
+      video mouse keyboard  serial variants types sysctl sysconst $(CPU_UNITS) \
+      strutils convutils stdconvs dos objects clocale
+      # cwstring ipc
+
+rsts=math varutils typinfo variants classes sysconst
 
-rsts=math varutils typinfo variants classes sysconst fpmkunit
 implicitunits=exeinfo
 
 [require]
@@ -128,6 +130,9 @@
 objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
         $(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp
 
+dateutils$(PPUEXT): $(OBJPASDIR)/dateutils.pp baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+        $(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/dateutils.pp
+
 strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
                    $(PROCINC)/strings.inc $(PROCINC)/stringss.inc\
                    $(SYSTEMUNIT)$(PPUEXT)
@@ -230,8 +235,6 @@
 
 ucomplex$(PPUEXT) : $(INC)/ucomplex.pp math$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 
-fpmkunit$(PPUEXT) : $(COMMON)/fpmkunit.pp classes$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
-
 #
 # Other system-dependent RTL Units
 #
@@ -257,3 +260,24 @@
 sysctl$(PPUEXT) : $(BSDINC)/sysctl.pp unixtype$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 
 cthreads$(PPUEXT) : $(UNIXINC)/cthreads.pp $(SYSTEMUNIT)$(PPUEXT)
+
+strutils$(PPUEXT) : $(OBJPASDIR)/strutils.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT) \
+                    sysutils$(PPUEXT)
+        $(COMPILER) $(OBJPASDIR)/strutils.pp
+
+convutils$(PPUEXT) : $(OBJPASDIR)/convutils.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT) \
+                    sysutils$(PPUEXT)
+        $(COMPILER) $(OBJPASDIR)/convutils.pp
+
+stdconvs$(PPUEXT) : $(OBJPASDIR)/stdconvs.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT) \
+                    sysutils$(PPUEXT)
+        $(COMPILER) $(OBJPASDIR)/stdconvs.pp
+
+dynlibs$(PPUEXT) : $(INC)/dynlibs.pas $(UNIXINC)/dynlibs.inc dl$(PPUEXT) objpas$(PPUEXT)
+
+ctypes$(PPUEXT) :  $(INC)/ctypes.pp $(SYSTEMUNIT)$(PPUEXT)
+
+variants$(PPUEXT) : $(INC)/variants.pp sysutils$(PPUEXT) sysconst$(PPUEXT) varutils$(PPUEXT) typinfo$(PPUEXT) rtlconsts$(PPUEXT) math$(PPUEXT)
+        $(COMPILER) -Fi$(INC) $(INC)/variants.pp
+
+cwstring$(PPUEXT) : $(UNIXINC)/cwstring.pp $(SYSTEMUNIT)$(PPUEXT) sysutils$(PPUEXT) baseunix$(PPUEXT) unix$(PPUEXT) unixtype$(PPUEXT) ctypes$(PPUEXT)
diff -ur old/fpc-2.2.2/rtl/netbsd/i386/cprt0.as new/fpc-2.2.2/rtl/netbsd/i386/cprt0.as
--- old/fpc-2.2.2/rtl/netbsd/i386/cprt0.as	2007-08-02 09:49:58.000000000 +0200
+++ new/fpc-2.2.2/rtl/netbsd/i386/cprt0.as	2008-08-28 00:44:21.000000000 +0200
@@ -1,5 +1,5 @@
 #
-#   $Id: cprt0.as,v 1.2 2004/01/04 01:13:23 marco Exp $
+#   $Id: cprt0.as,v 1.3 2000/11/21 19:03:23 marco Exp $
 #   This file is part of the Free Pascal run time library.
 #   Copyright (c) 1999-2000 by Marco van de Voort, Michael Van Canneyt
 #                                                  and Peter Vreman
@@ -14,153 +14,132 @@
 #
 #**********************************************************************}
 #
-# NetBSD standard (shared) ELF/i386 startup code for Free Pascal
+# NetBSD ELF startup code for Free Pascal for dynamical linking to libc.
 #
+# We are using ELF note to avoid misdetecting the ABI.
+#
+
+        .file   "cprt0.as"
+.section ".note.netbsd.ident", "a"
+	.long   2f-1f
+	.long   4f-3f
+	.long   1
+1:      .asciz  "NetBSD"
+2:      .p2align 2
+3:      .long   400000	/* 4.0 */
+4:      .p2align 2
 
-	.file	"crt0.c"
-	.version	"01.01"
-gcc2_compiled.:
-.globl __progname
-.section	.rodata
 .LC0:
-	.ascii "\0"
-.data
-	.align 4
-	.type	 __progname,@object
-	.size	 __progname,4
+        .string ""
+	.data
+        .p2align 2
+	.globl __progname
+        .type    __progname,@object
+        .size    __progname,4
 __progname:
-	.long .LC0
-.globl __ps_strings
-	.align 4
-	.type	 __ps_strings,@object
-	.size	 __ps_strings,4
-__ps_strings:
-	.long 0
-	.align 4
+        .long .LC0
+        .text
+        .p2align  2,,3
+	.type   __fpucw,@object
+        .size   __fpucw,4
+        .global __fpucw
 ___fpucw:
-	.long 0x1332	
+        .long   0x1332
         .globl  ___fpc_brk_addr         /* heap management */
         .type   ___fpc_brk_addr,@object
         .size   ___fpc_brk_addr,4
 ___fpc_brk_addr:
         .long   0
 
-#APP
-	.weak _DYNAMIC
-	
 	.text
-	.align	4
-	.globl	__start
-	.globl	_start
+        .p2align 4,,15
+.globl _start
+        .type    _start,@function
 _start:
-__start:
-	pushl	%ebx			# ps_strings
-	pushl	%ecx			# obj
-	pushl	%edx			# cleanup
-	movl	12(%esp),%eax
-	leal	20(%esp,%eax,4),%ecx
-	leal	16(%esp),%edx
-	pushl	%ecx
-	pushl	%edx
-	pushl	%eax
-	movl	%eax,U_SYSTEM_ARGC
-	movl	%edx,U_SYSTEM_ARGV
-	call	___start
+        pushl %ebp
+        movl %esp,%ebp
+	subl $40,%esp
+	call get_rtld_cleanup
+	movl %eax,%edx
 
+        pushl %edi
+        pushl %esi
+        pushl %ebx
+#APP
+        movl %edx,%edx
 #NO_APP
-.text
-	.align 4
-.globl ___start
-	.type	 ___start,@function
-___start:
-	pushl %ebp
-	movl %esp,%ebp
-	pushl %edi
-	pushl %esi
-	pushl %ebx
-	call .L12
-.L12:
-	popl %ebx
-	addl $_GLOBAL_OFFSET_TABLE_+[.-.L12],%ebx
-	movl 12(%ebp),%esi
-	movl 16(%ebp),%edx
-	movl 28(%ebp),%edi
-	movl environ@GOT(%ebx),%eax
-	movl %edx,(%eax)
-	movl %edx,U_SYSTEM_ENVP
-	movl __progname@GOT(%ebx),%edx
-	movl (%esi),%eax
-	movl %eax,(%edx)
-	testl %eax,%eax
-	je .L6
-	pushl $47
-	movl __progname@GOT(%ebx),%eax
-	pushl (%eax)
-	call _strrchr@PLT
-	movl %eax,%edx
-	movl __progname@GOT(%ebx),%eax
-	movl %edx,(%eax)
-	addl $8,%esp
-	testl %edx,%edx
-	jne .L7
-	movl __progname@GOT(%ebx),%edx
-	movl (%esi),%eax
-	movl %eax,(%edx)
-	jmp .L6
-	.align 4
-.L7:
-	movl __progname@GOT(%ebx),%eax
-	incl %edx
-	movl %edx,(%eax)
+        leal 8(%ebp),%edi
+        movl %edi,operatingsystem_parameter_argv
+        mov -4(%edi),%eax
+        movl %eax,operatingsystem_parameter_argc
+        movl 4(%ebp),%ebx
+        leal 12(%ebp,%ebx,4),%esi
+        movl %esi,operatingsystem_parameter_envp
+        movl %esi,environ
+        testl %ebx,%ebx
+        jle .L2
+        movl 8(%ebp),%eax
+        testl %eax,%eax
+        je .L2
+        movl %eax,__progname
+        cmpb $0,(%eax)
+        je .L2
+        .p2align 2,0x90
 .L6:
-	testl %edi,%edi
-	je .L9
-	movl __ps_strings@GOT(%ebx),%eax
-	movl %edi,(%eax)
+        cmpb $47,(%eax)
+        jne .L5
+        leal 1(%eax),%ecx
+        movl %ecx,__progname
+.L5:
+        incl %eax
+        cmpb $0,(%eax)
+        jne .L6
+.L2:
+        movl $_DYNAMIC,%eax
+        testl %eax,%eax
+        je .LTLS
+        pushl %edx
+        call atexit
+        addl $4,%esp
 .L9:
-	cmpl $0,_DYNAMIC@GOT(%ebx)
-	je .L10
-	pushl 24(%ebp)
-	pushl 20(%ebp)
-	call _rtld_setup@PLT
-	addl $8,%esp
-.L10:
-	pushl _fini@GOT(%ebx)
-	call atexit@PLT
-	call _init@PLT
-#	movl environ@GOT(%ebx),%eax
-#	pushl (%eax)
-#	pushl %esi
-#	pushl 8(%ebp)
-#	call main@PLT
+        pushl $_fini
+        call atexit
+        call _init
+#       pushl %esi
+#       pushl %edi
+#       pushl %ebx
+#       call main
+#       pushl %eax
+#       call exit
+
 
         finit                           /* initialize fpu */
         fwait
         fldcw   ___fpucw
 
-//        xorl    %ebp,%ebp               /* Detect main from nested */
-                                        /* procs/unwinding? */
-	pushl (%eax)
-	pushl (%esi)
-	pushl 8(%ebp)
+        xorl    %ebp,%ebp
+
         call main
         pushl %eax
-	pushl %eax
-	call exit@PLT
-
-.p2align 2,0x90
+        jmp   _haltproc
+.LTLS:  
+	call _init_tls
+	jmp .L9
+        .p2align 2,0x90
+       
+ 
 .globl _haltproc
 .type _haltproc,@function
 
 _haltproc:
-           mov $1,%eax
-           movzwl U_SYSTEM_EXITCODE,%ebx
+           mov $1,%eax  
+           movzwl operatingsystem_result,%ebx
            pushl %ebx
-           call _actualsyscall
+           call .Lactualsyscall
            addl  $4,%esp
            jmp   _haltproc
 
-_actualsyscall:
+.Lactualsyscall:
          int $0x80
          jb .LErrorcode
          xor %ebx,%ebx
@@ -170,269 +149,43 @@
          mov $-1,%eax
          ret
         .p2align 2,0x90
-
-
 .Lfe1:
-	.size	 ___start,.Lfe1-___start
-	.align 4
-	.type	 _strrchr,@function
-_strrchr:
-	pushl %ebp
-	movl %esp,%ebp
-	subl $4,%esp
-	pushl %esi
-	movl 8(%ebp),%eax
-	movb 12(%ebp),%cl
-	movb %cl,-1(%ebp)
-	xorl %esi,%esi
-	.align 4
-.L14:
-	movb (%eax),%dl
-	cmpb -1(%ebp),%dl
-	jne .L17
-	movl %eax,%esi
-.L17:
-	testb %dl,%dl
-	je .L16
-	incl %eax
-	jmp .L14
-	.align 4
-.L16:
-	movl %esi,%eax
-	movl -8(%ebp),%esi
-	leave
-	ret
-.Lfe2:
-	.size	 _strrchr,.Lfe2-_strrchr
-.section	.rodata
-	.align 32
-.LC1:
-	.ascii "Corrupt Obj_Entry pointer in GOT\0"
-	.align 32
-.LC2:
-	.ascii "Dynamic linker version mismatch\0"
-.text
-	.align 4
-.globl _rtld_setup
-	.type	 _rtld_setup,@function
-_rtld_setup:
-	pushl %ebp
-	movl %esp,%ebp
-	pushl %esi
-	pushl %ebx
-	call .L35
-.L35:
-	popl %ebx
-	addl $_GLOBAL_OFFSET_TABLE_+[.-.L35],%ebx
-	movl 12(%ebp),%esi
-	testl %esi,%esi
-	je .L22
-	cmpl $-716130182,(%esi)
-	je .L21
-.L22:
-	pushl $33
-	leal .LC1@GOTOFF(%ebx),%eax
-	pushl %eax
-	pushl $2
-	pushl $4
-	call __syscall@PLT
-	pushl $1
-	pushl $1
-	call __syscall@PLT
-	addl $24,%esp
-	.align 4
-.L21:
-	cmpl $1,4(%esi)
-	je .L28
-	pushl $32
-	leal .LC2@GOTOFF(%ebx),%eax
-	pushl %eax
-	pushl $2
-	pushl $4
-	call __syscall@PLT
-	pushl $1
-	pushl $1
-	call __syscall@PLT
-	addl $24,%esp
-	.align 4
-.L28:
-	pushl 8(%ebp)
-	call atexit@PLT
-	leal -8(%ebp),%esp
-	popl %ebx
-	popl %esi
-	leave
-	ret
-.Lfe3:
-	.size	 _rtld_setup,.Lfe3-_rtld_setup
+        .size    _start,.Lfe1-_start
+        .comm   environ,4,4
+        .p2align 4,,15
+        .type   get_rtld_cleanup, @function
+get_rtld_cleanup:
+        pushl   %ebp
+        movl    %esp, %ebp
+        subl    $4, %esp
 #APP
-	.weak dlopen ; dlopen = _dlopen
-	.weak dlclose ; dlclose = _dlclose
-	.weak dlsym ; dlsym = _dlsym
-	.weak dlerror ; dlerror = _dlerror
-	.weak dladdr ; dladdr = _dladdr
+        movl %edx,-4(%ebp)
 #NO_APP
-	.align 4
-.globl _dlopen
-	.type	 _dlopen,@function
-_dlopen:
-	pushl %ebp
-	movl %esp,%ebp
-	pushl %ebx
-	call .L40
-.L40:
-	popl %ebx
-	addl $_GLOBAL_OFFSET_TABLE_+[.-.L40],%ebx
-	movl __mainprog_obj@GOT(%ebx),%eax
-	movl (%eax),%eax
-	testl %eax,%eax
-	je .L37
-	pushl 12(%ebp)
-	pushl 8(%ebp)
-	movl 80(%eax),%eax
-	call *%eax
-	jmp .L38
-	.align 4
-.L37:
-	xorl %eax,%eax
-.L38:
-	movl -4(%ebp),%ebx
-	leave
-	ret
-.Lfe4:
-	.size	 _dlopen,.Lfe4-_dlopen
-	.align 4
-.globl _dlclose
-	.type	 _dlclose,@function
-_dlclose:
-	pushl %ebp
-	movl %esp,%ebp
-	pushl %ebx
-	call .L45
-.L45:
-	popl %ebx
-	addl $_GLOBAL_OFFSET_TABLE_+[.-.L45],%ebx
-	movl __mainprog_obj@GOT(%ebx),%eax
-	movl (%eax),%eax
-	testl %eax,%eax
-	je .L42
-	pushl 8(%ebp)
-	movl 92(%eax),%eax
-	call *%eax
-	jmp .L43
-	.align 4
-.L42:
-	movl $-1,%eax
-.L43:
-	movl -4(%ebp),%ebx
-	leave
-	ret
-.Lfe5:
-	.size	 _dlclose,.Lfe5-_dlclose
-	.align 4
-.globl _dlsym
-	.type	 _dlsym,@function
-_dlsym:
-	pushl %ebp
-	movl %esp,%ebp
-	pushl %ebx
-	call .L50
-.L50:
-	popl %ebx
-	addl $_GLOBAL_OFFSET_TABLE_+[.-.L50],%ebx
-	movl __mainprog_obj@GOT(%ebx),%eax
-	movl (%eax),%eax
-	testl %eax,%eax
-	je .L47
-	pushl 12(%ebp)
-	pushl 8(%ebp)
-	movl 84(%eax),%eax
-	call *%eax
-	jmp .L48
-	.align 4
-.L47:
-	xorl %eax,%eax
-.L48:
-	movl -4(%ebp),%ebx
-	leave
-	ret
-.Lfe6:
-	.size	 _dlsym,.Lfe6-_dlsym
-.section	.rodata
-	.align 32
-.LC3:
-	.ascii "Dynamic linker interface not available\0"
-.text
-	.align 4
-.globl _dlerror
-	.type	 _dlerror,@function
-_dlerror:
-	pushl %ebp
-	movl %esp,%ebp
-	pushl %ebx
-	call .L55
-.L55:
-	popl %ebx
-	addl $_GLOBAL_OFFSET_TABLE_+[.-.L55],%ebx
-	movl __mainprog_obj@GOT(%ebx),%eax
-	movl (%eax),%eax
-	testl %eax,%eax
-	je .L52
-	movl 88(%eax),%eax
-	call *%eax
-	jmp .L53
-	.align 4
-.L52:
-	leal .LC3@GOTOFF(%ebx),%eax
-.L53:
-	movl -4(%ebp),%ebx
-	leave
-	ret
-.Lfe7:
-	.size	 _dlerror,.Lfe7-_dlerror
-	.align 4
-.globl _dladdr
-	.type	 _dladdr,@function
-_dladdr:
-	pushl %ebp
-	movl %esp,%ebp
-	pushl %ebx
-	call .L60
-.L60:
-	popl %ebx
-	addl $_GLOBAL_OFFSET_TABLE_+[.-.L60],%ebx
-	movl __mainprog_obj@GOT(%ebx),%eax
-	movl (%eax),%eax
-	testl %eax,%eax
-	je .L57
-	pushl 12(%ebp)
-	pushl 8(%ebp)
-	movl 96(%eax),%eax
-	call *%eax
-	jmp .L58
-	.align 4
-.L57:
-	movl $-1,%eax
-.L58:
-	movl -4(%ebp),%ebx
-	leave
-	ret
-.Lfe8:
-	.size	 _dladdr,.Lfe8-_dladdr
-	.comm	environ,4,4
-	.comm	__mainprog_obj,4,4
-
-
-
-# This section is needed for NetBSD to recognize a NetBSD binary as such.
-# otherwise it will be startup in Linux emulation mode.
-
-.section ".note.netbsd.ident","a"
-.p2align 2
-
-.long 7
-.long 4
-# ELF NOTE TYPE NETBSD TAG
-.long 1
-.ascii "NetBSD\0\0"
-.long 199905
+        movl    -4(%ebp), %eax
+        leave
+        ret
+
+        .weak   _DYNAMIC
+        .ident  "GCC: (GNU) 3.4.2 - FPC: 2.2.2"
+
+.bss
+        .type   __stkptr,@object
+        .size   __stkptr,4
+        .global __stkptr
+__stkptr:
+        .skip   4
+
+        .type operatingsystem_parameters,@object
+        .size operatingsystem_parameters,12
+operatingsystem_parameters:
+        .skip 3*4
+
+        .global operatingsystem_parameter_envp
+        .global operatingsystem_parameter_argc
+        .global operatingsystem_parameter_argv
+        .set operatingsystem_parameter_envp,operatingsystem_parameters+0
+        .set operatingsystem_parameter_argc,operatingsystem_parameters+4
+        .set operatingsystem_parameter_argv,operatingsystem_parameters+8
+
+//.section .threadvar,"aw",@nobits
+        .comm   ___fpc_threadvar_offset,4
diff -ur old/fpc-2.2.2/rtl/netbsd/i386/prt0.as new/fpc-2.2.2/rtl/netbsd/i386/prt0.as
--- old/fpc-2.2.2/rtl/netbsd/i386/prt0.as	2007-08-02 09:49:58.000000000 +0200
+++ new/fpc-2.2.2/rtl/netbsd/i386/prt0.as	2008-08-28 00:43:16.000000000 +0200
@@ -1,5 +1,5 @@
 #
-#   $Id: prt0.as,v 1.2 2004/01/04 01:13:23 marco Exp $
+#   $Id: prt0.as,v 1.4 2004/07/03 21:50:30 daniel Exp $
 #   This file is part of the Free Pascal run time library.
 #   Copyright (c) 1999-2000 by Marco van de Voort, Michael Van Canneyt
 #                                                  and Peter Vreman
@@ -14,32 +14,33 @@
 #
 #**********************************************************************}
 #
-# NetBSD standard (static) ELF/i386 startup code for Free Pascal
+# NetBSD standard (static) ELF startup code for Free Pascal
+#
+# We are using ELF note to avoid misdetecting the ABI.
 #
 
-http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/csu/i386/crt0.c?rev=1.33&content-type=text/x-cvsweb-markup
-
-	.file	"prt0.s"
-	.version	"01.01"
-gcc2_compiled.:
-.globl __progname
-
-.section	.rodata
+        .file   "prt0.as"
+.section ".note.netbsd.ident", "a"
+        .long   2f-1f
+	.long   4f-3f
+	.long   1
+	1:      .asciz  "NetBSD"
+	2:      .p2align 2
+	3:      .long   400000000
+	4:      .p2align 2
 .LC0:
-	.ascii "\0"
+        .ascii "\0"
 .data
-	.align 4
-	.type	 __progname,@object
-	.size	 __progname,4
+        .p2align 2
+	.globl __progname
+        .type    __progname,@object
+        .size    __progname,4
 __progname:
-	.long .LC0
-.globl __ps_strings
-	.align 4
-	.type	 __ps_strings,@object
-	.size	 __ps_strings,4
-__ps_strings:
-	.long 0
-	.align 4
+        .long .LC0
+        .align  4
+        .type   __fpucw,@object
+        .size   __fpucw,4
+        .global __fpucw
 ___fpucw:
         .long   0x1332
 
@@ -49,71 +50,48 @@
 ___fpc_brk_addr:
         .long   0
 
-#APP
-	
-	.text
-	.align	4
-	.globl	__start
-	.globl	_start
+.text
+        .p2align 2
+.globl _start
+        .type    _start,@function
 _start:
-__start:
-	pushl	%ebx			# ps_strings
-	pushl	%ecx			# obj
-	pushl	%edx			# cleanup
-	movl	12(%esp),%eax
-	leal	20(%esp,%eax,4),%ecx
-	leal	16(%esp),%edx
-	pushl	%ecx
-	pushl	%edx
-	pushl	%eax
-	call	___start
-
+        pushl %ebp
+        movl %esp,%ebp
+        pushl %edi
+        pushl %esi
+        pushl %ebx
+#APP
+        movl %edx,%edx
 #NO_APP
-.text
-	.align 4
-.globl ___start
-	.type	 ___start,@function
-___start:
-	pushl %ebp
-	movl %esp,%ebp
-	movl 16(%ebp),%eax
-	movl %eax,environ
-	movl %eax,U_SYSTEM_ENVP
-	movl 8(%ebp),%eax
-	movl %eax,U_SYSTEM_ARGC
-	movl 12(%ebp),%eax
-	movl %eax,U_SYSTEM_ARGV
-	movl (%eax),%edx
-	movl %edx,__progname
-	testl %edx,%edx
-	je .L2
-	pushl $47
-	movl __progname,%eax
-	pushl %eax
-	call _strrchr
-	addl $8,%esp
-	movl %eax,%eax
-	movl %eax,__progname
-	cmpl $0,__progname
-	jne .L3
-	movl 12(%ebp),%eax
-	movl (%eax),%edx
-	movl %edx,__progname
-	jmp .L2
-	.align 4
-.L3:
-	incl __progname
-.L4:
-.L2:
-	cmpl $0,28(%ebp)
-	je .L5
-	movl 28(%ebp),%eax
-	movl %eax,__ps_strings
+        leal 8(%ebp),%edi
+        movl %edi,operatingsystem_parameter_argv
+        mov -4(%edi),%eax
+        movl %eax,operatingsystem_parameter_argc
+        movl 4(%ebp),%ebx
+        leal 12(%ebp,%ebx,4),%esi
+        movl %esi,operatingsystem_parameter_envp
+        movl %esi,environ
+        testl %ebx,%ebx
+        jle .L2
+        movl 8(%ebp),%eax
+        testl %eax,%eax
+        je .L2
+        movl %eax,__progname
+        cmpb $0,(%eax)
+        je .L2
+        .p2align 2,0x90
+.L6:
+        cmpb $47,(%eax)
+        jne .L5
+        leal 1(%eax),%ecx
+        movl %ecx,__progname
 .L5:
-#	pushl $_fini
-#	call atexit
-#	addl $4,%esp
-#	call _init
+        incl %eax
+        cmpb $0,(%eax)
+        jne .L6
+.L2:
+.L9:
+
 # copied from linux
 
         finit                           /* initialize fpu */
@@ -122,17 +100,17 @@
 
         xorl    %ebp,%ebp
 
-	call _main
-	pushl %eax
-	jmp  _haltproc
-
+        call PASCALMAIN
+        pushl %eax
+        jmp   _haltproc
+        
 .p2align 2,0x90
 .globl _haltproc
 .type _haltproc,@function
 
 _haltproc:
-           mov $1,%eax
-           movzwl U_SYSTEM_EXITCODE,%ebx
+           mov $1,%eax  
+           movzwl operatingsystem_result,%ebx
            pushl %ebx
            call _actualsyscall
            addl  $4,%esp
@@ -148,16 +126,31 @@
          mov $-1,%eax
          ret
         .p2align 2,0x90
+.Lfe1:
+        .size    _start,.Lfe1-_start
+        .comm   environ,4,4
+        .weak   _DYNAMIC
+        .ident  "GCC: (GNU) 3.4.2 - FPC: 2.2.2"
+
+
+.bss
+        .type   __stkptr,@object
+        .size   __stkptr,4
+        .global __stkptr
+__stkptr:
+        .skip   4
+
+        .type operatingsystem_parameters,@object
+        .size operatingsystem_parameters,12
+operatingsystem_parameters:
+        .skip 3*4
+
+        .global operatingsystem_parameter_envp
+        .global operatingsystem_parameter_argc
+        .global operatingsystem_parameter_argv
+        .set operatingsystem_parameter_envp,operatingsystem_parameters+0
+        .set operatingsystem_parameter_argc,operatingsystem_parameters+4
+        .set operatingsystem_parameter_argv,operatingsystem_parameters+8
 
-# This section is needed for NetBSD to recognize a NetBSD binary as such.
-# otherwise it will be startup in Linux emulation mode.
-
-.section ".note.netbsd.ident","a"
-.p2align 2
-
-.long 7
-.long 4
-# ELF NOTE TYPE NETBSD TAG
-.long 1
-.ascii "NetBSD\0\0"
-.long 199905
+//.section .threadvar,"aw",@nobits
+        .comm   ___fpc_threadvar_offset,4
diff -ur old/fpc-2.2.2/rtl/netbsd/unixsock.inc new/fpc-2.2.2/rtl/netbsd/unixsock.inc
--- old/fpc-2.2.2/rtl/netbsd/unixsock.inc	2006-10-29 00:17:49.000000000 +0200
+++ new/fpc-2.2.2/rtl/netbsd/unixsock.inc	2008-08-28 00:22:46.000000000 +0200
@@ -23,91 +23,91 @@
 function  fpsocket (domain:cint; xtype:cint; protocol: cint):cint;
 Begin
   fpSocket:=Do_Syscall(syscall_nr_socket,Domain,xtype,Protocol);
-  socketerror:=fpgeterrno;
+  internal_socketerror:=fpgeterrno;
 End;
 
 function  fpsend (s:cint; msg:pointer; len:size_t; flags:cint):ssize_t;
 begin
   fpSend:=do_syscall(syscall_nr_sendto,S,TSysParam(msg),Len,Flags,0,0);
-  socketerror:=fpgeterrno;
+  internal_socketerror:=fpgeterrno;
 end;
 
 function  fpsendto (s:cint; msg:pointer; len:size_t; flags:cint; tox :psockaddr; tolen: tsocklen):ssize_t;
 begin
   fpSendto:=do_syscall(syscall_nr_sendto,S,TSysParam(msg),Len,Flags,TSysParam(tox),tolen);
-  socketerror:=fpgeterrno;
+  internal_socketerror:=fpgeterrno;
 end;
 
 function  fprecv (s:cint; buf: pointer; len: size_t; flags:cint):ssize_t;
 begin
   fpRecv:=do_syscall(syscall_nr_Recvfrom,S,tsysparam(buf),len,flags,0,0);
-  socketerror:=fpgeterrno;
+  internal_socketerror:=fpgeterrno;
 end;
 
 function  fprecvfrom (s:cint; buf: pointer; len: size_t; flags: cint; from : psockaddr; fromlen : psocklen):ssize_t;
 begin
   fpRecvFrom:=do_syscall(syscall_nr_Recvfrom,S,TSysParam(buf),len,flags,TSysParam(from),TSysParam(fromlen));
-  socketerror:=fpgeterrno;
+  internal_socketerror:=fpgeterrno;
 end;
 
 function  fpbind (s:cint; addrx : psockaddr; addrlen : tsocklen):cint;
 begin
   fpBind:=do_syscall(syscall_nr_Bind,S,TSysParam(addrx),addrlen);
-  socketerror:=fpgeterrno;
+  internal_socketerror:=fpgeterrno;
 end;
 
 function  fplisten (s:cint; backlog : cint):cint;
 begin
   fpListen:=do_syscall(syscall_nr_Listen,S,backlog);
-  socketerror:=fpgeterrno;
+  internal_socketerror:=fpgeterrno;
 end;
 
 function  fpaccept (s:cint; addrx : psockaddr; addrlen : psocklen):cint;
 begin
   fpAccept:=do_syscall(syscall_nr_accept,S,TSysParam(addrx),TSysParam(addrlen));
-  socketerror:=fpgeterrno;
+  internal_socketerror:=fpgeterrno;
 end;
 
 function  fpconnect (s:cint; name  : psockaddr; namelen : tsocklen):cint;
 begin
   fpConnect:=do_syscall(syscall_nr_connect,S,TSysParam(name),namelen);
-  socketerror:=fpgeterrno;
+  internal_socketerror:=fpgeterrno;
 end;
 
 function  fpshutdown (s:cint; how:cint):cint;
 begin
   fpShutDown:=do_syscall(syscall_nr_shutdown,S,how);
-  socketerror:=fpgeterrno;
+  internal_socketerror:=fpgeterrno;
 end;
 
 function  fpgetsockname (s:cint; name  : psockaddr; namelen : psocklen):cint;
 begin
   fpGetSockName:=do_syscall(syscall_nr_GetSockName,S,TSysParam(name),TSysParam(namelen));
-  socketerror:=fpgeterrno;
+  internal_socketerror:=fpgeterrno;
 end;
 
 function  fpgetpeername (s:cint; name  : psockaddr; namelen : psocklen):cint;
 begin
   fpGetPeerName:=do_syscall(syscall_nr_GetPeerName,S,TSysParam(name),TSysParam(namelen));
-  socketerror:=fpgeterrno;
+  internal_socketerror:=fpgeterrno;
 end;
 
 function  fpsetsockopt  (s:cint; level:cint; optname:cint; optval:pointer; optlen : tsocklen):cint;
 begin
   fpSetSockOpt:=do_syscall(syscall_nr_SetSockOpt,S,level,optname,TSysParam(optval),optlen);
-  socketerror:=fpgeterrno;
+  internal_socketerror:=fpgeterrno;
 end;
 
 function  fpgetsockopt  (s:cint; level:cint; optname:cint; optval:pointer; optlen : psocklen):cint;
 begin
   fpGetSockOpt:=do_syscall(syscall_nr_GetSockOpt,S,level,TSysParam(optname),TSysParam(optval),TSysParam(optlen));
-  socketerror:=fpgeterrno;
+  internal_socketerror:=fpgeterrno;
 end;
 
 function  fpsocketpair (d:cint; xtype:cint; protocol:cint; sv:pcint):cint;
 
 begin
   fpSocketPair:=do_syscall(syscall_nr_SocketPair,d,xtype,protocol,TSysParam(sv));
-  socketerror:=fpgeterrno;
+  internal_socketerror:=fpgeterrno;
 end;
 
