f3fac5e3b8
Former-commit-id: 16ba6dada28f8beb5971413acbbe153a26aa9ec3 Former-commit-id: f0661ad20245110797fd99fe16d3fb11382bb78a
38 lines
859 B
Makefile
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
|