Commenting and cleanup

This commit is contained in:
Thomas Lovén 2018-02-02 13:27:18 +01:00
parent 2451851b9f
commit eed3bb693b
3 changed files with 11 additions and 7 deletions

View File

@ -2,16 +2,17 @@ ifeq ($(MITTOS64),)
$(error Unsupported environment! See README) $(error Unsupported environment! See README)
endif endif
.PHONY: kernel clean CC = x86_64-elf-gcc
all: kernel all: kernel
kernel: kernel:
ifeq ($(shell make -sqC src/kernel || echo 1), 1) ifeq ($(shell make -sqC src/kernel || echo 1), 1)
$(MAKE) -C src/kernel install CC=$(CC) $(MAKE) -C src/kernel install
endif endif
clean: clean:
$(MAKE) -C src/kernel clean $(MAKE) -C src/kernel clean
rm -rf sysroot rm -rf sysroot
.PHONY: kernel clean

View File

@ -2,12 +2,11 @@ ifeq ($(MITTOS64),)
$(error Unsupported environment! See README) $(error Unsupported environment! See README)
endif endif
CC := x86_64-elf-gcc
SRC := $(wildcard **/*.[cS]) SRC := $(wildcard **/*.[cS])
OBJ := $(patsubst %, %.o, $(basename $(SRC))) OBJ := $(patsubst %, %.o, $(basename $(SRC)))
CFLAGS := -Wall -Wextra -pedantic -ffreestanding CFLAGS ?= -Wall -Wextra -pedantic
CFLAGS += -ffreestanding
CFLAGS += -ggdb -O0 CFLAGS += -ggdb -O0
ASFLAGS += -ggdb ASFLAGS += -ggdb
CPPFLAGS += -I include CPPFLAGS += -I include
@ -16,7 +15,8 @@ LDFLAGS := -n -nostdlib -lgcc -T Link.ld
kernel: $(OBJ) kernel: $(OBJ)
$(LINK.c) $^ -o $@ $(LINK.c) $^ -o $@
# Automatically generate dependency files
# Those keep track of which header files are used by which source files
DEP := $(OBJ:.o=.d) DEP := $(OBJ:.o=.d)
DEPFLAGS = -MT $@ -MMD -MP -MF $*.d DEPFLAGS = -MT $@ -MMD -MP -MF $*.d
$(OBJ): CPPFLAGS += $(DEPFLAGS) $(OBJ): CPPFLAGS += $(DEPFLAGS)
@ -33,6 +33,7 @@ install: $(DESTDIR)$(PREFIX)/kernel
clean: clean:
rm -rf $(OBJ) $(DEP) kernel rm -rf $(OBJ) $(DEP) kernel
.PHONY: install .PHONY: install clean
# Include generated dependency files
include $(DEP) include $(DEP)

View File

@ -7,6 +7,8 @@ iso=${BUILDROOT}mittos64.iso
mkdir -p ${sysroot} mkdir -p ${sysroot}
# Grub configuration file
# set to boot /kernel with minimal wait
mkdir -p ${sysroot}/boot/grub mkdir -p ${sysroot}/boot/grub
cat > ${sysroot}/boot/grub/grub.cfg << EOF cat > ${sysroot}/boot/grub/grub.cfg << EOF
set timeout=1 set timeout=1