Debug options for user apps and libs

This commit is contained in:
2026-03-06 00:17:08 +01:00
parent d7dc141874
commit f725beb433
2 changed files with 34 additions and 19 deletions

View File

@@ -2,21 +2,22 @@
set -xe set -xe
debugopt=""
if [ "$1" = "debug" ]; then if [ "$1" = "debug" ]; then
make -B all_kernel buildtype=debug debugopt="buildtype=debug"
else
make -B all_kernel
fi fi
make -B all_libsystem make -B all_kernel "$debugopt"
make -B all_liballoc make -B all_libsystem "$debugopt"
make -B all_libprocess make -B all_liballoc "$debugopt"
make -B all_libterminal make -B all_libprocess "$debugopt"
make -B all_libstring make -B all_libterminal "$debugopt"
make -B all_libkb make -B all_libstring "$debugopt"
make -B all_libaux make -B all_libkb "$debugopt"
make -B all_libarena make -B all_libaux "$debugopt"
make -B all_libioutil make -B all_libarena "$debugopt"
make -B all_apps make -B all_libioutil "$debugopt"
make -B all_apps "$debugopt"
make -B all_dist make -B all_dist
./aux/limine_iso_amd64.sh ./aux/limine_iso_amd64.sh

View File

@@ -5,9 +5,15 @@ cflags += -nostdinc \
-std=c11 \ -std=c11 \
-pedantic \ -pedantic \
-Wall \ -Wall \
-Wextra \ -Wextra
-ffunction-sections \
-fdata-sections ifeq ($(buildtype),debug)
cflags += -O0 -g
endif
ifeq ($(buildtype),release)
cflags += -ffunction-sections -fdata-sections -Oz
endif
cflags += -isystem ../include cflags += -isystem ../include
@@ -15,6 +21,14 @@ ldflags += -ffreestanding \
-nostdlib \ -nostdlib \
-fno-builtin \ -fno-builtin \
-fuse-ld=lld \ -fuse-ld=lld \
-static \ -static
-Wl,--gc-sections \
-flto ifeq ($(buildtype),debug)
ldflags += -g
endif
ifeq ($(buildtype),release)
ldflags += -Wl,--gc-sections \
-Wl,--strip-all \
-flto
endif