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