Jarkko Toivanen
e21e42d318
If I'm gonna port a C compiler I might as well use and port NASM as it is more widely used anyway
27 lines
785 B
Makefile
27 lines
785 B
Makefile
all: build/kernel-i386.elf
|
|
clean:
|
|
-@rm build/*.o build/*.elf 2> /dev/null || true
|
|
|
|
build/start32.o: build/ src/start32.asm
|
|
nasm -felf32 src/start32.asm -o 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
|