summaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
authorPeter Fors <peter.fors@mindkiller.com>2025-05-02 23:15:47 +0200
committerPeter Fors <peter.fors@mindkiller.com>2025-05-02 23:15:47 +0200
commit5808f00555c48e1cc1cc110af6a5cd73ddf13010 (patch)
treedff942b61441bafe297e7a99f0e799f32ae978b1 /build.sh
parent9463faa436e1b981ef72000568445a83682f2658 (diff)
cleanup and rewrite of ppu_registers.c
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh22
1 files changed, 16 insertions, 6 deletions
diff --git a/build.sh b/build.sh
index 1e88141..02d50d3 100755
--- a/build.sh
+++ b/build.sh
@@ -3,12 +3,13 @@
# Set the project name here
PROJECT_NAME="mknes" # Change this for each new project
+CC=gcc-14
+
# Base configuration common to all builds
CFLAGS="-std=gnu11 -mtune=generic "
-CFLAGS+="-mbmi2 "
-CFLAGS+="-mfunction-return=keep "
-CFLAGS+="-mindirect-branch=keep "
-CFLAGS+="-fwrapv -ffast-math -fno-trapping-math -fwhole-program -fvisibility=hidden "
+CFLAGS+="-mbmi -mbmi2 "
+CFLAGS+="-mfunction-return=keep -mindirect-branch=keep "
+CFLAGS+="-fwrapv -ffast-math -fno-trapping-math -fvisibility=hidden "
CFLAGS+="-fno-stack-protector -fno-PIE -no-pie -fno-strict-aliasing -fcf-protection=none -ffunction-sections -fdata-sections "
# CFLAGS+="-fno-exceptions -fno-rtti -fno-use-cxa-atexit "
CFLAGS+="-fno-non-call-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables "
@@ -47,7 +48,7 @@ case "$BUILD_TYPE" in
CFLAGS+=" -s -Wl,--strip-all -O2"
;;
"profile")
- CFLAGS+=" -g -O2 -fprofile-generate"
+ CFLAGS+=" -g -O2 -fprofile-generate -ftest-coverage"
;;
"profile_release")
CFLAGS+=" -s -Wl,--strip-all -O2 -fprofile-use"
@@ -56,6 +57,15 @@ case "$BUILD_TYPE" in
CFLAGS+=" -g -O0"
LDFLAGS+=" -fno-pie -no-pie"
;;
+ "coverage")
+ gcov -b -c *.c
+ exit 0
+ ;;
+
+ "clean")
+ rm -f *.gcda *.gcno *.gcov
+ exit 0
+ ;;
*)
echo "Unknown build type: $BUILD_TYPE"
exit 1
@@ -72,7 +82,7 @@ set -e
# Build Linux version
(
# ../bin/ctime -begin .${PROJECT_NAME}_linux
- gcc $CFLAGS ${PROJECT_NAME}.c -o ${PROJECT_NAME} $INCLUDE_PATHS $LINUX_INCLUDE $LDFLAGS $LINUX_LIBS
+ $CC $CFLAGS ${PROJECT_NAME}.c -o ${PROJECT_NAME} $INCLUDE_PATHS $LINUX_INCLUDE $LDFLAGS $LINUX_LIBS
# ../bin/ctime -end .${PROJECT_NAME}_linux $?
) &