Files
2026-10-18 17:05:44 +02:00

28 lines
1.3 KiB
Makefile

# MBMNET-FTP-Modul (Hintergrund-Prozess). Wird vom Makefile der App mitgebaut und in die App eingebettet.
ifeq ($(strip $(DEVKITARM)),)
$(error "DEVKITARM ist nicht gesetzt.")
endif
CC := $(DEVKITARM)/bin/arm-none-eabi-gcc
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft
CFLAGS := -O2 -Wall -mword-relocations -ffunction-sections $(ARCH) -D__3DS__ -I$(DEVKITPRO)/libctru/include
LDFLAGS := -specs=3dsx.specs $(ARCH) -Wl,--gc-sections -L$(DEVKITPRO)/libctru/lib
SOURCES := $(wildcard source/*.c)
ftpmodul.cxi: ftpmodul.elf ftpmodul.rsf
@makerom -f ncch -rsf ftpmodul.rsf -elf ftpmodul.elf -o ftpmodul.cxi
@# Lumas pm stürzt ab, wenn die Kennung eines Systemmoduls nicht auf 02 endet (panic 4)
@test "$$(od -An -tx1 -j 0x118 -N 1 ftpmodul.cxi | tr -d ' ')" = "02" || { echo "FEHLER: Kennung endet nicht auf 02"; rm -f ftpmodul.cxi; exit 1; }
@echo built ... ftpmodul.cxi
ftpmodul.elf: $(SOURCES) $(wildcard source/*.h)
@$(CC) $(CFLAGS) $(SOURCES) $(LDFLAGS) -lctru -lm -o $@
@# Adresse des Statusblocks für die App (liest ihn per Debug-Zugriff)
@$(DEVKITARM)/bin/arm-none-eabi-nm $@ | awk '$$3 == "ftpStatus" { print "0x" $$1 }' > ftpmodul.sym
@test -s ftpmodul.sym || { echo "FEHLER: ftpStatus nicht gefunden"; exit 1; }
clean:
@rm -f ftpmodul.elf ftpmodul.cxi ftpmodul.sym
.PHONY: clean