From eed3bb693b421a5d7b94ea8b6986d9cb7fcac56b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Lov=C3=A9n?= Date: Fri, 2 Feb 2018 13:27:18 +0100 Subject: [PATCH] Commenting and cleanup --- Makefile | 5 +++-- src/kernel/Makefile | 11 ++++++----- toolchain/mkiso | 2 ++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index a5902cb..8dc1c4e 100644 --- a/Makefile +++ b/Makefile @@ -2,16 +2,17 @@ ifeq ($(MITTOS64),) $(error Unsupported environment! See README) endif -.PHONY: kernel clean +CC = x86_64-elf-gcc all: kernel kernel: ifeq ($(shell make -sqC src/kernel || echo 1), 1) - $(MAKE) -C src/kernel install + CC=$(CC) $(MAKE) -C src/kernel install endif clean: $(MAKE) -C src/kernel clean rm -rf sysroot +.PHONY: kernel clean diff --git a/src/kernel/Makefile b/src/kernel/Makefile index a38f504..b44c048 100644 --- a/src/kernel/Makefile +++ b/src/kernel/Makefile @@ -2,12 +2,11 @@ ifeq ($(MITTOS64),) $(error Unsupported environment! See README) endif -CC := x86_64-elf-gcc - SRC := $(wildcard **/*.[cS]) OBJ := $(patsubst %, %.o, $(basename $(SRC))) -CFLAGS := -Wall -Wextra -pedantic -ffreestanding +CFLAGS ?= -Wall -Wextra -pedantic +CFLAGS += -ffreestanding CFLAGS += -ggdb -O0 ASFLAGS += -ggdb CPPFLAGS += -I include @@ -16,7 +15,8 @@ LDFLAGS := -n -nostdlib -lgcc -T Link.ld kernel: $(OBJ) $(LINK.c) $^ -o $@ - +# Automatically generate dependency files +# Those keep track of which header files are used by which source files DEP := $(OBJ:.o=.d) DEPFLAGS = -MT $@ -MMD -MP -MF $*.d $(OBJ): CPPFLAGS += $(DEPFLAGS) @@ -33,6 +33,7 @@ install: $(DESTDIR)$(PREFIX)/kernel clean: rm -rf $(OBJ) $(DEP) kernel -.PHONY: install +.PHONY: install clean +# Include generated dependency files include $(DEP) diff --git a/toolchain/mkiso b/toolchain/mkiso index 11d8a97..77f6c29 100755 --- a/toolchain/mkiso +++ b/toolchain/mkiso @@ -7,6 +7,8 @@ iso=${BUILDROOT}mittos64.iso mkdir -p ${sysroot} +# Grub configuration file +# set to boot /kernel with minimal wait mkdir -p ${sysroot}/boot/grub cat > ${sysroot}/boot/grub/grub.cfg << EOF set timeout=1