omake Toolomake Commandomake Optionsomake Targetsomake VariablesOMakefileOMakefile
omake ToolOMake. OMake is the CTR-SDK's command-line build environment. 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. Upon launch, the omake command loads a file containing build rules (OMakefile in the current directory) and then calls the compiler and linker in accordance with 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 behavior 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. See OMakefile for instructions on coding an OMakefile.
omake Optionsomake.| Options | Description |
|---|---|
| --version | Check the version |
| -j <PARALLEL_COUNT> | Perform the specified number of parallel builds |
| --verbose | Building While Displaying the Command Being Run |
| --depend | Ignore dependencies in build |
| -U | Ignore dependencies and cache in build. (This is handy when you have deleted a header file, because it discards all cached dependencies when building.) |
omake Targets% omake
% omake build
Starts building and creates final target.
OMakerootomake build command in directories where there are dependenciesbuild is the default target name when the target value for omake is omitted. You can thus perform the action of omake build simply by entering omake.
OMake starts by checking all dependencies under OMakeroot. Thus 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]. See Build Switches below, for information about how to change the target's build type and other attributes.
% omake clean
Deletes files generated by omake build.
OMakerootomake clean command in directories where there are dependenciesimages and objectsomake Variablesomake variables. | Environment Variables | 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 specifiable hardware is TS, and the specifiable optimization types 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. Default: For release builds: false; Otherwise: true.
|
||||||||||||||||||||||||||||||||
FILTER |
Sets the target hardware and optimization type. The only specifiable hardware is TS, and the specifiable optimization types 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)
|
||||||||||||||||||||||||||||||||
OMakefileOMakefile.modulerules. | Build Variable | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|
SUPPORTED_TARGETS[Required] |
Sets the targets supported by the program. The only specifiable hardware is TS, and the specifiable optimization types 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 be compiled or assembled. The build system attempts to generate object files using the compiler or assembler that is appropriate for a given file extension, such as .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 file name 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. 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 you want 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 you want 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 file name 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 and TARGET_LIBRARY.Default: None. |
||||||||
TARGET_LIBRARY* CAUTION |
Specifies the names of the library to build. The file name 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 and 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. The warning options should always be set 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 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. |
||||||||
HOST_IO |
If set to true, HostIO is enabled regardless of build type.Default: For release builds: false; Otherwise: true.
|
||||||||
TARGET_BUILDTYPES |
Specifies the build type specified on the command line. Use this variable if you want 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 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_makeromctr_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 file specified here is passed to ctr_makerom using the -rsf option, and the CCI files are created based on the settings in this file.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 file specified here 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 one point below), if both are set then HostRoot has precedence.
ctr_makerom using -DROMFS_ROOT=, so 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. However, when setting dependency relationships for files specified in the RSF file, note that 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 value specified here 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, otherwise 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. The value specified here can be passed to ctr_makerom by using the -icon option.You must specify CTR_NO_BANNER_ICON = true if not using icons, otherwise 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.icn
|
CTR_NO_BANNER |
This variable must be set to true if not using banners.If CTR_BANNER_SPEC is set, these options are ignored.Default: None. |
CTR_NO_BANNER_ICON |
This variable must be set to true if not using banners or icons.If CTR_BANNER_SPEC is set, these options are 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 are set, the CTR_BANNER, CTR_ICON, CTR_NO_BANNER, and CTR_NO_BANNER_ICON settings are ignored.Default: None. |
| Build Variable | Description |
|---|---|
SHADER_SOURCES |
Enumerates the vertex shader assembler files (.vsh) to be compiled or assembled.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 be added during the shader binary build. Default: 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.Default: None. |
TARGET_SHADER |
Specifies the names of the shader binary (SHBIN) files that are ultimately output. The file name extension is not needed. If you explicitly specify an empty name, the build system assembles without linking. Default: shader |
SHBIN_INSTALL_ROOT |
Specifies the installation root for the shader binary file. Default: Value of ROMFS_ROOT
|
SHADER_BINARY |
Sets the full path of the shader binary file. To use, do this after including modulerules.Default: Full path to 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, however, 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, however, 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 a "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 a "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 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 ASSERT_WARNING has not been specified.
|
OMakefileOMakeroot 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 source file "main.cpp" TARGET_PROGRAM = test # The name of the image to generate is "test" #---- In general, you should 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 concrete 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 application's title 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 banner file CTR_ICON = $(CTRSDK_ROOT)/resources/banner/Default.icn # Specify icon file ROM_SPEC_FILE = $(CTRSDK_ROOT)/resources/specfiles/Application.rsf # Specify RSF file DESCRIPTOR = $(CTRSDK_ROOT)/resources/specfiles/Application.desc # Specify 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 programsChild
CTR_APPTYPE = NAND CTR_ICON = Child.icn # Specify child icon ROM_SPEC_FILE = Child.rsf # Specify UniqueId and ChildIndex in child RSF file DESCRIPTOR = $(CTRSDK_ROOT)/resources/specfiles/DlpChild.desc # Specify DESC file for children
CTR_APPTYPE, MANUAL_DIR
CTR_APPTYPE = SD MANUAL_DIR = ./manual # Specify directory where 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-I
CONFIDENTIAL