--- /dev/null
+
+-include ../../Makefile.cfg
+
+GCC_ARCHIVE:=$(lastword $(sort $(wildcard gcc-*.tar.bz2)))
+GCC_DIR:=$(GCC_ARCHIVE:%.tar.bz2=%)
+BINUTILS_ARCHIVE:=$(lastword $(sort $(wildcard binutils-*.tar.bz2)))
+BINUTILS_DIR:=$(BINUTILS_ARCHIVE:%.tar.bz2=%)
+
+BINUTILS_CHANGES := config.sub bfd/config.bfd gas/configure.tgt ld/configure.tgt ld/emulparams/acess2_i386.sh ld/Makefile.in
+GCC_CHANGES := config.sub gcc/config.gcc gcc/config/acess2.h libgcc/config.host
+
+ARCH?=i586
+PARLEVEL ?= 3
+
+TARGET=$(ARCH)-pc-acess2
+PREFIX=$(shell pwd)/cross
+
+.PHONY: all clean binutils gcc include
+
+all: include binutils gcc
+
+include:
+ mkdir -p $(PREFIX)
+ rm -r $(PREFIX)/include
+ ln -s $(ACESSDIR)/Usermode/include $(PREFIX)/include
+
+gcc: $(GCC_DIR) $(PREFIX)/bin/$(TARGET)-gcc
+
+binutils: $(BINUTILS_DIR) $(PREFIX)/bin/$(TARGET)-ld
+
+clean:
+ $(RM) -rf $(BINUTILS_DIR) build-*-$(ARCH)
+
+$(BINUTILS_DIR) $(GCC_DIR): %: %.tar.bz2
+ tar -xf $<
+$(warning $(BINUTILS_DIR) $(GCC_DIR))
+
+$(GCC_DIR)/%: patches/gcc/%.patch
+ @echo [PATCH] $@
+ @tar -xf $(GCC_ARCHIVE) $@
+ @patch $@ $<
+$(GCC_DIR)/%: patches/gcc/%
+ @echo [CP] $@
+ @cp $< $@
+
+$(BINUTILS_DIR)/%: patches/binutils/%.patch
+ @echo [PATCH] $@
+ @tar -xf $(BINUTILS_ARCHIVE) $@
+ @patch $@ $<
+$(BINUTILS_DIR)/%: patches/binutils/%
+ @echo [CP] $@
+ @cp $< $@
+
+$(PREFIX)/bin/$(TARGET)-ld: $(addprefix $(BINUTILS_DIR)/,$(BINUTILS_CHANGES))
+ @mkdir -p build-binutils-$(ARCH)
+ @cd build-binutils-$(ARCH) && ../$(BINUTILS_DIR)/configure --target=$(TARGET) --prefix=$(PREFIX) --disable-nls
+ @cd build-binutils-$(ARCH) && make all install -j $(PARLEVEL)
+
+$(PREFIX)/bin/$(TARGET)-gcc: $(addprefix $(GCC_DIR)/,$(GCC_CHANGES))
+ @mkdir -p build-gcc-$(ARCH)
+ cd build-gcc-$(ARCH) && PATH=$(PREFIX)/bin:$$PATH ../$(GCC_DIR)/configure --target=$(TARGET) --prefix=$(PREFIX) --disable-nls --enable-langs=c,c++ --includedir=$(ACESSDIR)/Usermode/include --libdir=$(ACESSDIR)/Usermode/Output/$(ARCH)/Lib
+ @cd build-gcc-$(ARCH) && PATH=$(PREFIX)/bin:$$PATH make all-gcc all-target-libgcc install-gcc install-target-libgcc -j $(PARLEVEL)
+
+
--- /dev/null
+--- bfd/config.bfd 2011-07-29 00:00:00.000000 +0000
++++ bfd/config.bfd 2013-03-01 10:45:00.000000 +0800
+@@ -1576,2 +1576,11 @@
+ ;;
++ i[3-7]86-*-acess2)
++ targ_defvec=bfd_elf32_i386_vec
++ targ_selvecs=i386coff_vec
++ ;;
++ x86_64-*-acess2)
++ targ_defvec=bfd_elf64_x86_64_vec
++ targ_selvecs="bfd_elf32_i386_vec bfd_elf32_x86_64_vec i386linux_vec i386pei_vec x86_64pei_vec bfd_elf64_l1om_vec bfd_elf64_k1om_vec"
++ want64=true
++ ;;
+ # END OF targmatch.h
--- /dev/null
+--- config.sub
++++ config.sub
+@@ -1325,1 +1325,2 @@
++ | -acess2 \
+ | -aos* | -aros* \
+
--- /dev/null
+--- gas/configure.tgt 2011-07-29 00:00:00.000000 +0000
++++ gas/configure.tgt 2013-03-01 10:45:00.000000 +0800
+@@ -173,2 +173,3 @@
+ i386-sequent-bsd*) fmt=aout em=dynix ;;
++ i386-*-acess2*) fmt=elf ;;
+ i386-*-beospe*) fmt=coff em=pe ;;
--- /dev/null
+--- ld/Makefile.in
++++ ld/Makefile.in
+@@ -2627,2 +2627,4 @@
+ ${GENSCRIPTS} elf32xtensa "$(tdir_elf32xtensa)"
++eacess2_i386.c: $(srcdir)/emulparams/acess2_i386.sh $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
++ ${GENSCRIPTS} acess2_i386 "$(tdir_acess2_i386)"
+ eelf_i386.c: $(srcdir)/emulparams/elf_i386.sh \
--- /dev/null
+--- ld/configure.tgt
++++ ld/configure.tgt
+@@ -167,1 +167,2 @@
+ i[3-7]86-*-nto-qnx*) targ_emul=i386nto ;;
++i[3-7]86-*-acess2*) targ_emul=acess2_i386 ;;
+
--- /dev/null
+SCRIPT_NAME=elf
+OUTPUT_FORMAT=elf32-i386
+TEXT_START_ADDR=0x08048000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
+
+ARCH=i386
+MACHINE=
+NOP=0x90909090
+GENERATE_SHLIB_SCRIPT=yes
+GENERATE_PIE_SCRIPT=yes
+
+NO_SMALL_DATA=yes
+SEPARATE_GOTPLT=12
+
+ELF_INTERPRETER_NAME=\"/Acess/Libs/ld-acess.so\"
+
--- /dev/null
+--- config.sub
++++ config.sub
+@@ -1336,1 +1336,2 @@
+ | -aos* | -aros* \
++ | -acess2* \
--- /dev/null
+--- gcc/config.gcc
++++ gcc/config.gcc
+@@ -519,3 +519,9 @@
+ # Common parts for widely ported systems.
+ case ${target} in
++*-*-acess2*)
++ extra_parts="crt0.o crtbegin.o crtend.o"
++ gas=yes
++ gnu_ld=yes
++ default_use_cxa_atexit=yes
++ ;;
+ *-*-darwin*)
+
+@@ -1192,2 +1196,7 @@
+ ;;
++i[3-7]86-*-acess2*)
++ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/i386elf.h acess2.h"
++ tmake_file="i386/t-i386elf t-svr4"
++ use_fixproto=yes
++ ;;
+ i[34567]86-*-elf*)
--- /dev/null
+#undef TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS() \
+ do { \
+ builtin_define_std ("acess2"); \
+ builtin_define_std ("unix"); \
+ builtin_assert ("system=acess2"); \
+ builtin_assert ("system=unix"); \
+ } while(0);
+
+/*
+#undef TARGET_VERSION // note that adding these two lines cause an error in gcc-4.7.0
+#define TARGET_VERSION fprintf(stderr, " (i386 acess2)"); // the build process works fine without them until someone can work out an alternative
+*/
+
--- /dev/null
+--- libgcc/config.host
++++ libgcc/config.host
+@@ -523,4 +523,12 @@
+ x86_64-*-elf*)
+ tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
+ ;;
++i[3-7]86-*-acess2*)
++ extra_parts="crt0.o crtbegin.o crtend.o"
++ tmake_file="$tmake_file i386/t-crtstuff"
++ ;;
++x86_64-*-acess2*)
++ extra_parts="crt0.o crtbegin.o crtend.o"
++ tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
++ ;;
+ i[34567]86-*-freebsd*)
+