95 lines
2.1 KiB
Bash
Executable File
95 lines
2.1 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
prefix=$( dirname "$0" )
|
|
usage="\
|
|
Uso: gamelib-config [--cflags] [--libs] [--static-libs] [--builddir] [--platform]"
|
|
|
|
if test $# -eq 0; then
|
|
echo "${usage}" 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
# Preparar configuracion
|
|
uname=$( uname )
|
|
unamem=$( uname -m )
|
|
gcctarget=$( gcc -dumpmachine )
|
|
if test $# -gt 0; then
|
|
if test $1 = "emscripten"; then
|
|
uname="EMSCRIPTEN"
|
|
shift
|
|
fi
|
|
if test $1 = "Darwin"; then
|
|
uname="Darwin"
|
|
shift
|
|
fi
|
|
fi
|
|
case "$uname" in
|
|
*MINGW* | *MSYS*)
|
|
# Configuracion de Win32/Mingw
|
|
libs="-lopengl32 $(sdl2-config --libs)"
|
|
cflags="-g -mwindows -D_GNU_SOURCE=1 -DWIN32 $(sdl2-config --cflags) -I$prefix/src"
|
|
builddir="build-$gcctarget"
|
|
platform="$gcctarget"
|
|
exeextension=".exe"
|
|
ldflags=""
|
|
;;
|
|
*EMSCRIPTEN*)
|
|
# Configuracion de Emscripten
|
|
libs=""
|
|
cflags="-s USE_SDL=2 -O2 -Wno-implicit-function-declaration -I$prefix/src"
|
|
builddir="build-emscripten"
|
|
platform="emscripten"
|
|
exeextension=".html"
|
|
ldflags="--preload-file data -s TOTAL_MEMORY=134217728 -lidbfs.js"
|
|
;;
|
|
*Darwin*)
|
|
# Configuracion de MacOSX
|
|
libs="-framework Cocoa -lm -framework OpenGL -framework SDL $prefix/macosx/SDLMain.m"
|
|
cflags="-Wall -g -DMACOSX -ObjC -Dmain=SDL_main -I/usr/include/ -I/usr/include/SDL/ -I/usr/X11R6/include/ -I$prefix/src"
|
|
builddir="build-$gcctarget"
|
|
platform="$gcctarget"
|
|
exeextension=""
|
|
ldflags=""
|
|
;;
|
|
*)
|
|
# Configuracion de Linux
|
|
libs="-lpthread -L/usr/X11R6/lib -L/usr/lib -lm -lGL -lX11 $(sdl2-config --libs)"
|
|
cflags="-Wall -g -I/usr/include/ -I/usr/X11R6/include/ $(sdl2-config --cflags) -I$prefix/src"
|
|
builddir="build-$gcctarget"
|
|
platform="$gcctarget"
|
|
exeextension=""
|
|
ldflags=""
|
|
;;
|
|
esac
|
|
|
|
while test $# -gt 0; do
|
|
case $1 in
|
|
--cflags)
|
|
echo "$cflags"
|
|
;;
|
|
--libs)
|
|
echo "$libs"
|
|
;;
|
|
--ldflags)
|
|
echo "$ldflags"
|
|
;;
|
|
--static-libs)
|
|
echo "$prefix/$builddir/libgame.a"
|
|
;;
|
|
--builddir)
|
|
echo "$builddir"
|
|
;;
|
|
--platform)
|
|
echo "$platform"
|
|
;;
|
|
--exe-extension)
|
|
echo "$exeextension"
|
|
;;
|
|
*)
|
|
echo "${usage}" 1>&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
shift
|
|
done
|