Using the omake Tool

This document provides a brief explanation of the omake tool used in the CTR-SDK build system.
The following descriptions assume that the build environment can locate the omake executable through the PATH environment variable.

BUILDING

Delete

Special Options for omake

How to Use the Build System

This section describes how to use the environment variables, build options, and build variables that are used by the CTR-SDK build system.

Environment Variables Required When Building the SDK

The following are the environment variables that must be set when building using the CTR-SDK build system.
If an option is not set, the default value is used.
Environment Variables Description Default Value
CTRSDK_ROOT
(HORIZON_ROOT)
►IMPORTANT
Directory where the CTR-SDK is installed (the directory where $CTR-SDK is extracted). $OMAKEROOT
RVCT40BIN
RVCT40INC
RVCT40LIB
Directory where the ARM compiler is installed. Normally, these are set automatically during installation of the ARM compiler.
CTRSDK_RVCT_VER Sets the ARM compiler version to use for the build. If the environment variable corresponding to the specified ARM compiler has not been configured, the ARM compiler used is the most recent one that supports the CTR-SDK among the configured environmental variables.

Example (to build with RVCT 4.0):
CTRSDK_RVCT_VER=40
Example (to build with RVCT 4.1):
CTRSDK_RVCT_VER=41
40 (to build with RVCT 4.0)
CTRSDK_TARGETS Sets the target hardware and optimization options in environment variables.
The only specifiable hardware is TS, and the specifiable optimization options are fast and small.
If FILTER is set, these options are ignored.

CTR-TS.* TS board

*.fast Optimized for speed
*.small Optimized for size

Example (supporting only speed-optimized builds on TS boards):
CTRSDK_TARGETS=CTR-TS.Process.MPCore.fast
Example (to support both fast and small builds on TS boards):
CTRSDK_TARGETS=CTR-TS.Process.MPCore.*
None.

Available Build Options When Building the SDK

The following are the build options used when building using the CTR-SDK build system.
These can be specified as arguments to the omake command.
If an option is not set, the default value is used.
Build Options Description Default Value
BUILD Sets the target build type.
The three possible settings are debug, development, and release.
Changing this setting will change the compile options and which libraries are linked when running the omake command.

The details for each build type are as follows.
Features debug development release
Operations guaranteed No Scope
Debug Output Functions from OS API Enabled Disabled
Application Optimization OFF ON
Library Optimization OFF ON
SDK internal debug codes Enabled Disabled
ASSERT Enabled Disabled
HostIO Enabled Disabled

Although debug information is included in release build object files, it is removed by makerom.
development
DEBUG_PRINT Enables or disables debug output functions regardless of build type.
Specifying true to the macro enables NN_LOG (OS debug output), and specifying false leaves NN_LOG empty.

However, the debug output used in the SDK cannot be enabled or disabled.
For release builds: false
Otherwise: true
ASSERT_WARNING Enables or disables ASSERTs/WARNINGs regardless of build type.
Specifying true to the macro enables NN_*ASSERT/NN_WARNING, and specifying false will leave NN_*ASSERT/NN_WARNING empty.

However, the ASSERTs/WARNINGs used in the SDK cannot be enabled or disabled.
For release builds: false
Otherwise: true
FILTER Sets the target hardware and optimization options.
The only specifiable hardware is TS, and the specifiable optimization options are fast and small.
If these are set, the CTRSDK_TARGETS setting is ignored.

CTR-TS.* TS board

*.fast Optimized for speed
*.small Optimized for size

Example (supporting only speed-optimized builds on TS boards):
FILTER=CTR-TS.Process.MPCore.fast
Example (to support both fast and small builds on TS boards):
FILTER=CTR-TS.Process.MPCore.*
CTR-TS*MPCore*
(to support both fast and small on TS boards)

Available Build Options in the SDK OMakefile

The following options are available for setting build conditions per directory in the CTR-SDK OMakefile.
These specify source files and concatenated OMakefiles.
If an option is not set, the default value is used.


Build Variable Description Default Value
SUPPORTED_TARGETS
►IMPORTANT
Sets the targets supported by the program.
The only specifiable hardware is TS, and the specifiable optimization options are fast and small.

CTR-TS.* TS board

*.fast Optimized for speed
*.small Optimized for size

