2022-06-16 08:38:58 -06:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
if test "x$CC" = "x"; then
|
2022-07-30 14:08:07 -06:00
|
|
|
CC=cc
|
2022-06-16 08:38:58 -06:00
|
|
|
fi
|
|
|
|
|
|
|
|
machine="$($CC -dumpmachine)"
|
|
|
|
case "$machine" in
|
|
|
|
*mingw* )
|
|
|
|
EXEPREFIX=""
|
|
|
|
EXESUFFIX=".exe"
|
|
|
|
;;
|
|
|
|
*android* )
|
|
|
|
EXEPREFIX="lib"
|
|
|
|
EXESUFFIX=".so"
|
|
|
|
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -shared"
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
EXEPREFIX=""
|
|
|
|
EXESUFFIX=""
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Get the canonical path of the folder containing this script
|
|
|
|
testdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
|
|
|
|
CFLAGS="$( sdl2-config --cflags )"
|
|
|
|
LDFLAGS="$( sdl2-config --libs )"
|
2022-07-25 15:35:59 -06:00
|
|
|
STATIC_LDFLAGS="$( sdl2-config --static-libs )"
|
2022-06-16 08:38:58 -06:00
|
|
|
|
|
|
|
compile_cmd="$CC -c "$testdir/main_gui.c" -o main_gui_sdlconfig.c.o $CFLAGS $EXTRA_CFLAGS"
|
|
|
|
link_cmd="$CC main_gui_sdlconfig.c.o -o ${EXEPREFIX}main_gui_sdlconfig${EXESUFFIX} $LDFLAGS $EXTRA_LDFLAGS"
|
2022-07-25 15:35:59 -06:00
|
|
|
static_link_cmd="$CC main_gui_sdlconfig.c.o -o ${EXEPREFIX}main_gui_sdlconfig_static${EXESUFFIX} $STATIC_LDFLAGS $EXTRA_LDFLAGS"
|
2022-06-16 08:38:58 -06:00
|
|
|
|
2022-07-25 15:35:59 -06:00
|
|
|
echo "-- CC: $CC"
|
|
|
|
echo "-- CFLAGS: $CFLAGS"
|
|
|
|
echo "-- EXTRA_CFLAGS: $EXTRA_CFLAGS"
|
|
|
|
echo "-- LDFLAGS: $LDFLAGS"
|
|
|
|
echo "-- STATIC_LDFLAGS: $STATIC_LDFLAGS"
|
|
|
|
echo "-- EXTRA_LDFLAGS: $EXTRA_LDFLAGS"
|
2022-06-16 08:38:58 -06:00
|
|
|
|
2022-07-25 15:35:59 -06:00
|
|
|
echo "-- COMPILE: $compile_cmd"
|
|
|
|
echo "-- LINK: $link_cmd"
|
|
|
|
echo "-- STATIC_LINK: $static_link_cmd"
|
2022-06-16 08:38:58 -06:00
|
|
|
|
|
|
|
set -x
|
|
|
|
|
|
|
|
$compile_cmd
|
|
|
|
$link_cmd
|
2022-07-25 15:35:59 -06:00
|
|
|
$static_link_cmd
|