2020-08-11 21:08:40 +00:00
|
|
|
CFILES = $(wildcard *.c)
|
|
|
|
OFILES = $(CFILES:.c=.o)
|
2021-02-08 16:06:09 +00:00
|
|
|
LLVMPATH = /opt/homebrew/opt/llvm/bin
|
2021-02-11 22:14:31 +00:00
|
|
|
GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -mcpu=cortex-a72+nosimd
|
2020-08-11 21:08:40 +00:00
|
|
|
|
|
|
|
all: clean kernel8.img
|
|
|
|
|
|
|
|
boot.o: boot.S
|
2021-02-08 16:06:09 +00:00
|
|
|
clang --target=aarch64-elf $(GCCFLAGS) -c boot.S -o boot.o
|
2020-08-11 21:08:40 +00:00
|
|
|
|
|
|
|
BCM4345C0.o : BCM4345C0.hcd
|
2021-02-08 16:06:09 +00:00
|
|
|
$(LLVMPATH)/llvm-objcopy -I binary -O elf64-littleaarch64 -B aarch64 $< $@
|
2020-08-11 21:08:40 +00:00
|
|
|
|
|
|
|
%.o: %.c
|
2021-02-08 16:06:09 +00:00
|
|
|
clang --target=aarch64-elf $(GCCFLAGS) -c $< -o $@
|
2020-08-11 21:08:40 +00:00
|
|
|
|
|
|
|
kernel8.img: boot.o $(OFILES) BCM4345C0.o
|
2021-02-08 16:06:09 +00:00
|
|
|
$(LLVMPATH)/ld.lld -m aarch64elf -nostdlib boot.o $(OFILES) BCM4345C0.o -T link.ld -o kernel8.elf
|
|
|
|
$(LLVMPATH)/llvm-objcopy -O binary kernel8.elf kernel8.img
|
2020-08-11 21:08:40 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
/bin/rm kernel8.elf *.o *.img > /dev/null 2> /dev/null || true
|