aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2021-08-26 20:41:45 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2021-08-26 20:43:08 +0300
commit07af47eca912f3b56f013749a268718d78656961 (patch)
tree1bb933b33af06b9ae1e4849a9e108de1a695a894 /Makefile
parent5dfac4879ce5f34503ae7537eefd3fc48d6fa750 (diff)
downloadkmi-07af47eca912f3b56f013749a268718d78656961.tar.gz
kmi-07af47eca912f3b56f013749a268718d78656961.zip
Added debug flags and simple debug serial driver
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile7
1 files changed, 4 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 5097ff0..187c269 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,7 @@
DO != echo > deps.mk
-CFLAGS = -fno-pie -ggdb3 -ffreestanding -nostdlib -std=c11 -Wall -Wextra -mcmodel=medany
+DEBUGFLAGS != [ $(DEBUG) ] && echo "-g3 -DDEBUG" || echo "-O2"
+CFLAGS = -fno-pie -ffreestanding -nostdlib -std=c11 -Wall -Wextra
DEPFLAGS = -MT $@ -MMD -MP -MF $@.d
all: apos.bin
@@ -26,8 +27,8 @@ include arch/$(ARCH)/source.mk
INCLUDE_FLAGS := -I include -I arch/$(ARCH)/include\
-include config.h -include arch/$(ARCH)/config.h
-COMPILE = $(CROSS_COMPILE)$(CC) $(CFLAGS) $(DEPFLAGS) $(INCLUDE_FLAGS)
-GENELF = $(CROSS_COMPILE)$(CC) $(CFLAGS) $(INCLUDE_FLAGS)
+COMPILE = $(CROSS_COMPILE)$(CC) $(DEBUGFLAGS) $(CFLAGS) $(ARCH_FLAGS) $(DEPFLAGS) $(INCLUDE_FLAGS)
+GENELF = $(CROSS_COMPILE)$(CC) $(DEBUGFLAGS) $(CFLAGS) $(ARCH_FLAGS) $(INCLUDE_FLAGS)
GENLINK = $(CROSS_COMPILE)$(CPP) $(DEPFLAGS) $(INCLUDE_FLAGS)
STRIPLINK = sed -n '/^[^\#]/p'