2021-10-12 16:19:47 +00:00
|
|
|
CFILES = $(wildcard *.c lib/*.c kernel/*.c)
|
|
|
|
SFILES = $(wildcard boot/*.S lib/*.S kernel/*.S)
|
|
|
|
OFILES = $(CFILES:.c=.o) $(SFILES:.S=.o)
|
2024-04-22 08:49:39 +00:00
|
|
|
LLVMPATH = /opt/homebrew/opt/llvm/bin
|
|
|
|
CLANGFLAGS = -Wall -O2 -ffreestanding -nostdlib -mcpu=cortex-a72+nosimd
|
2021-10-12 16:19:47 +00:00
|
|
|
|
|
|
|
all: clean kernel8.img
|
|
|
|
|
|
|
|
%.o: %.c
|
2024-04-22 08:49:39 +00:00
|
|
|
$(LLVMPATH)/clang --target=aarch64-elf $(CLANGFLAGS) -c $< -o $@
|
2021-10-12 16:19:47 +00:00
|
|
|
|
|
|
|
%.o: %.S
|
2024-04-22 08:49:39 +00:00
|
|
|
$(LLVMPATH)/clang --target=aarch64-elf $(CLANGFLAGS) -c $< -o $@
|
2021-10-12 16:19:47 +00:00
|
|
|
|
|
|
|
kernel8.img: $(OFILES)
|
2024-04-22 08:49:39 +00:00
|
|
|
$(LLVMPATH)/ld.lld -m aarch64elf -nostdlib $(OFILES) -T boot/link.ld -o kernel8.elf
|
|
|
|
$(LLVMPATH)/llvm-objcopy -O binary kernel8.elf kernel8.img
|
2021-10-12 16:19:47 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
/bin/rm kernel8.elf */*.o *.img > /dev/null 2> /dev/null || true
|