From 9415a40263a6b244965065f300509490a53b7cfb Mon Sep 17 00:00:00 2001 From: rick Date: Wed, 13 Sep 2023 16:31:15 +0200 Subject: [PATCH] better folders structures --- Makefile | 9 ++++++++- framebuffer.h => include/framebuffer.h | 0 io.h => include/io.h | 0 kmain.c | 4 ++-- framebuffer.c => src/framebuffer.c | 0 io.s => src/io.s | 0 6 files changed, 10 insertions(+), 3 deletions(-) rename framebuffer.h => include/framebuffer.h (100%) rename io.h => include/io.h (100%) rename framebuffer.c => src/framebuffer.c (100%) rename io.s => src/io.s (100%) diff --git a/Makefile b/Makefile index a15af4e..31d3179 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,8 @@ OBJECTS = loader.o framebuffer.o io.o kmain.o CC = gcc CFLAGS = -m32 -nostdlib -nostdinc -fno-builtin -fno-stack-protector \ - -nostartfiles -nodefaultlibs -c #-Wall -Wextra -Werror -c + -nostartfiles -nodefaultlibs -Iinclude -Wall -Wextra -Werror -c \ + -ansi -pedantic LDFLAGS = -T link.ld -melf_i386 @@ -17,9 +18,15 @@ kernel.elf: $(OBJECTS) %.o: %.c $(CC) $(CFLAGS) $< -o $@ +%.o: src/%.c + $(CC) $(CFLAGS) $< -o $@ + %.o: %.s $(AS) $(ASFLAGS) $< -o $@ +%.o: src/%.s + $(AS) $(ASFLAGS) $< -o $@ + os.iso: kernel.elf cp kernel.elf iso/boot/kernel.elf mkisofs -R \ diff --git a/framebuffer.h b/include/framebuffer.h similarity index 100% rename from framebuffer.h rename to include/framebuffer.h diff --git a/io.h b/include/io.h similarity index 100% rename from io.h rename to include/io.h diff --git a/kmain.c b/kmain.c index 0112afa..e706548 100644 --- a/kmain.c +++ b/kmain.c @@ -1,8 +1,8 @@ #include "framebuffer.h" -int write(char *buf, unsigned int len) +unsigned int write(char *buf, unsigned int len) { - int ret = 0; + unsigned int ret = 0; int pos = 0; fb_move_cursor(ret); diff --git a/framebuffer.c b/src/framebuffer.c similarity index 100% rename from framebuffer.c rename to src/framebuffer.c diff --git a/io.s b/src/io.s similarity index 100% rename from io.s rename to src/io.s