kernel/Makefile

27 lines
774 B
Makefile

all: build/kernel-i386.elf
clean:
-@rm build/*.o build/*.elf 2> /dev/null || true
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
image: build/kernel-i386.elf mount
cp build/kernel-i386.elf mnt/
sync
qemu-multiboot: build/kernel-i386.elf
qemu-system-i386 -kernel build/kernel-i386.elf -serial stdio
qemu-image: image
qemu-system-i386 koalemos.img -serial stdio
mount: koalemos.img mnt/
@if ! mountpoint -q "mnt/"; then \
sudo mount -o loop,offset=1048576,umask=177,dmask=022,uid=$(shell id -u),gid=$(shell id -g) koalemos.img mnt/; \
fi;
umount:
@sudo umount mnt
mnt/:
@mkdir mnt
build/:
@mkdir build