2020-07-14 10:53:09 +00:00
|
|
|
CFILES = $(wildcard *.c)
|
|
|
|
OFILES = $(CFILES:.c=.o)
|
2021-02-07 19:18:44 +00:00
|
|
|
LLVMPATH = /opt/homebrew/opt/llvm/bin
|
2021-02-12 20:21:45 +00:00
|
|
|
CLANGFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -mcpu=cortex-a72+nosimd
|
2020-07-14 10:53:09 +00:00
|
|
|
|
|
|
|
all: clean kernel8.img
|
|
|
|
|
|
|
|
boot.o: boot.S
|
2021-02-12 20:21:45 +00:00
|
|
|
$(LLVMPATH)/clang --target=aarch64-elf $(CLANGFLAGS) -c boot.S -o boot.o
|
2020-07-14 10:53:09 +00:00
|
|
|
|
|
|
|
%.o: %.c
|
2021-02-12 20:21:45 +00:00
|
|
|
$(LLVMPATH)/clang --target=aarch64-elf $(CLANGFLAGS) -c $< -o $@
|
2020-07-14 10:53:09 +00:00
|
|
|
|
|
|
|
kernel8.img: boot.o $(OFILES)
|
2021-02-07 19:18:44 +00:00
|
|
|
$(LLVMPATH)/ld.lld -m aarch64elf -nostdlib boot.o $(OFILES) -T link.ld -o kernel8.elf
|
|
|
|
$(LLVMPATH)/llvm-objcopy -O binary kernel8.elf kernel8.img
|
2020-07-14 10:53:09 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
/bin/rm kernel8.elf *.o *.img > /dev/null 2> /dev/null || true
|