2021-02-24 20:02:43 +00:00
|
|
|
CFILES = $(wildcard *.c lib/*.c)
|
|
|
|
OFILES = $(CFILES:.c=.o)
|
2024-04-22 08:49:39 +00:00
|
|
|
LLVMPATH = /opt/homebrew/opt/llvm/bin
|
|
|
|
CLANGFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -mcpu=cortex-a72+nosimd
|
2021-02-24 20:02:43 +00:00
|
|
|
|
|
|
|
all: clean kernel8.img
|
|
|
|
|
|
|
|
boot/boot.o: boot/boot.S
|
2024-04-22 08:49:39 +00:00
|
|
|
$(LLVMPATH)/clang --target=aarch64-elf $(CLANGFLAGS) -c $< -o $@
|
2021-02-24 20:02:43 +00:00
|
|
|
|
|
|
|
bin/BCM4345C0.o : bin/BCM4345C0.hcd
|
2024-04-22 08:49:39 +00:00
|
|
|
$(LLVMPATH)/llvm-objcopy -I binary -O elf64-littleaarch64 -B aarch64 $< $@
|
|
|
|
|
2021-02-24 20:02:43 +00:00
|
|
|
bin/audio.o : bin/audio.bin
|
2024-04-22 08:49:39 +00:00
|
|
|
$(LLVMPATH)/llvm-objcopy -I binary -O elf64-littleaarch64 -B aarch64 $< $@
|
2021-02-24 20:02:43 +00:00
|
|
|
|
|
|
|
%.o: %.c
|
2024-04-22 08:49:39 +00:00
|
|
|
$(LLVMPATH)/clang --target=aarch64-elf $(CLANGFLAGS) -c $< -o $@
|
2021-02-24 20:02:43 +00:00
|
|
|
|
|
|
|
kernel8.img: boot/boot.o $(OFILES) bin/BCM4345C0.o bin/audio.o
|
2024-04-22 08:49:39 +00:00
|
|
|
$(LLVMPATH)/ld.lld -m aarch64elf -nostdlib boot/boot.o $(OFILES) bin/BCM4345C0.o bin/audio.o -T boot/link.ld -o kernel8.elf
|
|
|
|
$(LLVMPATH)/llvm-objcopy -O binary kernel8.elf kernel8.img
|
|
|
|
|
2021-02-24 20:02:43 +00:00
|
|
|
clean:
|
2024-04-22 08:49:39 +00:00
|
|
|
/bin/rm kernel8.elf *.o bin/*.o boot/*.o lib/*.o *.img > /dev/null 2> /dev/null || true
|