mirror of
https://github.com/isometimes/rpi4-osdev
synced 2024-11-24 11:10:40 +00:00
19 lines
610 B
Makefile
19 lines
610 B
Makefile
CFILES = $(wildcard *.c)
|
|
OFILES = $(CFILES:.c=.o)
|
|
LLVMPATH = /opt/homebrew/opt/llvm/bin
|
|
CLANGFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -mcpu=cortex-a72+nosimd
|
|
|
|
all: clean kernel8.img
|
|
|
|
boot.o: boot.S
|
|
$(LLVMPATH)/clang --target=aarch64-elf $(CLANGFLAGS) -c boot.S -o boot.o
|
|
|
|
%.o: %.c
|
|
$(LLVMPATH)/clang --target=aarch64-elf $(CLANGFLAGS) -c $< -o $@
|
|
|
|
kernel8.img: boot.o $(OFILES)
|
|
$(LLVMPATH)/ld.lld -m aarch64elf -nostdlib boot.o $(OFILES) -T link.ld -o kernel8.elf
|
|
$(LLVMPATH)/llvm-objcopy -O binary kernel8.elf kernel8.img
|
|
|
|
clean:
|
|
/bin/rm kernel8.elf *.o *.img > /dev/null 2> /dev/null || true
|