Add ability to disable debug printing and gdb symbols
This commit is contained in:
parent
a9831c1038
commit
572bee19cc
@ -7,8 +7,13 @@ OBJ := $(patsubst %, %.o, $(basename $(SRC)))
|
|||||||
|
|
||||||
CFLAGS ?= -Wall -Wextra -pedantic
|
CFLAGS ?= -Wall -Wextra -pedantic
|
||||||
CFLAGS += -ffreestanding -mcmodel=large
|
CFLAGS += -ffreestanding -mcmodel=large
|
||||||
|
ifndef NDEBUG
|
||||||
CFLAGS += -ggdb -O0
|
CFLAGS += -ggdb -O0
|
||||||
ASFLAGS += -ggdb
|
ASFLAGS += -ggdb
|
||||||
|
else
|
||||||
|
CFLAGS += -O3 -mno-sse
|
||||||
|
CPPFLAGS += -DNDEBUG
|
||||||
|
endif
|
||||||
CPPFLAGS += -I include
|
CPPFLAGS += -I include
|
||||||
LDFLAGS := -n -nostdlib -lgcc -T Link.ld
|
LDFLAGS := -n -nostdlib -lgcc -T Link.ld
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@ void kmain()
|
|||||||
serial_init(PORT_COM1);
|
serial_init(PORT_COM1);
|
||||||
vga_init();
|
vga_init();
|
||||||
|
|
||||||
debug_printf("Hello from debug printing function!\n");
|
debug("Hello from debug printing function!\n");
|
||||||
debug_printf("A number:%d\n", 12345);
|
debug("A number:%d\n", 12345);
|
||||||
for(;;);
|
for(;;);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,11 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
#define debug(...) debug_printf(__VA_ARGS__)
|
#define debug(...) debug_printf(__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define debug(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
void debug_putch(char c);
|
void debug_putch(char c);
|
||||||
void debug_putsn(char *s, size_t n);
|
void debug_putsn(char *s, size_t n);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user