INSTALLING 64-BIT AND 32-BIT GCC 7.2 EXECUTABLES THAT CAN COMPILE TO 64-BIT AND 32-BIT CODE,
RESPECTIVELY (MY FOLDER STRUCTURE).

To do this install, I install two of the mingw-64 automated builds under one folder and
then make some slight adjustments to them.  The combined distribution takes up about 605 MiB
of disk space.

Feb 2, 2017
-----------
1. Download these two distros:
    a. x86_64-7.2.0-release-win32-seh-rt_v5-rev1.7z
        Folder:  Win64 Toolchain
    b. i686-7.2.0-release-win32-dwarf-rt_v5-rev1.7z
        Folder:   Win32 Toolchain
   (available from http://sourceforge.net/projects/mingw-w64)
   See the Stack Overflow Page for the difference between seh, sjlj, and dwarf distros.

2. Extract the two distros under a root folder like "d:\mingw"

3. Move to d:\mingw (or whatever the intall folder is) and run the gosetup.bat script
   from that folder.  Make sure make.exe, rsxnt.dll, and floatmod.exe are in d:\mingw
   before running the script if you want those files (floatmod.exe is required for the
   script to run successfully).

   The install script will create a directory structure like so:

        d:\mingw
            +- x64        (re-named from \mingw64)
               +- include (from \mingw64\include and \mingw64\x86_64-w64-mingw32\include)
               +- libexec (from \mingw64\libexec)
               +- lib     (from \mingw64\lib and \mingw64\x86_64-w64-mingw32\lib)
               +- bin     (from \mingw64\bin)
            +- x32        (re-named from \mingw32)
               +- include (from \mingw32\include and \mingw32\i686-w64-mingw32\include)
               +- libexec (from \mingw32\libexec)
               +- lib     (from \mingw32\lib and \mingw32\i686-w64-mingw32\lib)
               +- bin     (from \mingw32\bin)

4. Optimizations

   a. One-pass max:  -Ofast -flto -fomit-frame-pointer -momit-leaf-frame-pointer
                     -fgraphite-identity -floop-interchange -floop-block
                     -floop-parallelize-all -ftree-loop-distribution
                     -ftree-parallelize-loops=2 -pthread -m64 -Wall

   b. Profile generate:  -Ofast -flto -fomit-frame-pointer -momit-leaf-frame-pointer
                         -fgraphite-identity -floop-interchange -floop-block -pthread
                         -floop-parallelize-all -ftree-parallelize-loops=4
                         -ftree-loop-distribution -march=native -m64 -Wall
                         -fprofile-generate=d:\gcc_profiles

   c. Profile use:  -Ofast -flto -fomit-frame-pointer -momit-leaf-frame-pointer
                    -fgraphite-identity -floop-interchange -floop-block -pthread
                    -floop-parallelize-all -ftree-parallelize-loops=4
                    -ftree-loop-distribution -march=native -m64 -Wall
                    -fprofile-use=d:\gcc_profiles

5. Scripts to set environment/path
   (make sure to update the version number in the cplus_include_path environment variable)
   
   a. go64.bat (for 64-bit compiles):
        @echo off
        call goclear.bat (removes all other compiler dirs from path)
        call _repath.bat
        del _repath.bat
        repath -u c:\mingw* -e d:\mingw\x64\bin
        repath -e d:\mingw\x64\bin
        call _repath.bat
        del _repath.bat
        set c_include_path=d:\my_include;d:\mingw\x64\include
        set cplus_include_path=d:\my_include;d:\mingw\x64\lib\gcc\x86_64-w64-mingw32\7.2.0\include;d:\mingw\x64\lib\gcc\x86_64-w64-mingw32\7.2.0\include\c++;d:\mingw\x64\lib\gcc\x86_64-w64-mingw32\7.2.0\include\c++\backward;d:\mingw\x64\include
        set library_path=d:\my_libs\mingw64;d:\mingw\x64\lib
        set cflags=-Ofast -m64 -Wall
        gcc -v

   b. go32.bat (for 32-bit compiles):
        @echo off
        call goclear.bat (removes all other compiler dirs from path)
        call _repath.bat
        del _repath.bat
        repath -u c:\mingw* -e d:\mingw\x32\bin
        call _repath.bat
        del _repath.bat
        set c_include_path=d:\my_include;d:\mingw\x32\include
        set cplus_include_path=d:\my_include;d:\mingw\x32\lib\gcc\i686-w64-mingw32\7.2.0\include;d:\mingw\x32\lib\gcc\i686-w64-mingw32\7.2.0\include\c++;d:\mingw\x32\lib\gcc\i686-w64-mingw32\7.2.0\include\c++\backward;d:\mingw\x32\include
        set library_path=d:\my_libs\mingw32;d:\mingw\x32\lib
        set cflags=-Ofast -m32 -Wall
        gcc -v