123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- #
- # Nintendo 3DS Makefile
- #
- include $(DEVKITARM)/3ds_rules
- .PHONY: package clean
- ifeq ($(strip $(DEVKITPRO)),)
- $(error "DEVKITPRO must be set in your environment.")
- endif
- ifeq ($(strip $(DEVKITARM)),)
- $(error "DEVKITARM must be set in your environment.")
- endif
- APP_TITLE = MegaZeux
- APP_DESCRIPTION = \"Game creation system\"
- APP_AUTHOR = \"MegaZeux Developers\"
- APP_ICON = arch/3ds/banner/megazeux-icon.png
- #
- # 3DS target rules
- #
- STRIP = /bin/true
- #
- # Override library paths.
- #
- #
- # As of devkitARM r51 $(PORTLIBS) has multiple paths...
- #
- PORTLIBS_INCLUDES := $(foreach dir, $(PORTLIBS), -isystem $(dir)/include)
- PORTLIBS_LIBS := $(foreach dir, $(PORTLIBS), -L$(dir)/lib)
- EXTRA_INCLUDES := -isystem $(CTRULIB)/include ${PORTLIBS_INCLUDES}
- EXTRA_LIBS := -L$(CTRULIB)/lib ${PORTLIBS_LIBS}
- ifeq (${DEBUG},1)
- ARCH_CFLAGS += -Og
- EXTRA_LIBS += -lcitro3dd -lctrud -lpng16 -lz
- else
- OPTIMIZE_CFLAGS = -O3 -fomit-frame-pointer -ffunction-sections
- # OPTIMIZE_CFLAGS += -flto
- EXTRA_LIBS += -lcitro3d -lctru -lpng16 -lz
- endif
- MACHDEP = -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft -mword-relocations
- ARCH_CFLAGS += ${EXTRA_INCLUDES} ${MACHDEP} -DARM11 -D__3DS__ -Iarch/3ds
- ARCH_CXXFLAGS += ${ARCH_CFLAGS}
- ARCH_LDFLAGS += ${EXTRA_LIBS} ${MACHDEP} -specs=3dsx.specs
- LIBPNG_CFLAGS =
- LIBPNG_LDFLAGS = -lpng16
- #
- # Vile hack, remove me ASAP
- # (also, vile hack in a vile hack to get the shaders to build parallel)
- #
- arch/3ds/%.o: arch/3ds/%.c arch/3ds/shader_2d.shbin.o arch/3ds/shader_playfield.shbin.o
- $(if ${V},,@echo " CC " $<)
- ${CC} -MD ${core_cflags} ${core_flags} -Wno-unused-macros -c $< -o $@
- # Do not delete these, since doing so will retrigger .o rebuilds above
- .SECONDARY: arch/3ds/shader_2d_shbin.h arch/3ds/shader_playfield_shbin.h
- arch/3ds/%.shbin: arch/3ds/%.v.pica arch/3ds/%.g.pica
- $(if ${V},,@echo " PICASSO " $^)
- @picasso -o $@ $^
- arch/3ds/%.shbin.o: arch/3ds/%.shbin arch/3ds/%_shbin.h
- $(if ${V},,@echo " AS " $<)
- @bin2s $< | $(AS) -o $@
- arch/3ds/%_shbin.h: arch/3ds/%.shbin
- $(eval CURLOC := $(patsubst %_shbin.h,%.shbin,$@))
- $(eval CURBIN := $(patsubst %_shbin.h,%.shbin,$(notdir $@)))
- $(if ${V},,@echo " ECHO " $@)
- @echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(CURLOC) | tr . _)`.h
- @echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(CURLOC) | tr . _)`.h
- @echo "extern const u32" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(CURLOC) | tr . _)`.h
- package: mzx mzxrun.smdh
- 3dsxtool ${mzxrun} ${mzxrun}.3dsx --smdh=${mzxrun}.smdh --romfs=arch/3ds/romfs
- bannertool makebanner -i arch/3ds/banner/megazeux-banner.png \
- -a arch/3ds/banner/silence.wav -o megazeux-cia.bnr
- bannertool makesmdh -s "MegaZeux" -l "MegaZeux game player" -p "MegaZeux developers" \
- -i arch/3ds/banner/megazeux-icon.png -o megazeux-cia.smdh -r regionfree
- makerom -f cia -elf ${mzxrun} -icon megazeux-cia.smdh -banner megazeux-cia.bnr \
- -desc app:4 -v -o ${mzxrun}.cia -target t -exefslogo -rsf arch/3ds/banner/megazeux.rsf
- clean:
- @rm -f ${mzxrun}.{smdh,cia,3dsx} megazeux-cia.smdh megazeux-cia.bnr arch/3ds/*.{d,o} arch/3ds/*shbin*
- build := build/${SUBPLATFORM}/3ds/megazeux
- build: package ${build}
- ${CP} arch/3ds/pad.config ${build}
- ${CP} ${mzxrun}.3dsx ${build}
- ${CP} ${mzxrun}.cia ${build}/../../
- ${RM} ${build}/${mzxrun} ${build}/${mzxrun}.debug
- include arch/zip.inc
|