How to build a toolchain for the PSXSDK
----------------------

If you do not have the patience for this, do not do this. Unless you have
some less used operating system and/or using a non-x86 processor on your development computer there are precompiled toolchains on the main PSXSDK site for some of the most common operating systems.

These instructions are for Unix-like operating systems, although they will
probably work also on Cygwin.

To build a toolchain for the PSXSDK, you need to download GNU Binutils
(http://www.gnu.org/software/binutils/) and GNU GCC (http://gcc.gnu.org)

Remember to download gcc-core because languages other than C were not
tested at all with the PSXSDK.

It is assumed that you want to install the toolchain you are going to build in
/usr/local/psxsdk. If you don't want to do that simply replace it in the 
commands with something else.

Open a terminal, extract binutils then cd to the binutils directory:
./configure --disable-nls --prefix=/usr/local/psxsdk --target=mipsel-unknown-elf --with-float=soft

Then to compile GNU binutils run:
make

and then to install GNU binutils: make install

To build GCC, first go to the directory where you downloaded the GCC archive, extract it, make a directory called psxsdk-gcc and use cd to get into it.

Configure GCC:
<gcc-directory>/configure --disable-nls --disable-libada --disable-libssp --disable-libquadmath --disable-libstdc++-v3 \
--target=mipsel-unknown-elf --prefix=/usr/local/psxsdk --with-float=soft --enable-languages=c,c++

Replace <gcc-directory> with the directory where the GCC sources are.
If you are compiling a version of gcc 5 (or higher), you need to add something like CFLAGS="-std=c99"
otherwise the compilation may fail.

If you don't need C++ support, replace "--enable-languages=c,c++" with "--enable-languages=c" and remember
to set CXX_SUPPORT in Makefile.cfg to `no'; that will avoid C++ support in PSXSDK from being compiled.

Note that on some systems (like NetBSD) for some reason GCC might not build if you run its configure script using a relative path
(like ..). This happens for a strange reason. In doubt, run the configure script using an absolute path (the complete name of the directory).

To compile GNU gcc run: make
and then to install it: make install

Now you just need to build the PSXSDK. Notice that the PSXSDK installs itself
after building automatically and you will not need to execute a command to install it after building it.

Before building the PSXSDK, edit Makefile.cfg. TOOLCHAIN_PREFIX is very important,
it specifies the directory where the PSXSDK toolchain is installed in. In our example it is /usr/local/psxsdk (the default)
	
There should be explanations for the other variables. 
To build the PSXSDK go into its directory, change your path variable to include the PSXSDK toolchain binaries:

export PATH=$PATH:/usr/local/psxsdk/bin

and execute "make".

If everything went well, execute "make install".

PSXSDK should be ready to go!