Makefile.in 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #
  2. # Nintendo 3DS Makefile
  3. #
  4. include $(DEVKITARM)/3ds_rules
  5. .PHONY: package clean
  6. ifeq ($(strip $(DEVKITPRO)),)
  7. $(error "DEVKITPRO must be set in your environment.")
  8. endif
  9. ifeq ($(strip $(DEVKITARM)),)
  10. $(error "DEVKITARM must be set in your environment.")
  11. endif
  12. APP_TITLE = MegaZeux
  13. APP_DESCRIPTION = \"Game creation system\"
  14. APP_AUTHOR = \"MegaZeux Developers\"
  15. APP_ICON = arch/3ds/banner/megazeux-icon.png
  16. #
  17. # 3DS target rules
  18. #
  19. STRIP = /bin/true
  20. #
  21. # Override library paths.
  22. #
  23. #
  24. # As of devkitARM r51 $(PORTLIBS) has multiple paths...
  25. #
  26. PORTLIBS_INCLUDES := $(foreach dir, $(PORTLIBS), -isystem $(dir)/include)
  27. PORTLIBS_LIBS := $(foreach dir, $(PORTLIBS), -L$(dir)/lib)
  28. EXTRA_INCLUDES := -isystem $(CTRULIB)/include ${PORTLIBS_INCLUDES}
  29. EXTRA_LIBS := -L$(CTRULIB)/lib ${PORTLIBS_LIBS}
  30. ifeq (${DEBUG},1)
  31. ARCH_CFLAGS += -Og
  32. EXTRA_LIBS += -lcitro3dd -lctrud -lpng16 -lz
  33. else
  34. OPTIMIZE_CFLAGS = -O3 -fomit-frame-pointer -ffunction-sections
  35. # OPTIMIZE_CFLAGS += -flto
  36. EXTRA_LIBS += -lcitro3d -lctru -lpng16 -lz
  37. endif
  38. MACHDEP = -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft -mword-relocations
  39. ARCH_CFLAGS += ${EXTRA_INCLUDES} ${MACHDEP} -DARM11 -D__3DS__ -Iarch/3ds
  40. ARCH_CXXFLAGS += ${ARCH_CFLAGS}
  41. ARCH_LDFLAGS += ${EXTRA_LIBS} ${MACHDEP} -specs=3dsx.specs
  42. LIBPNG_CFLAGS =
  43. LIBPNG_LDFLAGS = -lpng16
  44. #
  45. # Vile hack, remove me ASAP
  46. # (also, vile hack in a vile hack to get the shaders to build parallel)
  47. #
  48. arch/3ds/%.o: arch/3ds/%.c arch/3ds/shader_2d.shbin.o arch/3ds/shader_playfield.shbin.o
  49. $(if ${V},,@echo " CC " $<)
  50. ${CC} -MD ${core_cflags} ${core_flags} -Wno-unused-macros -c $< -o $@
  51. # Do not delete these, since doing so will retrigger .o rebuilds above
  52. .SECONDARY: arch/3ds/shader_2d_shbin.h arch/3ds/shader_playfield_shbin.h
  53. arch/3ds/%.shbin: arch/3ds/%.v.pica arch/3ds/%.g.pica
  54. $(if ${V},,@echo " PICASSO " $^)
  55. @picasso -o $@ $^
  56. arch/3ds/%.shbin.o: arch/3ds/%.shbin arch/3ds/%_shbin.h
  57. $(if ${V},,@echo " AS " $<)
  58. @bin2s $< | $(AS) -o $@
  59. arch/3ds/%_shbin.h: arch/3ds/%.shbin
  60. $(eval CURLOC := $(patsubst %_shbin.h,%.shbin,$@))
  61. $(eval CURBIN := $(patsubst %_shbin.h,%.shbin,$(notdir $@)))
  62. $(if ${V},,@echo " ECHO " $@)
  63. @echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(CURLOC) | tr . _)`.h
  64. @echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(CURLOC) | tr . _)`.h
  65. @echo "extern const u32" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(CURLOC) | tr . _)`.h
  66. package: mzx mzxrun.smdh
  67. 3dsxtool ${mzxrun} ${mzxrun}.3dsx --smdh=${mzxrun}.smdh --romfs=arch/3ds/romfs
  68. bannertool makebanner -i arch/3ds/banner/megazeux-banner.png \
  69. -a arch/3ds/banner/silence.wav -o megazeux-cia.bnr
  70. bannertool makesmdh -s "MegaZeux" -l "MegaZeux game player" -p "MegaZeux developers" \
  71. -i arch/3ds/banner/megazeux-icon.png -o megazeux-cia.smdh -r regionfree
  72. makerom -f cia -elf ${mzxrun} -icon megazeux-cia.smdh -banner megazeux-cia.bnr \
  73. -desc app:4 -v -o ${mzxrun}.cia -target t -exefslogo -rsf arch/3ds/banner/megazeux.rsf
  74. clean:
  75. @rm -f ${mzxrun}.{smdh,cia,3dsx} megazeux-cia.smdh megazeux-cia.bnr arch/3ds/*.{d,o} arch/3ds/*shbin*
  76. build := build/${SUBPLATFORM}/3ds/megazeux
  77. build: package ${build}
  78. ${CP} arch/3ds/pad.config ${build}
  79. ${CP} ${mzxrun}.3dsx ${build}
  80. ${CP} ${mzxrun}.cia ${build}/../../
  81. ${RM} ${build}/${mzxrun} ${build}/${mzxrun}.debug
  82. include arch/zip.inc