.SUFFIXES: ifeq ($(strip $(DEVKITARM)),) $(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM") endif TOPDIR ?= $(CURDIR) include $(DEVKITARM)/3ds_rules TARGET := ArticBase PLGINFO := build/ArticBase.plgInfo BUILD := build INCLUDES := includes SOURCES := sources sources/CTRPluginFramework VERSION_MAJOR := 1 VERSION_MINOR := 2 VERSION_REVISION := 0 SERVER_PORT := 5543 IP := 19 FTP_HOST := 192.168.1. FTP_PORT := "5000" FTP_PATH := "luma/plugins" #--------------------------------------------------------------------------------- # options for code generation #--------------------------------------------------------------------------------- ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft CFLAGS := $(ARCH) -Os -mword-relocations \ -fomit-frame-pointer -ffunction-sections -fno-strict-aliasing CFLAGS += $(INCLUDE) -D__3DS__ -DVERSION_MAJOR=$(VERSION_MAJOR) -DVERSION_MINOR=$(VERSION_MINOR) \ -DVERSION_REVISION=$(VERSION_REVISION) -DSERVER_PORT=$(SERVER_PORT) CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++20 ASFLAGS := $(ARCH) LDFLAGS := -T $(TOPDIR)/3gx.ld $(ARCH) -Os -Wl,--gc-sections,--strip-discarded LIBS := -lctru LIBDIRS := $(CTRULIB) $(PORTLIBS) #--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional # rules for different file extensions #--------------------------------------------------------------------------------- ifneq ($(BUILD),$(notdir $(CURDIR))) #--------------------------------------------------------------------------------- export OUTPUT := $(CURDIR)/$(TARGET) export TOPDIR := $(CURDIR) export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ $(foreach dir,$(DATA),$(CURDIR)/$(dir)) export DEPSDIR := $(CURDIR)/$(BUILD) CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) export LD := $(CXX) export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) export INCLUDE := $(foreach dir,$(INCLUDES),-I $(CURDIR)/$(dir) ) \ $(foreach dir,$(LIBDIRS),-I $(dir)/include) \ -I $(CURDIR)/$(BUILD) export LIBPATHS := $(foreach dir,$(LIBDIRS),-L $(dir)/lib) .PHONY: $(BUILD) clean all send #--------------------------------------------------------------------------------- all: $(BUILD) $(BUILD): @[ -d $@ ] || mkdir -p $@ @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile #--------------------------------------------------------------------------------- clean: @echo clean ... @rm -fr $(BUILD) $(OUTPUT).3gx $(OUTPUT).elf send: @echo "Sending plugin over FTP" @$(CURDIR)/sendfile.py $(TARGET).3gx $(FTP_PATH) "$(FTP_HOST)$(IP)" $(FTP_PORT) default.3gx re: clean all #--------------------------------------------------------------------------------- else DEPENDS := $(OFILES:.o=.d) #--------------------------------------------------------------------------------- # main targets #--------------------------------------------------------------------------------- $(OUTPUT).3gx : $(OFILES) #--------------------------------------------------------------------------------- # you need a rule like this for each extension you use as binary data #--------------------------------------------------------------------------------- %.bin.o : %.bin #--------------------------------------------------------------------------------- @echo $(notdir $<) @$(bin2o) #--------------------------------------------------------------------------------- %.3gx: %.elf #--------------------------------------------------------------------------------- @echo creating $(notdir $@) @3gxtool -s $(word 1, $^) $(TOPDIR)/$(PLGINFO) $@ @mv $(OUTPUT).elf ArticBasedebug.elf -include $(DEPENDS) #--------------------------------------------------------------------------------- endif