From 67b4b8aad44098dd8fb100786e590a0acd05f14e Mon Sep 17 00:00:00 2001 From: yellows8 Date: Mon, 1 Jan 2018 19:55:11 -0500 Subject: [PATCH] Added icon handling to Makefiles, .jpg is used since official icons use it. --- graphics/printing/hello-world/Makefile | 23 +++++++++++++++++++++++ graphics/simplegfx/Makefile | 23 +++++++++++++++++++++++ templates/simple/Makefile | 23 +++++++++++++++++++++++ usb/usbds/Makefile | 23 +++++++++++++++++++++++ 4 files changed, 92 insertions(+) diff --git a/graphics/printing/hello-world/Makefile b/graphics/printing/hello-world/Makefile index f629409..77a71db 100644 --- a/graphics/printing/hello-world/Makefile +++ b/graphics/printing/hello-world/Makefile @@ -17,11 +17,17 @@ include $(DEVKITA64)/switch_rules # INCLUDES is a list of directories containing header files # EXEFS_SRC is the optional input directory containing data copied into exefs, if anything this normally should only contain "main.npdm". # +# NO_ICON: if set to anything, do not use icon. # NO_NACP: if set to anything, no .nacp file is generated. # APP_TITLE is the name of the app stored in the .nacp file (Optional) # APP_AUTHOR is the author of the app stored in the .nacp file (Optional) # APP_VERSION is the version of the app stored in the .nacp file (Optional) # APP_TITLEID is the titleID of the app stored in the .nacp file (Optional) +# ICON is the filename of the icon (.jpg), relative to the project folder. +# If not set, it attempts to use one of the following (in this order): +# - .jpg +# - icon.jpg +# - /default_icon.jpg #--------------------------------------------------------------------------------- TARGET := $(notdir $(CURDIR)) BUILD := build @@ -102,6 +108,23 @@ export BUILD_EXEFS_SRC := $(TOPDIR)/$(EXEFS_SRC) .PHONY: $(BUILD) clean all +ifeq ($(strip $(ICON)),) +icons := $(wildcard *.jpg) +ifneq (,$(findstring $(TARGET).jpg,$(icons))) + export APP_ICON := $(TOPDIR)/$(TARGET).jpg +else + ifneq (,$(findstring icon.jpg,$(icons))) + export APP_ICON := $(TOPDIR)/icon.jpg + endif +endif +else +export APP_ICON := $(TOPDIR)/$(ICON) +endif + +ifeq ($(strip $(NO_ICON)),) +export NROFLAGS += --icon=$(APP_ICON) +endif + ifeq ($(strip $(NO_NACP)),) export NROFLAGS += --nacp=$(CURDIR)/$(TARGET).nacp endif diff --git a/graphics/simplegfx/Makefile b/graphics/simplegfx/Makefile index f629409..77a71db 100644 --- a/graphics/simplegfx/Makefile +++ b/graphics/simplegfx/Makefile @@ -17,11 +17,17 @@ include $(DEVKITA64)/switch_rules # INCLUDES is a list of directories containing header files # EXEFS_SRC is the optional input directory containing data copied into exefs, if anything this normally should only contain "main.npdm". # +# NO_ICON: if set to anything, do not use icon. # NO_NACP: if set to anything, no .nacp file is generated. # APP_TITLE is the name of the app stored in the .nacp file (Optional) # APP_AUTHOR is the author of the app stored in the .nacp file (Optional) # APP_VERSION is the version of the app stored in the .nacp file (Optional) # APP_TITLEID is the titleID of the app stored in the .nacp file (Optional) +# ICON is the filename of the icon (.jpg), relative to the project folder. +# If not set, it attempts to use one of the following (in this order): +# - .jpg +# - icon.jpg +# - /default_icon.jpg #--------------------------------------------------------------------------------- TARGET := $(notdir $(CURDIR)) BUILD := build @@ -102,6 +108,23 @@ export BUILD_EXEFS_SRC := $(TOPDIR)/$(EXEFS_SRC) .PHONY: $(BUILD) clean all +ifeq ($(strip $(ICON)),) +icons := $(wildcard *.jpg) +ifneq (,$(findstring $(TARGET).jpg,$(icons))) + export APP_ICON := $(TOPDIR)/$(TARGET).jpg +else + ifneq (,$(findstring icon.jpg,$(icons))) + export APP_ICON := $(TOPDIR)/icon.jpg + endif +endif +else +export APP_ICON := $(TOPDIR)/$(ICON) +endif + +ifeq ($(strip $(NO_ICON)),) +export NROFLAGS += --icon=$(APP_ICON) +endif + ifeq ($(strip $(NO_NACP)),) export NROFLAGS += --nacp=$(CURDIR)/$(TARGET).nacp endif diff --git a/templates/simple/Makefile b/templates/simple/Makefile index f629409..77a71db 100644 --- a/templates/simple/Makefile +++ b/templates/simple/Makefile @@ -17,11 +17,17 @@ include $(DEVKITA64)/switch_rules # INCLUDES is a list of directories containing header files # EXEFS_SRC is the optional input directory containing data copied into exefs, if anything this normally should only contain "main.npdm". # +# NO_ICON: if set to anything, do not use icon. # NO_NACP: if set to anything, no .nacp file is generated. # APP_TITLE is the name of the app stored in the .nacp file (Optional) # APP_AUTHOR is the author of the app stored in the .nacp file (Optional) # APP_VERSION is the version of the app stored in the .nacp file (Optional) # APP_TITLEID is the titleID of the app stored in the .nacp file (Optional) +# ICON is the filename of the icon (.jpg), relative to the project folder. +# If not set, it attempts to use one of the following (in this order): +# - .jpg +# - icon.jpg +# - /default_icon.jpg #--------------------------------------------------------------------------------- TARGET := $(notdir $(CURDIR)) BUILD := build @@ -102,6 +108,23 @@ export BUILD_EXEFS_SRC := $(TOPDIR)/$(EXEFS_SRC) .PHONY: $(BUILD) clean all +ifeq ($(strip $(ICON)),) +icons := $(wildcard *.jpg) +ifneq (,$(findstring $(TARGET).jpg,$(icons))) + export APP_ICON := $(TOPDIR)/$(TARGET).jpg +else + ifneq (,$(findstring icon.jpg,$(icons))) + export APP_ICON := $(TOPDIR)/icon.jpg + endif +endif +else +export APP_ICON := $(TOPDIR)/$(ICON) +endif + +ifeq ($(strip $(NO_ICON)),) +export NROFLAGS += --icon=$(APP_ICON) +endif + ifeq ($(strip $(NO_NACP)),) export NROFLAGS += --nacp=$(CURDIR)/$(TARGET).nacp endif diff --git a/usb/usbds/Makefile b/usb/usbds/Makefile index f629409..77a71db 100644 --- a/usb/usbds/Makefile +++ b/usb/usbds/Makefile @@ -17,11 +17,17 @@ include $(DEVKITA64)/switch_rules # INCLUDES is a list of directories containing header files # EXEFS_SRC is the optional input directory containing data copied into exefs, if anything this normally should only contain "main.npdm". # +# NO_ICON: if set to anything, do not use icon. # NO_NACP: if set to anything, no .nacp file is generated. # APP_TITLE is the name of the app stored in the .nacp file (Optional) # APP_AUTHOR is the author of the app stored in the .nacp file (Optional) # APP_VERSION is the version of the app stored in the .nacp file (Optional) # APP_TITLEID is the titleID of the app stored in the .nacp file (Optional) +# ICON is the filename of the icon (.jpg), relative to the project folder. +# If not set, it attempts to use one of the following (in this order): +# - .jpg +# - icon.jpg +# - /default_icon.jpg #--------------------------------------------------------------------------------- TARGET := $(notdir $(CURDIR)) BUILD := build @@ -102,6 +108,23 @@ export BUILD_EXEFS_SRC := $(TOPDIR)/$(EXEFS_SRC) .PHONY: $(BUILD) clean all +ifeq ($(strip $(ICON)),) +icons := $(wildcard *.jpg) +ifneq (,$(findstring $(TARGET).jpg,$(icons))) + export APP_ICON := $(TOPDIR)/$(TARGET).jpg +else + ifneq (,$(findstring icon.jpg,$(icons))) + export APP_ICON := $(TOPDIR)/icon.jpg + endif +endif +else +export APP_ICON := $(TOPDIR)/$(ICON) +endif + +ifeq ($(strip $(NO_ICON)),) +export NROFLAGS += --icon=$(APP_ICON) +endif + ifeq ($(strip $(NO_NACP)),) export NROFLAGS += --nacp=$(CURDIR)/$(TARGET).nacp endif