35 lines
913 B
Makefile
35 lines
913 B
Makefile
|
ASM=clang
|
||
|
TARGET=aarch64-none-elf
|
||
|
CPU=cortex-a57
|
||
|
LD=ld.lld
|
||
|
OBJCOPY=objcopy --target elf64-littleaarch64
|
||
|
|
||
|
all: build/core.bin build/core.elf
|
||
|
|
||
|
# compilation -----------------------------------------------------------------
|
||
|
|
||
|
build/core.o: core/core.s
|
||
|
$(ASM) -c -triple --target=$(TARGET) -mcpu=$(CPU) -O0 -g $< -o $@
|
||
|
|
||
|
build/uart.o: core/uart.s
|
||
|
$(ASM) -c --target=$(TARGET) -mcpu=$(CPU) -O0 -g $< -o $@
|
||
|
|
||
|
# ELF -------------------------------------------------------------------------
|
||
|
|
||
|
build/core.elf: build/core.o build/uart.o
|
||
|
$(LD) -Tcore/core.ld $^ -o $@
|
||
|
|
||
|
# BIN -------------------------------------------------------------------------
|
||
|
|
||
|
build/core.bin: build/core.elf
|
||
|
$(OBJCOPY) -O binary $< $@
|
||
|
|
||
|
build/core.sym: build/core.elf
|
||
|
$(OBJCOPY) --only-keep-debug $< $@
|
||
|
$(OBJCOPY) --strip-debug build/core.elf
|
||
|
|
||
|
# Clean -----------------------------------------------------------------------
|
||
|
|
||
|
clean:
|
||
|
rm -f build/*
|