From 4edc8271be9ea8aff6b0def2a90bc7cd2646bc1a Mon Sep 17 00:00:00 2001 From: fincs Date: Tue, 5 Jan 2021 17:41:04 +0100 Subject: [PATCH] Buildsystem: add support for creating .wuhb files --- .gitignore | 5 +++- samples/make/helloworld/Makefile | 51 ++++++++++++++++++++++++++++++-- share/wut_rules | 39 ++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 49e2a46..aeb94bf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +.*/ +!.github/ build/ release/ debug/ @@ -6,8 +8,9 @@ lib/ *.o *.d *.elf +*.rpl *.rpx +*.wuhb *.bz2 docs/html/ -.vs/ CMakeSettings.json diff --git a/samples/make/helloworld/Makefile b/samples/make/helloworld/Makefile index b9e3777..b937a08 100644 --- a/samples/make/helloworld/Makefile +++ b/samples/make/helloworld/Makefile @@ -8,6 +8,15 @@ endif TOPDIR ?= $(CURDIR) +#------------------------------------------------------------------------------- +# APP_NAME sets the long name of the application +# APP_SHORTNAME sets the short name of the application +# APP_AUTHOR sets the author of the application +#------------------------------------------------------------------------------- +#APP_NAME := Application Name +#APP_SHORTNAME := App Name +#APP_AUTHOR := Built with devkitPPC & wut + include $(DEVKITPRO)/wut/share/wut_rules #------------------------------------------------------------------------------- @@ -16,12 +25,20 @@ include $(DEVKITPRO)/wut/share/wut_rules # SOURCES is a list of directories containing source code # DATA is a list of directories containing data files # INCLUDES is a list of directories containing header files +# CONTENT is the path to the bundled folder that will be mounted as /vol/content/ +# ICON is the game icon, leave blank to use default rule +# TV_SPLASH is the image displayed during bootup on the TV, leave blank to use default rule +# DRC_SPLASH is the image displayed during bootup on the DRC, leave blank to use default rule #------------------------------------------------------------------------------- TARGET := $(notdir $(CURDIR)) BUILD := build SOURCES := source DATA := data INCLUDES := include +CONTENT := +ICON := +TV_SPLASH := +DRC_SPLASH := #------------------------------------------------------------------------------- # options for code generation @@ -44,7 +61,6 @@ LIBS := -lwut #------------------------------------------------------------------------------- LIBDIRS := $(PORTLIBS) $(WUT_ROOT) - #------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional # rules for different file extensions @@ -90,6 +106,34 @@ export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) +ifneq (,$(strip $(CONTENT))) + export APP_CONTENT := $(TOPDIR)/$(CONTENT) +endif + +ifneq (,$(strip $(ICON))) + export APP_ICON := $(TOPDIR)/$(ICON) +else ifneq (,$(wildcard $(TOPDIR)/$(TARGET).png)) + export APP_ICON := $(TOPDIR)/$(TARGET).png +else ifneq (,$(wildcard $(TOPDIR)/icon.png)) + export APP_ICON := $(TOPDIR)/icon.png +endif + +ifneq (,$(strip $(TV_SPLASH))) + export APP_TV_SPLASH := $(TOPDIR)/$(TV_SPLASH) +else ifneq (,$(wildcard $(TOPDIR)/tv-splash.png)) + export APP_TV_SPLASH := $(TOPDIR)/tv-splash.png +else ifneq (,$(wildcard $(TOPDIR)/splash.png)) + export APP_TV_SPLASH := $(TOPDIR)/splash.png +endif + +ifneq (,$(strip $(DRC_SPLASH))) + export APP_DRC_SPLASH := $(TOPDIR)/$(DRC_SPLASH) +else ifneq (,$(wildcard $(TOPDIR)/drc-splash.png)) + export APP_DRC_SPLASH := $(TOPDIR)/drc-splash.png +else ifneq (,$(wildcard $(TOPDIR)/splash.png)) + export APP_DRC_SPLASH := $(TOPDIR)/splash.png +endif + .PHONY: $(BUILD) clean all #------------------------------------------------------------------------------- @@ -102,7 +146,7 @@ $(BUILD): #------------------------------------------------------------------------------- clean: @echo clean ... - @rm -fr $(BUILD) $(TARGET).rpx $(TARGET).elf + @rm -fr $(BUILD) $(TARGET).wuhb $(TARGET).rpx $(TARGET).elf #------------------------------------------------------------------------------- else @@ -113,8 +157,9 @@ DEPENDS := $(OFILES:.o=.d) #------------------------------------------------------------------------------- # main targets #------------------------------------------------------------------------------- -all : $(OUTPUT).rpx +all : $(OUTPUT).wuhb +$(OUTPUT).wuhb : $(OUTPUT).rpx $(OUTPUT).rpx : $(OUTPUT).elf $(OUTPUT).elf : $(OFILES) diff --git a/share/wut_rules b/share/wut_rules index d334260..18db3a1 100644 --- a/share/wut_rules +++ b/share/wut_rules @@ -23,6 +23,45 @@ RPLSPECS := -specs=$(WUT_ROOT)/share/wut.specs -specs=$(WUT_ROOT)/share/rpl.spec MACHDEP = -DESPRESSO -mcpu=750 -meabi -mhard-float +WUHB_DEPS := +WUHB_OPTIONS := + +ifneq ($(strip $(APP_CONTENT)),) +WUHB_OPTIONS += --content=$(APP_CONTENT) +endif + +ifneq ($(strip $(APP_NAME)),) +WUHB_OPTIONS += --name "$(APP_NAME)" +endif + +ifneq ($(strip $(APP_SHORTNAME)),) +WUHB_OPTIONS += --short-name "$(APP_SHORTNAME)" +endif + +ifneq ($(strip $(APP_AUTHOR)),) +WUHB_OPTIONS += --author "$(APP_AUTHOR)" +endif + +ifneq ($(strip $(APP_ICON)),) +WUHB_DEPS += $(APP_ICON) +WUHB_OPTIONS += --icon=$(APP_ICON) +endif + +ifneq ($(strip $(APP_TV_SPLASH)),) +WUHB_DEPS += $(APP_TV_SPLASH) +WUHB_OPTIONS += --tv-image=$(APP_TV_SPLASH) +endif + +ifneq ($(strip $(APP_DRC_SPLASH)),) +WUHB_DEPS += $(APP_DRC_SPLASH) +WUHB_OPTIONS += --drc-image=$(APP_DRC_SPLASH) +endif + +#--------------------------------------------------------------------------------- +%.wuhb: %.rpx $(WUHB_DEPS) + $(SILENTCMD)wuhbtool $< $@ $(WUHB_OPTIONS) + @echo built ... $(notdir $@) + #--------------------------------------------------------------------------------- %.rpx: %.elf $(SILENTCMD)elf2rpl $< $@ $(ERROR_FILTER)