diff --git a/.gitignore b/.gitignore index 7033f9b..bc70311 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.elf *.o *.img -mnt/ \ No newline at end of file +mnt/ +build/ diff --git a/Makefile b/Makefile index 3628d5d..bf5ae48 100644 --- a/Makefile +++ b/Makefile @@ -1,24 +1,16 @@ -all: kernel-i386.elf +all: build/kernel-i386.elf clean: - -@rm *.o *.elf 2> /dev/null || true + -@rm build/*.o build/*.elf 2> /dev/null || true -start32.o: start32.asm - fasm start32.asm -kernel.o: kernel.c - tcc -m32 -c kernel.c -vga.o: vga.c - tcc -m32 -c vga.c -serial.o: serial.c - tcc -m32 -c serial.c -xtoa.o: xtoa.c - tcc -m32 -c xtoa.c -kernel-i386.elf: kernel.o start32.o vga.o serial.o xtoa.o - tcc -m32 -nostdlib -Wl,-Ttext,0x100000 start32.o kernel.o vga.o serial.o xtoa.o -o kernel-i386.elf +build/start32.o: build/ src/start32.asm + fasm src/start32.asm build/start32.o +build/kernel-i386.elf: build/start32.o + tcc -m32 -nostdlib -Wl,-Ttext,0x100000 -o build/kernel-i386.elf src/*.c build/start32.o -qemu-multiboot: kernel-i386.elf - qemu-system-i386 -kernel kernel-i386.elf -serial stdio -qemu-image: kernel-i386.elf mount - cp kernel-i386.elf mnt/ +qemu-multiboot: build/kernel-i386.elf + qemu-system-i386 -kernel build/kernel-i386.elf -serial stdio +qemu-image: build/kernel-i386.elf mount + cp build/kernel-i386.elf mnt/ sync qemu-system-i386 koalemos.img -serial stdio @@ -30,3 +22,5 @@ umount: @sudo umount mnt mnt/: @mkdir mnt +build/: + @mkdir build diff --git a/kernel.c b/src/kernel.c similarity index 100% rename from kernel.c rename to src/kernel.c diff --git a/multiboot.h b/src/multiboot.h similarity index 100% rename from multiboot.h rename to src/multiboot.h diff --git a/serial.c b/src/serial.c similarity index 100% rename from serial.c rename to src/serial.c diff --git a/serial.h b/src/serial.h similarity index 100% rename from serial.h rename to src/serial.h diff --git a/start32.asm b/src/start32.asm similarity index 100% rename from start32.asm rename to src/start32.asm diff --git a/vga.c b/src/vga.c similarity index 100% rename from vga.c rename to src/vga.c diff --git a/vga.h b/src/vga.h similarity index 100% rename from vga.h rename to src/vga.h diff --git a/xtoa.c b/src/xtoa.c similarity index 100% rename from xtoa.c rename to src/xtoa.c diff --git a/xtoa.h b/src/xtoa.h similarity index 100% rename from xtoa.h rename to src/xtoa.h