-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
31 lines (21 loc) · 898 Bytes
/
Makefile
File metadata and controls
31 lines (21 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
CFILES = $(shell find . -name "*.c")
OFILES = $(CFILES:.c=.o)
all: kernel8.img
LLVMPATH = /usr/local/opt/llvm/bin
CLANGFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -mcpu=cortex-a53+nosimd
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 $@
font_psf.o: font.psf
$(LLVMPATH)/ld.lld -m aarch64elf -r -b binary -o font_psf.o font.psf
font_sfn.o: font.sfn
$(LLVMPATH)/ld.lld -m aarch64elf -r -b binary -o font_sfn.o font.sfn
kernel8.img: boot.o font_psf.o font_sfn.o $(OFILES)
$(LLVMPATH)/ld.lld -m aarch64elf -nostdlib boot.o font_psf.o font_sfn.o $(OFILES) -T link.ld -o kernel8.elf
$(LLVMPATH)/llvm-objcopy -O binary kernel8.elf kernel8.img
all: finalize
clean:
/bin/rm kernel8.elf **/*.o **/*.img
finalize:
/bin/rm kernel8.elf $(shell find . -name "*.o")