From b17a53fefc8a16426dfc00879875d2a36777bea3 Mon Sep 17 00:00:00 2001 From: profi200 Date: Mon, 10 Nov 2014 22:30:07 +0100 Subject: [PATCH] Makefile updated, added another note to the README.md file andremoved the svcSleepThread() call --- examples/app_launch/Makefile | 76 +++++++++++++++++++++++-------- examples/app_launch/README.md | 4 +- examples/app_launch/source/main.c | 1 - 3 files changed, 59 insertions(+), 22 deletions(-) diff --git a/examples/app_launch/Makefile b/examples/app_launch/Makefile index c850c22..568eda2 100644 --- a/examples/app_launch/Makefile +++ b/examples/app_launch/Makefile @@ -20,21 +20,29 @@ include $(DEVKITARM)/3ds_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 -# SPECS is the directory containing the important build and link files +# +# NO_SMDH: if set to anything, no SMDH file is generated. +# APP_TITLE is the name of the app stored in the SMDH file (Optional) +# APP_DESCRIPTION is the description of the app stored in the SMDH file (Optional) +# APP_AUTHOR is the author of the app stored in the SMDH file (Optional) +# ICON is the filename of the icon (.png), relative to the project folder. +# If not set, it attempts to use one of the following (in this order): +# - .png +# - icon.png +# - /default_icon.png #--------------------------------------------------------------------------------- -export TARGET := $(shell basename $(CURDIR)) +TARGET := $(notdir $(CURDIR)) BUILD := build SOURCES := source DATA := data INCLUDES := include - #--------------------------------------------------------------------------------- # options for code generation #--------------------------------------------------------------------------------- -ARCH := -march=armv6k -mtune=mpcore +ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=softfp -CFLAGS := -g -Wall -O3 -mword-relocations -save-temps \ +CFLAGS := -g -Wall -O2 -mword-relocations \ -fomit-frame-pointer -ffast-math \ $(ARCH) @@ -43,8 +51,7 @@ CFLAGS += $(INCLUDE) -DARM11 -D_3DS CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11 ASFLAGS := -g $(ARCH) -LDFLAGS = -specs=3dsx.specs -g $(ARCH) \ - -Wl,-Map,$(TARGET).map +LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) LIBS := -lctru -lm @@ -53,15 +60,15 @@ LIBS := -lctru -lm # include and lib #--------------------------------------------------------------------------------- LIBDIRS := $(CTRULIB) - - + + #--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional # rules for different file extensions #--------------------------------------------------------------------------------- ifneq ($(BUILD),$(notdir $(CURDIR))) #--------------------------------------------------------------------------------- - + export OUTPUT := $(CURDIR)/$(TARGET) export TOPDIR := $(CURDIR) @@ -98,42 +105,71 @@ export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) +ifeq ($(strip $(ICON)),) + icons := $(wildcard *.png) + ifneq (,$(findstring $(TARGET).png,$(icons))) + export APP_ICON := $(TOPDIR)/$(TARGET).png + else + ifneq (,$(findstring icon.png,$(icons))) + export APP_ICON := $(TOPDIR)/icon.png + endif + endif +else + export APP_ICON := $(TOPDIR)/$(ICON) +endif + .PHONY: $(BUILD) clean all - + #--------------------------------------------------------------------------------- all: $(BUILD) $(BUILD): @[ -d $@ ] || mkdir -p $@ @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile - + #--------------------------------------------------------------------------------- clean: @echo clean ... - @rm -fr $(BUILD) $(TARGET).3dsx $(TARGET).elf - - + @rm -fr $(BUILD) $(TARGET).3dsx $(OUTPUT).smdh $(TARGET).elf + + #--------------------------------------------------------------------------------- else - + DEPENDS := $(OFILES:.o=.d) - + #--------------------------------------------------------------------------------- # main targets #--------------------------------------------------------------------------------- +ifeq ($(strip $(NO_SMDH)),) +.PHONY: all +all : $(OUTPUT).3dsx $(OUTPUT).smdh +endif $(OUTPUT).3dsx : $(OUTPUT).elf $(OUTPUT).elf : $(OFILES) #--------------------------------------------------------------------------------- -# you need a rule like this for each extension you use as binary data +# you need a rule like this for each extension you use as binary data #--------------------------------------------------------------------------------- %.bin.o : %.bin #--------------------------------------------------------------------------------- @echo $(notdir $<) - $(bin2o) + @$(bin2o) + +# WARNING: This is not the right way to do this! TODO: Do it right! +#--------------------------------------------------------------------------------- +%.vsh.o : %.vsh +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @python $(AEMSTRO)/aemstro_as.py $< ../$(notdir $<).shbin + @bin2s ../$(notdir $<).shbin | $(PREFIX)as -o $@ + @echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(notdir $<).shbin | tr . _)`.h + @echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(notdir $<).shbin | tr . _)`.h + @echo "extern const u32" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(notdir $<).shbin | tr . _)`.h + @rm ../$(notdir $<).shbin -include $(DEPENDS) - + #--------------------------------------------------------------------------------------- endif #--------------------------------------------------------------------------------------- diff --git a/examples/app_launch/README.md b/examples/app_launch/README.md index f3f2c08..2fa1986 100644 --- a/examples/app_launch/README.md +++ b/examples/app_launch/README.md @@ -3,5 +3,7 @@ app_launch Example for launching other apps/applets with ctrulib. Press the A button to launch the app or applet specified in the source. -Note: The title ID of the EUR Nintendo 3DS Camera app is hardcoded and you need to change it if your 3DS is not an european one. See here for title IDs: http://3dbrew.org/wiki/Title_list#00040010_-_System_Applications + +Note: The title ID of the EUR Nintendo 3DS Camera app is hardcoded and you need to change it if your 3DS is not an european one. See here for title IDs: http://3dbrew.org/wiki/Title_list#00040010_-_System_Applications +This example only works if launched as regular app by the home menu. It will not work with the homebrew menu. diff --git a/examples/app_launch/source/main.c b/examples/app_launch/source/main.c index 1c4dcdc..0077c6c 100644 --- a/examples/app_launch/source/main.c +++ b/examples/app_launch/source/main.c @@ -19,7 +19,6 @@ int main() while(aptMainLoop()) { hidScanInput(); - svcSleepThread(100000000LL); if(hidKeysDown() & KEY_A) {