caos-with-snake/Makefile

33 lines
595 B
Makefile
Raw Normal View History

2022-09-21 16:53:45 +03:00
AS=x86_64-elf-as
LD=x86_64-elf-ld
2022-09-21 18:25:06 +03:00
CC=x86_64-elf-gcc
2022-09-21 16:53:45 +03:00
2022-09-21 18:25:06 +03:00
run: image.bin
2022-09-21 16:53:45 +03:00
qemu-system-i386 -drive format=raw,file=$<
2022-09-21 18:25:06 +03:00
debug: image.bin
2022-09-21 17:37:27 +03:00
qemu-system-i386 -drive format=raw,file=$< -s -S &
i386-elf-gdb \
-ex "target remote localhost:1234" \
-ex "set architecture i8086" \
-ex "break *0x7c00" \
-ex "continue"
2022-09-21 18:25:06 +03:00
image.bin: mbr.bin kernel.bin
cat $^ >$@
kernel.bin: kernel.o
$(LD) -m elf_i386 -o $@ -Ttext 0x1000 $^ --oformat binary
%.o: %.c
$(CC) -m32 -ffreestanding -c $< -o $@
2022-09-21 16:53:45 +03:00
%.o: %.S
$(AS) $^ -o $@
mbr.bin: mbr.o
$(LD) -Ttext=0x7c00 --oformat=binary $^ -o $@
2022-09-21 17:37:27 +03:00
clean:
rm *.bin *.o