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