2016-10-08 00:47:15 +00:00
|
|
|
TARGET := retroarch_3ds_salamander
|
|
|
|
LIBRETRO =
|
|
|
|
|
|
|
|
DEBUG = 0
|
2018-05-19 16:59:47 +00:00
|
|
|
BUILD_3DSX = 1
|
2016-10-08 00:47:15 +00:00
|
|
|
BUILD_3DS = 0
|
|
|
|
BUILD_CIA = 1
|
|
|
|
|
2018-05-27 18:21:41 +00:00
|
|
|
APP_TITLE = RetroArch 3DS
|
|
|
|
APP_DESCRIPTION = RetroArch 3DS
|
2016-10-08 00:47:15 +00:00
|
|
|
APP_AUTHOR = Team Libretro
|
|
|
|
APP_PRODUCT_CODE = RETROARCH-3DS
|
|
|
|
APP_UNIQUE_ID = 0xBAC00
|
2017-11-24 17:28:47 +00:00
|
|
|
APP_ICON = pkg/ctr/assets/default.png
|
|
|
|
APP_BANNER = pkg/ctr/assets/libretro_banner.png
|
|
|
|
APP_AUDIO = pkg/ctr/assets/silent.wav
|
|
|
|
APP_RSF = pkg/ctr/tools/template.rsf
|
2016-10-08 00:47:15 +00:00
|
|
|
APP_SYSTEM_MODE = 64MB
|
|
|
|
APP_SYSTEM_MODE_EXT = 124MB
|
|
|
|
|
2016-12-17 18:35:51 +00:00
|
|
|
OBJ := ctr/ctr_system.o \
|
|
|
|
ctr/ctr_memory.o \
|
|
|
|
ctr/ctr_linear.o \
|
|
|
|
frontend/frontend_salamander.o \
|
|
|
|
frontend/frontend_driver.o \
|
|
|
|
frontend/drivers/platform_ctr.o \
|
|
|
|
frontend/drivers/platform_null.o \
|
2017-08-06 11:58:17 +00:00
|
|
|
libretro-common/encodings/encoding_utf.o \
|
2016-12-17 18:35:51 +00:00
|
|
|
libretro-common/compat/compat_strcasestr.o \
|
2019-01-08 20:43:40 +00:00
|
|
|
libretro-common/compat/fopen_utf8.o \
|
2016-12-17 18:35:51 +00:00
|
|
|
libretro-common/file/file_path.o \
|
|
|
|
libretro-common/string/stdstring.o \
|
|
|
|
libretro-common/lists/string_list.o \
|
|
|
|
libretro-common/lists/dir_list.o \
|
|
|
|
libretro-common/file/retro_dirent.o \
|
|
|
|
libretro-common/compat/compat_strl.o \
|
|
|
|
libretro-common/file/config_file.o \
|
|
|
|
libretro-common/streams/file_stream.o \
|
2017-12-14 14:18:48 +00:00
|
|
|
libretro-common/vfs/vfs_implementation.o \
|
2016-12-17 18:35:51 +00:00
|
|
|
libretro-common/hash/rhash.o \
|
|
|
|
file_path_str.o \
|
|
|
|
verbosity.o
|
2019-02-03 23:49:35 +00:00
|
|
|
|
2018-05-09 22:55:48 +00:00
|
|
|
OBJ += ctr/exec-3dsx/exec_cia.o \
|
|
|
|
ctr/exec-3dsx/exec_3dsx.o \
|
|
|
|
ctr/exec-3dsx/mini-hb-menu/launch.o \
|
|
|
|
ctr/exec-3dsx/mini-hb-menu/loaders/rosalina.o \
|
|
|
|
ctr/exec-3dsx/mini-hb-menu/loaders/hax2.o \
|
|
|
|
ctr/exec-3dsx/mini-hb-menu/loaders/ninjhax1.o
|
2016-10-08 00:47:15 +00:00
|
|
|
|
|
|
|
ifeq ($(strip $(DEVKITPRO)),)
|
|
|
|
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitpro")
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(strip $(CTRULIB)),)
|
2017-11-26 02:35:05 +00:00
|
|
|
CTRULIB = $(DEVKITPRO)/libctru
|
2016-10-08 00:47:15 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
APP_TITLE := $(shell echo "$(APP_TITLE)" | cut -c1-128)
|
|
|
|
APP_DESCRIPTION := $(shell echo "$(APP_DESCRIPTION)" | cut -c1-256)
|
|
|
|
APP_AUTHOR := $(shell echo "$(APP_AUTHOR)" | cut -c1-128)
|
|
|
|
APP_PRODUCT_CODE := $(shell echo $(APP_PRODUCT_CODE) | cut -c1-16)
|
|
|
|
APP_UNIQUE_ID := $(shell echo $(APP_UNIQUE_ID) | cut -c1-7)
|
|
|
|
|
|
|
|
MAKEROM_ARGS_COMMON = -rsf $(APP_RSF) -exefslogo -elf $(TARGET).elf -icon $(TARGET).icn -banner $(TARGET).bnr -DAPP_TITLE="$(APP_TITLE)" -DAPP_PRODUCT_CODE="$(APP_PRODUCT_CODE)" -DAPP_UNIQUE_ID=$(APP_UNIQUE_ID) -DAPP_SYSTEM_MODE=$(APP_SYSTEM_MODE) -DAPP_SYSTEM_MODE_EXT=$(APP_SYSTEM_MODE_EXT)
|
|
|
|
|
|
|
|
INCDIRS := -I$(CTRULIB)/include
|
|
|
|
LIBDIRS := -L. -L$(CTRULIB)/lib
|
|
|
|
|
|
|
|
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -marm -mfpu=vfp -mtp=soft
|
|
|
|
|
|
|
|
CFLAGS += -mword-relocations \
|
|
|
|
-fomit-frame-pointer -ffast-math \
|
|
|
|
-Werror=implicit-function-declaration \
|
|
|
|
$(ARCH)
|
|
|
|
|
|
|
|
#CFLAGS += -Wall
|
|
|
|
CFLAGS += -DARM11 -D_3DS
|
|
|
|
|
|
|
|
ifeq ($(DEBUG), 1)
|
|
|
|
CFLAGS += -O0 -g
|
|
|
|
else
|
|
|
|
CFLAGS += -O3
|
|
|
|
endif
|
|
|
|
|
2017-11-06 04:23:53 +00:00
|
|
|
CFLAGS += -I. -Ideps/libz -Ideps/7zip -Ideps/stb -Ilibretro-common/include
|
2016-10-08 00:47:15 +00:00
|
|
|
|
|
|
|
#CFLAGS += -DRARCH_INTERNAL
|
|
|
|
CFLAGS += -DRARCH_CONSOLE -DIS_SALAMANDER
|
|
|
|
|
|
|
|
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
|
|
|
|
|
|
|
|
ASFLAGS := -g $(ARCH) -O3
|
|
|
|
LDFLAGS += -specs=ctr/3dsx_custom.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
|
|
|
|
|
|
|
CFLAGS += -std=gnu99 -ffast-math
|
|
|
|
|
2016-10-08 01:35:54 +00:00
|
|
|
LIBS := -lctru -lm
|
2016-10-08 00:47:15 +00:00
|
|
|
|
|
|
|
ifeq ($(BUILD_3DSX), 1)
|
|
|
|
TARGET_3DSX := $(TARGET).3dsx $(TARGET).smdh
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BUILD_3DS), 1)
|
|
|
|
TARGET_3DS := $(TARGET).3ds
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BUILD_CIA), 1)
|
|
|
|
TARGET_CIA := $(TARGET).cia
|
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: $(BUILD) clean all
|
|
|
|
|
|
|
|
all: $(TARGET)
|
|
|
|
|
|
|
|
$(TARGET): $(TARGET_3DSX) $(TARGET_3DS) $(TARGET_CIA)
|
|
|
|
$(TARGET).3dsx: $(TARGET).elf
|
|
|
|
$(TARGET).elf: $(OBJ)
|
|
|
|
|
2017-12-26 23:32:56 +00:00
|
|
|
PREFIX := $(DEVKITARM)/bin/arm-none-eabi-
|
2016-10-08 00:47:15 +00:00
|
|
|
|
|
|
|
CC := $(PREFIX)gcc
|
|
|
|
CXX := $(PREFIX)g++
|
|
|
|
AS := $(PREFIX)as
|
|
|
|
AR := $(PREFIX)ar
|
|
|
|
OBJCOPY := $(PREFIX)objcopy
|
|
|
|
STRIP := $(PREFIX)strip
|
|
|
|
NM := $(PREFIX)nm
|
|
|
|
LD := $(CXX)
|
|
|
|
|
2018-01-04 19:40:03 +00:00
|
|
|
ifeq ($(strip $(CTRBANNERTOOL)),)
|
2018-01-05 17:58:10 +00:00
|
|
|
ifneq ($(findstring Linux,$(shell uname)),)
|
2018-01-04 19:40:03 +00:00
|
|
|
BANNERTOOL = pkg/ctr/tools/bannertool-linux
|
2018-01-05 17:58:10 +00:00
|
|
|
else ifneq ($(findstring Darwin,$(shell uname)),)
|
2018-01-04 19:40:03 +00:00
|
|
|
BANNERTOOL = pkg/ctr/tools/bannertool-mac
|
|
|
|
else
|
|
|
|
BANNERTOOL = pkg/ctr/tools/bannertool.exe
|
|
|
|
endif
|
2016-10-08 00:47:15 +00:00
|
|
|
else
|
2018-01-04 19:40:03 +00:00
|
|
|
BANNERTOOL = $(CTRBANNERTOOL)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(strip $(CTRMAKEROM)),)
|
2018-01-05 17:58:10 +00:00
|
|
|
ifneq ($(findstring Linux,$(shell uname)),)
|
2018-01-04 19:40:03 +00:00
|
|
|
MAKEROM = pkg/ctr/tools/makerom-linux
|
2018-01-05 17:58:10 +00:00
|
|
|
else ifneq ($(findstring Darwin,$(shell uname)),)
|
2018-01-04 19:40:03 +00:00
|
|
|
MAKEROM = pkg/ctr/tools/makerom-mac
|
|
|
|
else
|
|
|
|
MAKEROM = pkg/ctr/tools/makerom.exe
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
MAKEROM = $(CTRMAKEROM)
|
2016-10-08 00:47:15 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
%.o: %.vsh %.gsh
|
2017-12-26 23:32:56 +00:00
|
|
|
$(DEVKITARM)/bin/picasso $^ -o $*.shbin
|
|
|
|
$(DEVKITARM)/bin/bin2s $*.shbin | $(PREFIX)as -o $@
|
2016-10-08 00:47:15 +00:00
|
|
|
rm $*.shbin
|
|
|
|
|
|
|
|
%.o: %.vsh
|
2017-12-26 23:32:56 +00:00
|
|
|
$(DEVKITARM)/bin/picasso $^ -o $*.shbin
|
|
|
|
$(DEVKITARM)/bin/bin2s $*.shbin | $(PREFIX)as -o $@
|
2016-10-08 00:47:15 +00:00
|
|
|
rm $*.shbin
|
|
|
|
|
|
|
|
%.o: %.cpp
|
|
|
|
$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS)
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS)
|
|
|
|
|
|
|
|
%.o: %.s
|
|
|
|
$(CC) -c -o $@ $< $(ASFLAGS)
|
|
|
|
|
|
|
|
%.o: %.S
|
|
|
|
$(CC) -c -o $@ $< $(ASFLAGS)
|
|
|
|
|
|
|
|
%.a:
|
|
|
|
$(AR) -rc $@ $^
|
|
|
|
|
|
|
|
%.vsh:
|
|
|
|
|
|
|
|
$(TARGET).smdh: $(APP_ICON)
|
2017-12-26 23:32:56 +00:00
|
|
|
$(DEVKITARM)/bin/smdhtool --create "$(APP_TITLE)" "$(APP_DESCRIPTION)" "$(APP_AUTHOR)" $(APP_ICON) $@
|
2016-10-08 00:47:15 +00:00
|
|
|
|
|
|
|
$(TARGET).3dsx: $(TARGET).elf
|
|
|
|
ifeq ($(APP_BIG_TEXT_SECTION), 1)
|
2017-11-24 17:28:47 +00:00
|
|
|
cp pkg/ctr/big_text_section.xml $(TARGET).xml
|
2016-10-08 00:47:15 +00:00
|
|
|
else
|
|
|
|
rm -f $(TARGET).xml
|
|
|
|
endif
|
2018-05-19 18:42:08 +00:00
|
|
|
$(DEVKITARM)/bin/3dsxtool $< $@ $(_3DSXFLAGS)
|
2016-10-08 00:47:15 +00:00
|
|
|
|
|
|
|
$(TARGET).elf: ctr/3dsx_custom_crt0.o
|
|
|
|
$(LD) $(LDFLAGS) $(OBJ) $(LIBDIRS) $(LIBS) -o $@
|
|
|
|
$(NM) -CSn $@ > $(notdir $*.lst)
|
|
|
|
|
|
|
|
$(TARGET).bnr: $(APP_BANNER) $(APP_AUDIO)
|
|
|
|
$(BANNERTOOL) makebanner -i "$(APP_BANNER)" -a "$(APP_AUDIO)" -o $@
|
|
|
|
|
|
|
|
$(TARGET).icn: $(APP_ICON)
|
|
|
|
$(BANNERTOOL) makesmdh -s "$(APP_TITLE)" -l "$(APP_TITLE)" -p "$(APP_AUTHOR)" -i $(APP_ICON) -o $@
|
|
|
|
|
|
|
|
$(TARGET).3ds: $(TARGET).elf $(TARGET).bnr $(TARGET).icn $(APP_RSF)
|
|
|
|
$(MAKEROM) -f cci -o $@ $(MAKEROM_ARGS_COMMON) -DAPP_ENCRYPTED=true
|
|
|
|
|
|
|
|
$(TARGET).cia: $(TARGET).elf $(TARGET).bnr $(TARGET).icn $(APP_RSF)
|
|
|
|
$(MAKEROM) -f cia -o $@ $(MAKEROM_ARGS_COMMON) -DAPP_ENCRYPTED=false
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(OBJ)
|
|
|
|
rm -f $(TARGET).3dsx
|
|
|
|
rm -f $(TARGET).elf
|
|
|
|
rm -f $(TARGET).3ds
|
|
|
|
rm -f $(TARGET).cia
|
|
|
|
rm -f $(TARGET).smdh
|
|
|
|
rm -f $(TARGET).bnr
|
|
|
|
rm -f $(TARGET).icn
|
|
|
|
rm -f ctr/ctr_config_*.o
|
|
|
|
rm -f ctr/3dsx_custom_crt0.o
|
|
|
|
|
|
|
|
.PHONY: clean
|