AS = clang CXX = clang++ LD = ld.lld OBJCOPY = llvm-objcopy ARCH = aarch64 TARGET = ${ARCH}-none-elf BOARD = virt ASFLAGS = -target ${TARGET} ASFILES = boot.S CXXFLAGS = -target ${TARGET} CXXFLAGS +=-Wall -Wextra -Werror CXXFLAGS +=-nostdlib -fno-exceptions -std=c++11 CXXFLAGS +=-ffreestanding -mgeneral-regs-only CXXFLAGS +=-Iinclude CXXFILES = kernel.cc uart_${BOARD}.cc OBJS = ${ASFILES:.S=.o} ${CXXFILES:.cc=.o} -include config.mk .PHONY: clean qemu gdb-remote all: squat.img squat.img: squat.elf ${OBJCOPY} squat.elf -O binary squat.img squat.elf: linker.ld ${OBJS} ${LD} -T linker.ld -o squat.elf ${OBJS} .S.o: ${AS} ${ASFLAGS} -c $< -o $@ clean: rm -rf *.o squat.elf squat.img qemu: squat.img qemu-system-${ARCH} -M ${BOARD} -cpu cortex-a53 \ -kernel squat.img -nographic -monitor none -serial stdio gdb-remote: squat.img qemu-system-${ARCH} -s -S -M ${BOARD} -cpu cortex-a53 \ -kernel squat.img -nographic -monitor none -serial stdio