summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 22c435d920ddc610901fcbeb0220f09df7358531 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
GRUB_DIR=grub
KERNEL_DIR=kernel
ISO_DIR=iso
ISO=kernel.iso

.PHONY: kernel iso

all: run

run: kernel
	qemu-system-i386 -kernel $(KERNEL_DIR)/kernel.elf

run-iso: $(ISO)
	qemu-system-i386 -hda $(ISO)

kernel.iso: iso
	grub-mkrescue -o $(ISO) $(ISO_DIR)

iso: kernel
	mkdir -p $(ISO_DIR)/boot/grub
	cp $(KERNEL_DIR)/kernel.elf $(ISO_DIR)/boot/
	cp $(GRUB_DIR)/grub.cfg $(ISO_DIR)/boot/grub/

kernel:
	cd $(KERNEL_DIR); $(MAKE)

clean:
	cd $(KERNEL_DIR); $(MAKE) clean
	-rm -fr $(ISO) $(ISO_DIR) 2>/dev/null