Example (supporting only speed-optimized builds on TS boards):
SUPPORTED_TARGETS = CTR-TS.Process.MPCore.fast
Example (to support both fast and small builds on TS boards):
SUPPORTED_TARGETS = CTR-TS.Process.MPCore.*
None.
CTR_APPTYPE Sets the type of CTR application to create. If you specify true for CTR_NANDAPP, the CTR_APPTYPE becomes NAND.

CARD Creates a CTR CCI file (a CXI file packaged to be a CARD application)
NAND Creates a CTR CIA file (the CXI file packaged to be a NAND application) and a CTR CXI file (the executable image)
BOTH Creates a CCI file, a CIA file, and the CXI file
CARD
SOURCES Enumerates the source files to be compiled/assembled.
The build system attempts to generate object files using the compiler or assembler that is appropriate for a given file extension (for example, .c, .cpp, or .s).
None.
INCLUDES Specifies the directory if there are any include files specific to this program.
By default, this variable is set to the $CTR-SDK/include and $OMAKEROOT/include directories, so any additional settings must be specified using the += operator.
$CTR-SDK/include
$OMakeroot/include
LIBS Specifies the libraries to link. The filename extension is not needed.
The build system automatically links several standard libraries, but any special libraries required for a specific program must be explicitly specified here.
Usually, a fast build will have the libnn_xxx.fast library linked in as the library matching the optimization option, but it is also possible to explicitly specify the optimization option, as for libnn_xxx.fast.
This variable is set by default to the standard library, so any additional settings must be specified using the += operator.

Example (to link against the additional library libnn_xxx):
LIBS += libnn_xxx
Standard library
LIBFILES Specifies additional libraries to link to this program.

