#!/bin/bash
-ROOT=`pwd`
-SRC=$ROOT/
-LIB=$ROOT/external/lib
-BIN=$ROOT/bin
+mkdir -p bin
+
+if [ "$1" == "mingw32" ]; then
+ buildscripts/build.mingw32
+elif [ "$1" == "mingw64" ]; then
+ buildscripts/build.mingw64
+elif [ "$1" == "linux" ]; then
+ buildscripts/build.generic
+elif [ "$1" == "linux32" ]; then
+ buildscripts/build.x86_64-m32
+elif [ "$1" == "generic" ]; then
+ buildscripts/build.generic
+elif [ "$1" == "clean" ]; then
+ rm -rf bin
+ echo "Removed bin directory."
+else
+ echo "Targets: mingw32, mingw64, linux, linux32, generic"
+ echo "Operations: clean"
+fi
-mkdir $LIB
-mkdir $BIN
-
-CXXFLAGS="-g -DGIT_REV=\"$(git rev-parse HEAD)\""
-
-source mk
-
-INCLUDE="-I$ROOT/external/include/zero -I$ROOT/vndc/include"
-
-newtd
- mkmcc external/src/zero
- mkar libZero
-deltd
-
-LDFLAGS=-lZero
-
-newtd
- mkmcc vndc/src
- mkld vndc
-deltd
+++ /dev/null
-#!/bin/bash
-
-ROOT=`pwd`
-SRC=$ROOT/
-LIB=$ROOT/external/lib
-BIN=$ROOT/bin
-CXXFLAGS="-m32"
-LDFLAGS="-m32"
-INCLUDE="-I$ROOT/external/include/zero -I$ROOT/vndc/include"
-
-source mk
-
-newtd
- mkmcc external/src/zero
- mkar libZero
-deltd
-
-LDFLAGS=-lZero
-
-newtd
- mkmcc vndc/src
- mkld vndc.32
-deltd
+++ /dev/null
-#!/bin/bash
-
-ROOT=`pwd`
-SRC=$ROOT/
-LIB=$ROOT/external/lib
-BIN=$ROOT/bin
-CXXFLAGS="-static -static-libgcc -static-libstdc++"
-source mk
-CXX="x86_64-w64-mingw32-g++"
-
-INCLUDE="-I$ROOT/external/include/zero -I$ROOT/vndc/include"
-
-newtd
- mkmcc external/src/zero
- mkar libZero.w64
-deltd
-
-LDFLAGS=-lZero
-
-newtd
- mkmcc vndc/src
- mkld vndc64.exe
-deltd
--- /dev/null
+#!/bin/bash
+
+##
+## Use this build script to build on
+## a unix system for the current unix
+## system. Linux, freebsd, openbsd, etc.
+##
+
+ROOT=`pwd`
+SRC=$ROOT/
+LIB=$ROOT/external/lib
+BIN=$ROOT/bin
+
+CXXFLAGS="-DGIT_REV=\"$(git rev-parse HEAD)\""
+
+source buildscripts/mk
+
+INCLUDE="-I$ROOT/external/include/zero -I$ROOT/vndc/include"
+
+newtd
+ mkmcc external/src/zero
+ mkmcc vndc/src
+ mkld vndc.`uname -m`
+deltd
--- /dev/null
+#!/bin/bash
+
+##
+## Use this to build a 32bit windows binary.
+## At the moment, I haven't quite figured out static
+## linking yet.
+##
+
+
+ROOT=`pwd`
+SRC=$ROOT/
+LIB=$ROOT/external/lib/
+BIN=$ROOT/bin
+
+CXXFLAGS="-I$ROOT/external/deps/i686-w64-mingw32/include -DGIT_REV=\"$(git rev-parse HEAD)\""
+
+source buildscripts/mk
+
+LDFLAGS="-L$ROOT/external/deps/i686-w64-mingw32/lib -lmingw32 -lSDL2main -lSDL2 -lSDL2_mixer -lSDL2_image -lSDL2_ttf -Dmain=SDL_main -Wl,--no-undefined -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -static-libgcc -static-libstdc++"
+
+CXX=i686-w64-mingw32-g++
+LD=i686-w64-mingw32-g++
+
+# On windows ar doesn't really work
+
+INCLUDE="-I$ROOT/external/include/zero -I$ROOT/vndc/include"
+
+newtd
+ mkmcc external/src/zero
+ mkmcc vndc/src
+ mkld vndc.exe
+deltd
+
+# Windows static link is being derpy.
+cp external/deps/i686-w64-mingw32/bin/*.dll bin/
#!/bin/bash
+##
+## Use this to build a 64bit windows binary.
+## At the moment, I haven't quite figured out static
+## linking yet.
+##
+
+
ROOT=`pwd`
SRC=$ROOT/
-LIB=$ROOT/external/lib/
BIN=$ROOT/bin
CXXFLAGS="-I$ROOT/external/deps/x86_64-w64-mingw32/include -DGIT_REV=\"$(git rev-parse HEAD)\""
-source mk
+source buildscripts/mk
LDFLAGS="-L$ROOT/external/deps/x86_64-w64-mingw32/lib -lmingw32 -lSDL2main -lSDL2 -lSDL2_mixer -lSDL2_image -lSDL2_ttf -Dmain=SDL_main -Wl,--no-undefined -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -static-libgcc -static-libstdc++"
--- /dev/null
+#!/bin/bash
+
+##
+## Use this on a linux 64-bit system (or any
+## system that provides -m32 for 32bit) to
+## build using gcc multilib features
+##
+
+if [ "`uname -m`" != "x86_64" ]; then
+ echo "You aren't running a multilib gcc. I quit."
+ exit 1
+fi
+
+ROOT=`pwd`
+SRC=$ROOT/
+LIB=$ROOT/external/lib
+BIN=$ROOT/bin
+CXXFLAGS="-m32 -DGIT_REV=\"$(git rev-parse HEAD)\""
+LDFLAGS="-m32"
+INCLUDE="-I$ROOT/external/include/zero -I$ROOT/vndc/include"
+
+source buildscripts/mk
+
+newtd
+ mkmcc external/src/zero
+ mkmcc vndc/src
+ mkld vndc.x86
+deltd