Blob


1 -include local.mk
2 BOARD ?=qemu_virt
3 BIN ?=/usr/local/bin/
4 OBJCOPY ?=llvm-objcopy
6 ARCH = aarch64
7 TARGET = ${ARCH}-none-elf
9 AS = ${BIN}clang
10 ASFLAGS = -target ${TARGET}
11 ASFILES = boot.o
13 CXX = ${BIN}clang++
14 CXXFLAGS = -target ${TARGET} -Wall -Wextra -nostdlib -fno-exceptions
15 CXXFLAGS += -ffreestanding -mgeneral-regs-only
16 CXXFLAGS += -Iinclude
17 CXXFILES = kernel.cc uart_${BOARD}.cc
19 OBJS = ${ASFILES:.S=.o} ${CXXFILES:.cc=.o}
20 LD = ${BIN}ld.lld
22 .PHONY: clean
24 all: squat.img
26 squat.img: squat.elf
27 ${OBJCOPY} squat.elf -O binary squat.img
29 squat.elf: linker.ld ${OBJS}
30 ${LD} -T linker.ld -o squat.elf ${OBJS}
32 .S.o:
33 ${AS} ${ASFLAGS} -c boot.S -o boot.o
35 clean:
36 rm -rf *.o squat.elf squat.img