This repository has been archived on 2024-06-01. You can view files and clone it, but cannot push or open issues or pull requests.
rustboyadvance-ng/arm7tdmi/examples/test_program/Makefile
Michel Heily f3fac5e3b8 Implement new gdbstub target for arm7tdmi, add a small example & test as well
Former-commit-id: 16ba6dada28f8beb5971413acbbe153a26aa9ec3
Former-commit-id: f0661ad20245110797fd99fe16d3fb11382bb78a
2022-09-08 23:40:38 +03:00

38 lines
859 B
Makefile

# Easiest to build this using `docker run -it --rm -v $(pwd):/code -w /code devkitpro/devkitarm:latest make
TOOLCHAIN := ${DEVKITARM}/bin/arm-none-eabi
CC := ${TOOLCHAIN}-gcc
OBJCOPY := ${TOOLCHAIN}-objcopy
OBJDUMP := ${TOOLCHAIN}-objdump
TARGET := test
CFLAGS := -O0 -g -std=c11 -march=armv4t -mthumb
LDFLAGS := -Wl,-static
SOURCES := $(wildcard *.[cs])
OBJECTS := $(filter %.o,$(SOURCES:%.c=%.o))
OBJECTS += $(filter %.o,$(SOURCES:%.s=%.o))
all: ${TARGET}.bin objdump
${OBJECTS}: ${SOURCES}
${CC} -c ${CFLAGS} $^
${TARGET}.elf ${TARGET}.map: ${OBJECTS} ${TARGET}.ld
${CC} ${LDFLAGS} -Wl,-Map=${TARGET}.map -Wl,-T${TARGET}.ld ${OBJECTS} -o $@
${TARGET}.bin: ${TARGET}.elf
$(OBJCOPY) -v -O binary $^ $@
objdump: ${TARGET}.elf
${OBJDUMP} -d $^
clean:
rm -f ${TARGET}.elf
rm -f ${TARGET}.bin
rm -f ${TARGET}.map
rm -f *.o
.PHONY: all clean