Loader moved into new build workflow

This commit is contained in:
2023-03-30 22:17:49 -07:00
parent ee7e44fbaf
commit 044d5a75b5
3 changed files with 22 additions and 19 deletions

View File

@@ -3,19 +3,21 @@ ASM=nasm
LINK=ld
ISO=genisoimage
OBJECTS=mem.o kernel.o gdt_seg.o gdt.o interrupts.o loader.o serial.o \
framebuffer.o ports.o stlio.o tests.o interrupt_entry.o pit.o kbd.o\
shell.o
BUILD_DIR=build
COMPONENTS=loader
# Rebuild the components var to be usable in recipes
OBJECTS := $(addprefix build/,$(addsuffix .o,$(COMPONENTS)))
AFLAGS=-f elf32
CFLAGS=-masm=intel -O2 -m32 -nostdlib -nostdinc -fno-builtin -fno-stack-protector -nostartfiles \
-nodefaultlibs -Wall -Wextra -c #-Werror -c
all: kernel.elf
compile: kernel.elf
# Link objects together to produce the kernel object
kernel.elf: $(OBJECTS)
$(LINK) -T link.ld -melf_i386 $(OBJECTS) -o kernel.elf
kernel.elf: $(COMPONENTS)
$(LINK) -T link.ld -melf_i386 $(OBJECTS) -o build/$@
# Builds image of our os
jos.iso: kernel.elf
@@ -30,17 +32,15 @@ jos.iso: kernel.elf
-o jos.iso \
iso
# Builind asm objects
%.o: %.s
$(ASM) $(AFLAGS) $< -o $@
# Components which make up the OS
loader: loader/main.s
$(ASM) $(AFLAGS) $< -o $(BUILD_DIR)/$@.o
# Building C objecets
%.o: %.c
$(CC) $(CFLAGS) $< -o $@
# Running (no recipes called)
run: jos.iso
bochs -f bochsrc.conf -q
clean:
rm -f build/*
rm -rf *.o kernel.elf jos.iso bochslog.txt