44d9d66a40251c33dce5d47965a24c22a4f37c75
[eightysix] / Makefile
1 disk_numsec = 720
2 #disk_numsec = 2880
3
4 bin = bootldr
5 img = bootldr.img
6
7 CC = ia16-elf-gcc
8 LD = ia16-elf-ld
9
10 CFLAGS = -march=i8088 -mtune=i8088
11
12 $(img): $(bin)
13         dd if=/dev/zero of=$@ bs=512 count=$(disk_numsec)
14         dd if=$< of=$@ bs=512 conv=notrunc
15
16 $(bin): boot/boot.o boot/boot2.o boot/main.o
17         $(LD) -T boot.ld -Map boot.map -o $@ $^
18
19 %.o: %.asm
20         nasm -o $@ -f elf $<
21
22 .PHONY: clean
23 clean:
24         rm -f boot/*.o $(bin)
25
26
27 .PHONY: run
28 run: $(img)
29         qemu-system-i386 -fda $(img) -serial file:serial.log
30
31 .PHONY: debug
32 debug: $(img)
33         qemu-system-i386 -fda $(img) -serial file:serial.log -s -S
34
35 .PHONY: disasm
36 disasm: $(bin)
37         ndisasm -o 0x7c00 $< >dis1
38         ndisasm -o 0x80000 -e 512 $< >dis2