Example (to link the additional library $TMP/libraries/CTR-TS.Process.MPCore/[noopt|release|verbose]/libnn_xxx.[fast|small].a):
LIBFILES = $`(addprefix $(TMP)$(DIRSEP)libraries$(DIRSEP)$(config.getTargetSubDirectory true)$(DIRSEP), libnn_xxx)
None.
TARGET_PROGRAM Specifies the name of the image to generate. The filename extension is not needed.
Links the object files created by compiling/assembling the source files specified in SOURCES, and creates the target file.
The extension of the created target file is normally cci.
None.
TARGET_LIBRARY Specifies the names of the library to build. The filename extension is not needed.
Concatenates the object files created by compiling/assembling the source files specified in SOURCES, creating a library.
None.
CCFLAGS Set this variable when you want to change the options passed to the compiler when compiling source files or creating linker script files.
This variable is set to the required options by default, so any additional options must be specified using the += operator.
See commondefs.cctype.RVCT.om for more information.
CCFLAGS_WARNING
►CAUTION
Set this variable when you want to change the warning options passed to the compiler.
The warning options should be set always using this variable, not CCFLAGS.
This variable is set to the required options by default, so any additional options must be specified using the += operator.
See commondefs.cctype.RVCT.om for more information.
CCFLAGS_DEV_OPT Use this variable to set the optimization level of a development build of an application, when you want the level to be different for development builds. The optimization level specification does not affect release or debug builds.
See commondefs.cctype.RVCT.om for more information.
CFLAGS Set this variable when you want to change the options passed to the compiler only when compiling C files.
This variable is set to the required options by default, so any additional options must be specified using the += operator.
See commondefs.cctype.RVCT.om for more information.
CXXFLAGS Set this variable when you want to change the options passed to the compiler only when compiling C++ files.
This variable is set to the required options by default, so any additional options must be specified using the += operator.
See commondefs.cctype.RVCT.om for more information.
ASFLAGS Set this variable when you want to change the options passed to the compiler only when compiling assembler files.
This variable is set to the required options by default, so any additional options must be specified using the += operator.
See commondefs.cctype.RVCT.om for more information.
LDFLAGS Set this variable when you want to change the options passed to the linker.
This variable is set to the required options by default, so any additional options must be specified using the += operator.
See commondefs.cctype.RVCT.om for more information.
LDFLAGS_WARNING Set this variable when you want to change the warning options passed to the linker.

This variable is set to the required options by default, so any additional options must be specified using the += operator.
See commondefs.cctype.RVCT.om for more information.
LDSCRIPT_TEMPLATE Specifies the linker script file template to be passed to the linker when creating linker script files.
$CTR-SDK/build/linker/*.ldscript.template
ROM_SPEC_FILE Specifies a file describing the contents of a ROM file (RSF:RomSpecFile).
The file specified here is passed to ctr_makerom, and the CCI files are created based on the settings in this file.
$CTR-SDK/resource/specfiles/Application.rsf
MAKEROMFLAGS Set this variable when you want to change the options passed to ctr_makerom.
This variable is set to the required options by default, so any additional options must be specified using the += operator.
See commondefs.om for more information.
ROMFS_ROOT Specifies the value passed to ctr_makerom in -DROMFS_ROOT=.
The value can be referenced in RSF by using $(ROMFS_ROOT).
None.
TITLE Specifies the value passed to ctr_makerom in -DTITLE=.
The value can be referenced in RSF by using $(TITLE).
CtrApp
CTR_BANNER Specifies the banner file. The value specified here can be passed to ctr_makerom by using the -banner option.
CTR_NO_BANNER = true must be specified if not using banners, because a default value will be set even if this specification is omitted. This specification cannot be made at the same time as CTR_BANNER_SPEC.
$CTR-SDK/resources/banner/Default.bnr
CTR_ICON Specifies the icon file. The value specified here can be passed to ctr_makerom by using the -icon option.
CTR_NO_BANNER = true must be specified if not using icons, because a default value will be set even if this specification is omitted. This specification cannot be made at the same time as CTR_BANNER_SPEC.
$CTR-SDK/resources/banner/Default.icn
CTR_NO_BANNER This variable must be set to true if not using banners or icons.
None.
CTR_BANNER_SPEC Specifies the spec file to use as input to ctr_makebanner.
Data generated by ctr_makebanner can be input as-is to ctr_makerom.
This variable cannot be used at the same time as CTR_BANNER or CTR_ICON.
None.
SHADER_SOURCES Enumerates the vertex shader assembler files (.vsh) to be compiled/assembled.
None.
SHADER_INCLUDES Specifies the directory containing include files referenced when compiling vertex shader assembler files.
By default, this variable is set to the $CTR-SDK/resources directory, so any additional settings must be specified using the += operator.
$CTR-SDK/resources
SHADER_OBJECTS Enumerates the object files to be added during the shader binary build.
None.
SHADER_OBJECTS_PREBUILT Enumerates the object files to be added during the shader binary build.
This variable is only used for reserved geometry shaders.
Specify the object files using paths relative to $CTR-SDK/resources/shader.
None.
TARGET_SHADER Specifies the names of the shader binary (.shbin) files that are ultimately output. The filename extension is not needed.
If you explicitly specify an empty name, the build system will assemble without linking.
shader
SHBIN_INSTALL_ROOT Specifies the installation root for the shader binary file.
Value of ROMFS_ROOT
SHADER_BINARY Sets the full path of the shader binary file.
To use, reference after referencing modulerules.
Full path to .shbin file
INSTALL_ROOT
►CAUTION
Specifies the absolute or relative path to the directory to which results should be installed.
Use to change the installation directory for libraries and target files.
This variable must be set before the commondefs file is referenced. (Setting the variable within OMakeroot is one way of ensuring this.)

Example (to change the installation directory to .tmp):
INSTALL_ROOT = ./tmp
None.
CTR_NANDAPP Specify true to create a CTR CIA file (the CXI file packaged to be a NAND application) and a CTR CXI file (the executable image).
Currently this variable is retained for compatibility, but it is scheduled for removal in the next SDK release. Use CTR_APPTYPE instead.

true Creates a CTR CIA file (the CXI file packaged to be a NAND application) and a CTR CXI file (the executable image).
false Creates a CTR CCI file (a CXI file packaged to be a CARD application).
false
HOST_IO If set to true, HostIO is enabled regardless of build type.
For release builds: false
Otherwise: true
TARGET_BUILDTYPES Specifies the build type specified on the command line.
Use after referencing commondefs, such as to exclude a specific build type.

Example (excluding the debug build):
TARGET_BUILDTYPES = $(filter Release Development, $(TARGET_BUILDTYPES))
None.
CHILD_APPS Specifies the child program to use for download play distribution. Input example (This is an example using SampleDemos/dlp/SimpleServer/OMakefile. The child is specified according to the target and build type.)
CHILD_APPS[] = 
    ../Child_0/images/$(BUILD_TARGET_DIR)/$(BUILD_TYPE_DIR)/Child_0.cia
    ../Child_1/images/$(BUILD_TARGET_DIR)/$(BUILD_TYPE_DIR)/Child_1.cia
None.