blob: cf4e41dfad0e2e1598a4e3dc9d752a636b4de45c (
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
|
AS = nasm
CC = clang
CFILES = $(shell find src/ -name "*.c")
OFILES = $(CFILES:.c=.o)
LDFLAGS = -nostdlib -Tlink.ld -no-pie
CFLAGS = -ffreestanding -nostdinc -fno-pic -mno-sse -mno-sse2 \
-mno-mmx -mno-80387 -fno-stack-protector
.PHONY: all
all: $(OFILES) stage1.bin stage2.bin
cat stage1.bin stage2.bin >boot.bin
.PHONY: stage1.bin
stage1.bin:
$(AS) -fbin mbr/stage1.asm -o $@
.PHONY: stage2.bin
stage2.bin:
$(CC) $(LDFLAGS) $(OFILES) -o $@
%.o: %.c
$(CC) -c $(CFLAGS) $< -o $@
.PHONY: test
test:
qemu-system-i386 -hda boot.bin --enable-kvm
|