Apparently the order of LDFLAGS matters to some compilers.

Also don't to -pg in debug mode, because that's not supported on all
compilers either.
This commit is contained in:
Jordan Bancino 2023-03-22 00:13:27 +00:00
parent 63d07365db
commit d1b4ecff48

View file

@ -38,8 +38,7 @@ LDFLAGS="${LDFLAGS} ${STATIC}"
MAIN="Main" MAIN="Main"
if [ "$DEBUG" = "1" ]; then if [ "$DEBUG" = "1" ]; then
CFLAGS="$CFLAGS -O0 -g -pg" CFLAGS="$CFLAGS -O0 -g"
LDFLAGS="-lm -pthread"
PROG="$PROG-debug" PROG="$PROG-debug"
fi fi
@ -119,7 +118,7 @@ recipe_build() {
cd .. cd ..
if [ $do_rebuild -eq 1 ] || [ ! -f "build/$PROG" ]; then if [ $do_rebuild -eq 1 ] || [ ! -f "build/$PROG" ]; then
echo "LD $PROG" echo "LD $PROG"
$CC $LDFLAGS -o "build/$PROG" $objs "build/$MAIN.o" $CC -o "build/$PROG" $objs ${LDFLAGS} "build/$MAIN.o"
fi fi
for src in $(find tools/src -name '*.c'); do for src in $(find tools/src -name '*.c'); do
@ -129,7 +128,7 @@ recipe_build() {
if [ $(mod_time "$src") -ge $(mod_time "$out") ] || [ $do_rebuild -eq 1 ]; then if [ $(mod_time "$src") -ge $(mod_time "$out") ] || [ $do_rebuild -eq 1 ]; then
echo "CC $(basename $out)" echo "CC $(basename $out)"
mkdir -p "$(dirname $out)" mkdir -p "$(dirname $out)"
if ! $CC $CFLAGS $LDFLAGS -Isrc/include -o "$out" $objs "$src"; then if ! $CC $CFLAGS -Isrc/include -o "$out" $objs ${LDFLAGS} "$src"; then
exit 1 exit 1
fi fi
fi fi