25 lines
547 B
Makefile
25 lines
547 B
Makefile
# Reminder that you'll need the cross compiler toolchain setup already.
|
|
PREFIX = i686-elf-
|
|
CC = $(PREFIX)gcc
|
|
AS = $(PREFIX)as
|
|
CFLAGS = -ffreestanding -O2
|
|
WARNFLAGS = -Wall -Wextra
|
|
|
|
all: test.bin
|
|
|
|
test: test.bin
|
|
grub-file --is-x86-multiboot test.bin
|
|
qemu-system-i386 -kernel test.bin
|
|
|
|
test.bin: boot.o kernel.o linker.ld
|
|
$(CC) -T linker.ld -o test.bin $(CFLAGS) -nostdlib boot.o kernel.o -lgcc
|
|
|
|
boot.o: boot.s
|
|
$(AS) boot.s -o boot.o
|
|
|
|
kernel.o: kernel.c
|
|
$(CC) -c kernel.c -o kernel.o -std=gnu99 $(CFLAGS) $(WARNFLAGS)
|
|
|
|
clean:
|
|
-rm *.o test.bin
|