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