omake Toolomake Commandomake Optionsomake Targetsomake VariablesOMakefile of CTR-SDKOMakefile
omake ToolOMake. OMake is the command-line build environment of CTR-SDK. The following descriptions assume that the build environment can locate the omake executable through the PATH environment variable.
omake Commandomake command is a tool for automating application build and other procedures. On start, the omake command loads a file containing build rules (OMakefile in the current directory), and then calls the compiler and linker according to those rules. OMake version 0.9.8.5-3. It also supports OMake 0.9.8.5-3 patch 7, which includes modifications made by Nintendo. Cygwin or Windows command prompt as follows.
% omakeYou can change the operation of
omake by using options, setting variables, and specifying the target name. % omake [OPTIONS] [VARIABLE=SETTING] [TARGET_NAME]To facilitate the creation of
OMakefiles, CTR-SDK provides files (in the following directories) that contain frequently used build rules.
$CTR_SDK/build/omakecommondefsmodulerulescommondefs and modulerules in your OMakefile when building your application. For information about coding an OMakefile, see OMakefile.
omake Optionsomake. | Options | Description |
|---|---|
--version | Check the version. |
-j <PARALLEL_COUNT> | Perform the specified number of parallel builds. |
--verbose | Build while displaying the command that is being run. |
--depend | Ignore dependencies in the build. |
-U |
Ignore dependencies and the cache in the build. (This option is useful when you have deleted a header file, because it discards all cached dependencies when building.) |
omake Targets% omake
% omake build
Starts building and creates the final target.
OMakeroot. omake build command in directories where there are dependencies.SOURCES and generates object files.TARGET_PROGRAM. (Specify the filename in TARGET_LIBRARY if you want to generate a library file.)build is the default target name when the target value for omake is omitted. You can perform the omake build action simply by typing omake.
OMake starts by checking all dependencies under OMakeroot. Even if you run the omake command somewhere under OMakeroot, it performs dependent builds. The command generates the build output in a directory named for the build type of the program being built and other attributes. For example, a build directory could be named images/CTR-TS.Process.MPCore.[fast|small]/[Release|Development|Debug]. For information about how to change the target's build type and other attributes, see Build Switches.
% omake clean
Deletes files generated by omake build.
OMakeroot. omake clean command in directories where there are dependencies.images and objects.omake VariablesOMakefile describe the omake variables. | Environment Variable | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|
CTRSDK_ROOT[Required] |
Directory where CTR-SDK is installed (the directory into which $CTR_SDK is extracted). Example (the Windows-format absolute path must be specified):
Default: None |
||||||||
ARMCC41BIN |
Directory where the ARM compiler is installed. Default: None. (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 variables corresponding to the specified ARM compiler have not been set, the newest ARM compiler that supports CTR-SDK is used. Operation is currently not guaranteed on compilers other than ARMCC 4.1. Example (to build with ARMCC 4.1):
Default: 41 (build with ARMCC 4.1). |
||||||||
CTRSDK_TARGETS |
Sets the target hardware and optimization type in environment variables. The only hardware setting is TS, and the optimization type settings are fast and small. If FILTER is set, these options are ignored.
Example (when supporting only fast builds on development hardware):
fast and small builds on development hardware):
Default: CTR-TS*MPCore* (when supporting both fast and small on development hardware).
|
omake command. | Build Options | Description | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
BUILD |
Sets the target build type. The four possible settings are Debug, Development, Release, and full. Specify full to build all build types. You can specify multiple types by delimiting them with commas. Changing this setting changes the compile options and the libraries that are linked when running the omake command. The details for each build type are as follows.
Debug builds disable the gnu extensions.Although debug information is included in the Release build object files, it is removed by makerom.Default: Development |
||||||||||||||||||||||||||||||||
DEBUG_PRINT |
Enables or disables debug output functions regardless of build type. Specifying true to the macro enables NN_LOG (OS debug output); specifying false leaves NN_LOG empty. However, the debug output used in CTR-SDK cannot be enabled or disabled. Default: For release builds, false; otherwise, true.
|
||||||||||||||||||||||||||||||||
ASSERT_WARNING |
Enables or disables ASSERTs and WARNINGs regardless of build type. Specifying true to the macro enables NN_*ASSERT/NN_WARNING; specifying false leaves NN_*ASSERT/NN_WARNING empty. However, CTR-SDK ASSERTs and WARNINGs cannot be enabled or disabled. Defaults: For release builds, false; otherwise, true.
|
||||||||||||||||||||||||||||||||
FILTER |
Sets the target hardware and optimization type. The only hardware setting is TS, and the optimization type settings are fast and small. If these are set, the CTRSDK_TARGETS setting is ignored.
Example (when supporting only fast builds on development hardware):
fast and small builds on development hardware):
Default: CTR-TS*MPCore* (when supporting both fast and small on development hardware).
|
||||||||||||||||||||||||||||||||
OMakefile of CTR-SDKOMakefile. modulerules. | Build Variable | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|
SUPPORTED_TARGETS[Required] |
Sets the targets supported by the program. The only available hardware setting is TS, and the optimization type settings are fast and small.
Example (when supporting only fast builds on development hardware):
fast and small builds on development hardware):
Default: None |
||||||||
CTR_APPTYPE |
Sets the type of CTR application to create. You can specify multiple types by delimiting them with spaces. You must configure this variable between the include statements for commondefs and modulerules.
Default: CARD.
|
||||||||
SOURCES |
Enumerates the source files to compile or assemble. The build system attempts to generate object files, using the compiler or assembler, for the file extensions .c, .cpp, or .s. You must configure this variable between the include statements for commondefs and modulerules.Default: 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. Any additional settings must be specified using the += operator.You must configure this variable between the include statements for commondefs and modulerules.Default: $CTR-SDK/include, $OMakeroot/include.
|
||||||||
OBJECTS |
Specifies the object files to link. Example (linking object file xxx.o):
Default: None |
||||||||
LIBS |
Specifies the libraries to link. The 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. A fast build normally links in the libnn_xxx.fast library to match the optimization type, but it is also possible to explicitly specify libnn_xxx.fast. In this case, the specified library is linked regardless of the optimization type. This variable is set by default to the standard library, so any additional settings must be specified using the += operator.You must configure this variable between the include statements for commondefs and modulerules.Example (to link against the additional library libnn_xxx):
libnn_xxx.fast):
Default: Standard library (see $CTR_SDK/build/omake/platforms/CTR.targetdefs.om).
|
||||||||
LIBFILES |
Specifies program-specific libraries to link when building an image with TARGET_PROGRAM specified. You must configure this variable between the include statements for commondefs and modulerules.Example (to add the $TMP/libraries/CTR-TS.Process.MPCore/release/libnn_xxx.[fast|small].a library):
Default: None |
||||||||
LIBRARY_LIBFILES |
Specifies program-specific libraries to link when building an image with TARGET_LIBRARY specified. You must configure this variable between the include statements for commondefs and modulerules.Example (to add the $TMP/libraries/CTR-TS.Process.MPCore/release/libnn_xxx.[fast|small].a library):
Default: None |
||||||||
TARGET_PROGRAM |
Specifies the name of the image to generate. The extension is not needed. Links the object files created by compiling or assembling the source files specified in SOURCES and creates the target file. The extension of the created target file is normally .cci. Note that the defined macro is different when specifying TARGET_PROGRAM or TARGET_LIBRARY.Default: None |
||||||||
TARGET_LIBRARY[Caution] |
Specifies the names of the library to build. The extension is not needed. Compiles or assembles the source files specified by SOURCES and links the resulting object files to create the library. Note that the defined macro is different when specifying TARGET_PROGRAM or TARGET_LIBRARY.Default: 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. Any additional options must be specified using the += operator.Default: See $CTR_SDK/build/omake/compilers/commondefs.cctype.RVCT.om.
|
||||||||
CCFLAGS_WARNING[Caution] |
Set this variable when you want to change the warning options passed to the compiler. Always set the warning options using this variable, not CCFLAGS.This variable is set to the required options by default. Any additional options must be specified using the += operator.Default: See $CTR_SDK/build/omake/compilers/commondefs.cctype.RVCT.om.
|
||||||||
CCFLAGS_DEV_OPT |
To change the optimization level of an application in a Development build, set this variable. The specified optimization level does not affect Release or Debug builds. Default: See $CTR_SDK/build/omake/compilers/commondefs.cctype.RVCT.om.
|
||||||||
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. Any additional options must be specified using the += operator.Default: See $CTR_SDK/build/omake/compilers/commondefs.cctype.RVCT.om.
|
||||||||
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. Any additional options must be specified using the += operator.Default: See $CTR_SDK/build/omake/compilers/commondefs.cctype.RVCT.om.
|
||||||||
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. Any additional options must be specified using the += operator.Default: See $CTR_SDK/build/omake/compilers/commondefs.cctype.RVCT.om.
|
||||||||
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. Any additional options must be specified using the += operator.Default: See $CTR_SDK/build/omake/compilers/commondefs.cctype.RVCT.om.
|
||||||||
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. Any additional options must be specified using the += operator.Default: See $CTR_SDK/build/omake/compilers/commondefs.cctype.RVCT.om.
|
||||||||
ENABLE_CPP_EXCEPTION |
Set this variable to true to enable C++ exceptions. You must configure this variable between the include statements for commondefs and modulerules.Default: false.
|
||||||||
INSTALL_ROOT[Caution] |
Specifies the absolute or relative path to the installation directory. Use to change the installation directory for libraries and target files. This variable must be set before the commondefs file is included. (Setting the variable within OMakeroot is one way of ensuring this.)Example (to change the installation directory to .tmp):
Default: None |
||||||||
HostIO |
If set to true, HostIO is enabled regardless of build type. Defaults: For release builds, false; otherwise, true.
|
||||||||
TARGET_BUILDTYPES |
Specifies the build type specified on the command line. Use this variable to exclude a particular build type or in other such cases. If you reference or set this variable, you must do so between the include statements for commondefs and modulerules.Example (to exclude Debug builds):
Default: None |
||||||||
CHILD_APPS |
Specifies the child program to use for Download Play distribution. You must specify the directory path for this variable in Windows format, using the absolute or relative path. You must set this variable before referencing modulerules. Example (specifying a fast child in a Release build):
Default: None |
||||||||
MANUAL_DIR |
Use this variable to add an e-manual to the application. Whether it is necessary to add an e-manual to the application depends on the application. For MANUAL_DIR, specify the directory where the e-manual resides. Place one file in this directory and name the file Manual.bcma. You must specify the directory path for this variable in Windows format, using the absolute or relative path. You must set this variable before referencing modulerules. Input example (from SampleDemos/demo1/OMakefile):)
Default: None |
ctr_makerom, even though they are build variables that configure build conditions separately for each directory in the CTR-SDK's OMakefile. | Build Variable | Description |
|---|---|
ROM_SPEC_FILE |
Specifies an RSF file describing the contents of a ROM file (RomSpecFile). The specified file is passed to ctr_makerom using the -rsf option. The file's settings serve as the basis to the creation of CCI files. You must configure this variable between the include statements for commondefs and modulerules.Default: $CTR-SDK/resources/specfiles/Application.rsf.
|
DESCRIPTOR |
Specifies the DESC file. The specified file is passed to ctr_makerom with the -desc option, and the CCI files are created based on the settings in this file. Default: $CTR-SDK/resources/specfiles/Application.desc.
|
MAKEROMFLAGS |
Set this variable when you want to specify the options passed to ctr_makerom. You must configure this variable between the include statements for commondefs and modulerules.Default: None |
ROMFS_ROOT |
Specifies the root path of the file system to include in the ROM. Although setting this variable has the same effect as setting the HostRoot in the Rom section of the RSF file (except for the following point), if both are set HostRoot has precedence.
ROMFS_DEPENDENCIES. This variable is also passed to ctr_makerom using -DROMFS_ROOT=. You can reference this value in RSF with the string "$(ROMFS_ROOT)". You must set this variable before referencing modulerules. Default: None |
ROMFS_DEPENDENCIES |
Sets dependency relationships for files under the specified ROM file system. Files under the directory specified in ROMFS_ROOT are configured in ROMFS_DEPENDENCIES in the build system. Note that when setting dependency relationships for files specified in the RSF file, they must be set explicitly with this variable. You must set this variable before referencing modulerules. Default: None |
TITLE |
Specifies the value passed to ctr_makerom in -DTITLE=. The value can be referenced in the RSF file by using $(TITLE). Default: CtrApp. |
CTR_BANNER |
Specifies the banner file. The specified value is passed to ctr_makerom by using the -banner option. You must specify CTR_NO_BANNER = true or CTR_NO_BANNER_ICON = true when not using banners. The default value is used if this specification is omitted. If CTR_BANNER_SPEC is set, these options are ignored. Default: $CTR_SDK/resources/banner/Default.bnr.
|
CTR_ICON |
Specifies the icon file. You can pass the specified value to ctr_makerom by using the -icon option. You must specify CTR_NO_BANNER_ICON = true if you are not using icons. The default value is used if this specification is omitted. If CTR_BANNER_SPEC has been set, this setting is ignored.Default: $CTR_SDK/resources/banner/Default.icn.
|
CTR_NO_BANNER |
This variable must be set to true if not using banners. If CTR_BANNER_SPEC has been set, this setting is ignored.Default: None |
CTR_NO_BANNER_ICON |
This variable must be set to true if you are not using banners or icons. If CTR_BANNER_SPEC has been set, this setting is ignored.Default: None |
CTR_BANNER_SPEC |
Specifies the BSF file to use as input to ctr_makebanner (BSF: BannerSpecFile). The files generated by ctr_makebanner are input into ctr_makerom unchanged using the -banner and -icon options. If these options are set, the CTR_BANNER, CTR_ICON, CTR_NO_BANNER, and CTR_NO_BANNER_ICON settings are ignored. Default: None |
OMakefile. | Build Variable | Description |
|---|---|
SHADER_SOURCES |
Enumerates the vertex shader assembler files (.vsh) to compile or assemble. Default: 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/shaders directory, so any additional settings must be specified using the += operator.You must configure this variable between the include statements for commondefs and modulerules.Default: $CTR_SDK/resources/shaders.
|
SHADER_OBJECTS |
Enumerates the object files to add during the shader binary build. Default: None |
SHADER_OBJECTS_PREBUILT |
Enumerates the object files to add during the shader binary build. This variable is used only for reserved geometry shaders. Specify the object files using paths relative to $CTR_SDK/resources/shader.Default: None |
TARGET_SHADER |
Specifies the names of the shader binary (SHBIN) files that are ultimately output. The extension is not needed. If you explicitly specify an empty name, the build system only assembles without linking. Default: shader. |
SHBIN_INSTALL_ROOT |
Specifies the installation root directory for the shader binary file. Default: Value of ROMFS_ROOT.
|
SHADER_BINARY |
Sets the full path of the shader binary file. To use, set this path after including modulerules.Default: Full path to the SHBIN file. |
SHADER_ASFLAGS |
Set this variable to change the options assigned to the assembler when assembling vertex shader assembly language files (VSH files). If you specify the -I or -O options, use the respective build options. Although currently nothing is set by default, use the += operator to specify additional options.You must configure this variable between the include statements for commondefs and modulerules.Default: None |
SHADER_LDFLAGS |
Set this variable when you want to change the options passed to the vertex shader linker. If you specify the -I or -O options, use the respective build options. Options are set in this variable by default. Use the += operator to specify additional options. You must configure this variable between the include statements for commondefs and modulerules.Default: -M. |
| Macros | Description |
|---|---|
NN_BUILD_DEVELOPMENT |
This macro is defined when building the image specified by TARGET_PROGRAM using the Development build type. Note that this macro is not defined when building an image specified by TARGET_LIBRARY. |
NN_BUILD_RELEASE |
This macro is defined when building the image specified by TARGET_PROGRAM using the Release build type. Note that this macro is not defined when building an image specified by TARGET_LIBRARY. |
NN_BUILD_VERBOSE |
This macro is defined when making builds using the Debug or Development build type. |
NN_EFFORT_FAST |
This macro is defined when making builds using the "fast" optimization type. |
NN_EFFORT_SMALL |
This macro is defined when making builds using the "small" optimization type. |
NN_SWITCH_DISABLE_DEBUG_PRINT |
This macro is defined when making builds using the Release build type if false has been specified for DEBUG_PRINT, or if DEBUG_PRINT has not been specified.
|
NN_SWITCH_DISABLE_ASSERT_WARNING |
This macro is defined when making builds using the Release build type if false has been specified for ASSERT_WARNING, or if ASSERT_WARNING has not been specified.
|
OMakefileOMake have an OMakefile in each directory and OMakeroot in the project's root directory. General build settings are specified in OMakeroot, and build parameters specific to each subdirectory are specified in each OMakefile. OMakefile in each directory and an OMakeroot directly under SampleDemos. The OMakefile files include modulerules (build rules), while OMakeroot includes commondefs (general build options). SampleDemos. SUPPORTED_TARGETS, SOURCES, TARGET_PROGRAM
SUPPORTED_TARGETS = CTR-TS.Process.MPCore.* # Target both fast and small builds. SOURCES[] = main.cpp # Build the source file "main.cpp." TARGET_PROGRAM = test # The name of the image to generate is "test." #---- In general, do not change the following line unless you want to define your own build rules. include $(ROOT_OMAKE)/modulerules # Include modulerules. build: $(DEFAULT_TARGETS) # Configure the rule to run when building.
OMakefile. It is based on a specific real-world scenario. include statement for modulerules in Required Settings for Creating Applications. TITLE, ROMFS_ROOT, CTR_BANNER, CTR_ICON, ROM_SPEC_FILE, DESCRIPTOR
#---- TITLE and ROMFS_ROOT can also be specified in the RSF file. TITLE = CtrApp # Specify the title of the application. ROMFS_ROOT = ./romfs # Specify the ROMFS root path. #---- CTR_BANNER and CTR_ICON can also be specified in the BSF file using CTR_BANNER_SPEC. CTR_BANNER = $(CTRSDK_ROOT)/resources/banner/Default.bnr # Specify the banner file. CTR_ICON = $(CTRSDK_ROOT)/resources/banner/Default.icn # Specify the icon file. ROM_SPEC_FILE = $(CTRSDK_ROOT)/resources/specfiles/Application.rsf # Specify the RSF file. DESCRIPTOR = $(CTRSDK_ROOT)/resources/specfiles/Application.desc # Specify the DESC file.
CHILD_APPS, CTR_APPTYPE, ROM_SPEC_FILE, DESCRIPTOR, CTR_ICONCHILD_APPS[] = ../Child/images/CTR-TS.Process.MPCore.fast/Release/Child.cia # Specify child programs.Child
CTR_APPTYPE = NAND CTR_ICON = Child.icn # Specify the child icon. ROM_SPEC_FILE = Child.rsf # Specify UniqueId and ChildIndex in the child RSF file. DESCRIPTOR = $(CTRSDK_ROOT)/resources/specfiles/DlpChild.desc # Specify the DESC file for the children.
CTR_APPTYPE, MANUAL_DIR
CTR_APPTYPE = SD MANUAL_DIR = ./manual # Specify the directory where the e-manual is stored.
TARGET_BUILDTYPESRelease build only in the "test" directory.
if $(equal $(filter Release,$(TARGET_BUILDTYPES)),Release)
.SUBDIRS: $(exist-dirs test)
CTR-06-0205-002-J
CONFIDENTIAL