refactor: rewrite kernel's make script
[lunaix-os.git] / lunaix-os / makeinc / toolchain.mkinc
index 42fae9fa3dfc36c517946950fd5b0cb259dcb9b4..9496c5c15c1bd17d8f3fe36a210dad3ebadb19fc 100644 (file)
@@ -23,7 +23,15 @@ OFLAGS := -fno-gcse\
                  -fno-inline-small-functions \
                  -fno-indirect-inlining
 
-CFLAGS := -std=gnu99 -ffreestanding $(O) $(OFLAGS) $(W) $(ARCH_OPT)
+CFLAGS := -std=gnu99 -ffreestanding $(OFLAGS) $(W) $(ARCH_OPT)
+
+ifeq ($(BUILD_MODE),debug)
+       O = -Og
+       CFLAGS += -g
+endif
+
+CFLAGS += $(O)
+
 LDFLAGS := -ffreestanding $(O) -nostdlib -lgcc
 
 MKFLAGS := --no-print-directory
\ No newline at end of file