Bootable multiboot2 kernel

This commit is contained in:
2022-01-02 17:25:07 +01:00
parent fdcb46d6f2
commit e0979ed357
10 changed files with 107 additions and 2 deletions

33
src/kernel/Makefile Normal file
View File

@@ -0,0 +1,33 @@
CC := x86_64-elf-gcc
SRC := $(wildcard **/*.[cS])
OBJ := $(patsubst %, %.o, $(basename $(SRC)))
CFLAGS := -Wall -Wextra -pedantic -ffreestanding
CFLAGS += -ggdb -O0
ASFLAGS += -ggdb
CPPFLAGS += -I include
LDFLAGS := -n -nostdlib -lgcc -T Link.ld
kernel: $(OBJ)
$(LINK.c) $^ -o $@
DEP := $(OBJ:.o=.d)
DEPFLAGS = -MT $@ -MMD -MP -MF $*.d
$(OBJ): CPPFLAGS += $(DEPFLAGS)
%.d: ;
DESTDIR ?= $(BUILDROOT)/sysroot
$(DESTDIR)$(PREFIX)/kernel: kernel
install -D kernel $(DESTDIR)$(PREFIX)/kernel
install: $(DESTDIR)$(PREFIX)/kernel
clean:
rm -rf $(OBJ) $(DEP) kernel
.PHONY: install
include $(DEP)