.POSIX: .PHONY: all clean run # QFLAGS = -machine type=pc,accel=kvm -cpu Broadwell-v3 CC = x86_64-elf-gcc CFLAGS = -Wall -Wextra -std=c99 -pedantic -O2 -pipe \ -ffreestanding -mno-red-zone -mno-mmx -mno-sse -mno-sse2 LDFLAGS = -Wl,-O1 -T link.ld LDLIBS = -lgcc -nostdlib CSRC = kernel/main.c FSRC = boot/boot.asm kernel/util.asm OBJ = ${CSRC:.c=.o} ${FSRC:.asm=.o} all: providence.img boot/boot.o: boot/bios.inc boot/page.inc boot/segdesc.inc kernel/main.o: kernel/util.h providence.img: ${OBJ} ${CC} ${LDFLAGS} $^ ${LDLIBS} -o $@ @du -b $@ truncate -s 29696 $@ %.o: %.c ${CC} ${CFLAGS} -c -o $@ $< %.o: %.asm fasm $< $@ clean: rm -f ${OBJ} providence.img run: all qemu-system-x86_64 ${QFLAGS} -drive file=providence.img,format=raw,index=0,media=disk