6d20b2892cca5c9c8759bd3c944852115771e56e
[ld45_start_nothing] / Makefile
1 src = $(wildcard src/*.asm)
2 bin = game
3
4 QEMU_FLAGS = -fda floppy.img -serial file:serial.log -soundhw sb16 -d guest_errors
5
6 .PHONY: all
7 all: floppy.img
8
9 bootldr: src/boot/boot.asm $(bin)
10         nasm -o $@ -f bin -DBINSIZE=`ls -l $(bin) | awk '{print $$5}'` $<
11
12 $(bin): $(src)
13         nasm -o $@ -f bin -i src/ src/main.asm
14
15 boot.img: bootldr $(bin)
16         cat $^ >$@
17
18 floppy.img: boot.img
19         dd of=$@ if=/dev/zero bs=512 count=2880
20         dd of=$@ if=$< bs=1 conv=notrunc
21
22 .PHONY: clean
23 clean:
24         rm -f $(bin) bootldr floppy.img boot.img
25
26 .PHONY: disasm
27 disasm: bootldr.disasm $(bin).disasm
28
29 bootldr.disasm: bootldr
30         ndisasm -b 16 -o 7c00h $< >$@
31
32 $(bin).disasm: $(bin)
33         ndisasm -b 16 -o 7e00h $< >$@
34
35 .PHONY: run
36 run: $(bin)
37         qemu-system-i386 $(QEMU_FLAGS)
38
39 .PHONY: debug
40 debug: $(bin)
41         qemu-system-i386 $(QEMU_FLAGS) -s -S