]> git.lizzy.rs Git - nyax.git/blob - Makefile
22c47b6509421facec1d91873787e4af49b16497
[nyax.git] / Makefile
1 STAGE3 = stage3/main.o stage3/framebuffer.o stage3/memory.o stage3/paging.o
2
3 nyax.img: stage1.out stage2.out stage3.out
4         cat stage{1,2,3}.out > nyax.img
5
6 stage1.out: stage1/main.asm stage1/print.asm stage2.out stage3.out
7         nasm -f bin stage1/main.asm -o stage1.out \
8                 -dKSIZE=$$(du -cb stage{2,3}.out | tail -n1 | cut -f1)
9
10 stage2.out: stage2/main.asm stage2/mmap.asm stage2/paging.asm stage2/vesa.asm stage1/print.asm
11         nasm -f bin stage2/main.asm -o stage2.out
12
13 stage3.out: $(STAGE3) stage2.out
14         ld -o stage3.out --oformat binary $(STAGE3) \
15                 -Ttext $$(printf "%x\n" $$(echo $$(du -b stage2.out | cut -f1)+32256 | bc))
16
17 stage3/%.o: stage3/%.asm
18         nasm -f elf64 $< -o $@
19
20 .PHONY: run clean flash
21
22 run: nyax.img
23         bochs -q
24
25 clean:
26         rm -rf stage3/*.o *.out *.img
27
28 flash: nyax.img
29         dd if=nyax.img of=$(DEV)