#---------------------------------------------------------------------------- # Project: Horizon # File: commondefs.cctype.om # # Copyright (C)2009-2011 Nintendo Co., Ltd. All rights reserved. # # These coded instructions, statements, and computer programs contain # proprietary information of Nintendo of America Inc. and/or Nintendo # Company Ltd., and are protected by Federal copyright law. They may # not be disclosed to third parties or copied or duplicated in any form, # in whole or in part, without the prior written consent of Nintendo. # # $Rev: 46159 $ #---------------------------------------------------------------------------- #---------------------------------------------------------------------------- # Class definitions #---------------------------------------------------------------------------- Compiler. = class Compiler #---------------------------------------------------------------------------- # Function definitions #---------------------------------------------------------------------------- #------------------------------------------------------- # New. # # Overview # | # # Referenced global variables # None. #------------------------------------------------------- new() = return $(this) #------------------------------------------------------- # getCCFlagsDebug # # Overview # | # # Referenced global variables # BUILD_APPLICATION, CCFLAGS_DEV_OPT #------------------------------------------------------- getCCFlagsDebug(config) = private.eff = switch($(config.effort)) case fast value -Otime case small value -Ospace eff += switch($(config.buildtype)) case $"Debug" value -O0 --retain=calls case $"Development" if $(BUILD_APPLICATION) value $(CCFLAGS_DEV_OPT) else value -O3 case $"Release" value -O3 return $(eff) #------------------------------------------------------- # getLDFlagsDebug # # Overview # | # # Referenced global variables # None. #------------------------------------------------------- getLDFlagsDebug(config) = return $(EMPTY) #------------------------------------------------------- # toSymbol # # Overview # | # # Referenced global variables # stdout #------------------------------------------------------- toSymbol(str) = stdout = $(open-out-string) fsubst($(open-in-string $(str))) case $'[-\.]' g value $'_' private.result = $(out-contents $(stdout)) close($(stdout)) return $(uppercase $(result)) #------------------------------------------------------- # getCCFlags # # Overview # | # # Referenced global variables # None. #------------------------------------------------------- getCCFlags(config) = return $(getCCFlagsDebug $(config)) $(getCCFlagsLtcg $(config)) $(getCCFlagsCPU $(config)) $(getCCFlagsLazy) #------------------------------------------------------- # getLDFlags # # Overview # | # # Referenced global variables # None. #------------------------------------------------------- getLDFlags(config) = return $(getLDFlagsDebug $(config)) $(getLDFlagsLtcg $(config)) $(getLDFlagsCPU $(config)) $(getLDFlagsLazy) #------------------------------------------------------- # getASFlags # # Overview # | # # Referenced global variables # None. #------------------------------------------------------- getASFlags(config) = return $(getASFlagsCPU $(config)) #------------------------------------------------------- # getMacroFlags # # Overview # | # # Referenced global variables # DEBUG_PRINT_DEFAULT, DEBUG_PRINT_SDK_DEFAULT, # ASSERT_WARNING_DEFAULT, ASSERT_WARNING_SDK_DEFAULT # DEBUG_PRINT, DEBUG_PRINT_SDK, ASSERT_WARNING, # ASSERT_WARNING_SDK, BUILD_APPLICATION, # BUILD_KERNEL, CTR_BUILD_1ST_STAGE_UPDATER, #------------------------------------------------------- getMacroFlags(config) = private.flags = $(EMPTY) section export flags flags = switch($(config.effort)) case fast value -DNN_EFFORT_FAST case small value -DNN_EFFORT_SMALL flags += -DNN_PLATFORM_$(toSymbol $(config.platform)) flags += -DNN_HARDWARE_$(toSymbol $(config.hardware)) flags += -DNN_SYSTEM_$(toSymbol $(config.systemname)) # noopt verbose release Debug Dev. Release # DISABLE_DEBUG ~ ~ ~ ~ # DISABLE_DEBUG_SDK ~ ~ ~ ~ # DISABLE_ASSERT ~ ~ ~ ~ # DISABLE_ASSERT_SDK ~ ~ ~ ~ # ENABLE_HOST ~ ~ # # BUILD_NOOPT ~ ~ ~ ~ # BUILD_VERBOSE ~ ~ # BUILD_DEBUG ~ ~ ~ ~ ~ # BUILD_DEVELOPMENT ~ ~ ~ ~ ~ # BUILD_RELEASE ~ ~ ~ ~ ~ # if $(equal $(config.buildtype),Release) DEBUG_PRINT_DEFAULT = false DEBUG_PRINT_SDK_DEFAULT = false ASSERT_WARNING_DEFAULT = false ASSERT_WARNING_SDK_DEFAULT = false export else DEBUG_PRINT_DEFAULT = true DEBUG_PRINT_SDK_DEFAULT = true ASSERT_WARNING_DEFAULT = true ASSERT_WARNING_SDK_DEFAULT = true export if $(not $(DEBUG_PRINT)) flags += -DNN_SWITCH_DISABLE_DEBUG_PRINT=1 if $(not $(DEBUG_PRINT_SDK)) flags += -DNN_SWITCH_DISABLE_DEBUG_PRINT_FOR_SDK=1 if $(not $(ASSERT_WARNING)) flags += -DNN_SWITCH_DISABLE_ASSERT_WARNING=1 if $(not $(ASSERT_WARNING_SDK)) flags += -DNN_SWITCH_DISABLE_ASSERT_WARNING_FOR_SDK=1 if $(config.isHostIoEnable) flags += -DNN_SWITCH_ENABLE_HOST_IO=1 if $(or $(BUILD_APPLICATION), $(BUILD_KERNEL)) flags += -DNN_BUILD_$(toSymbol $(config.buildtype)) if $(and $(defined CTR_BUILD_1ST_STAGE_UPDATER), $(CTR_BUILD_1ST_STAGE_UPDATER)) flags += -DCTR_BUILD_1ST_STAGE_UPDATER flags += switch($(config.buildtype)) case Debug # noopt value -DNN_BUILD_VERBOSE -DNN_BUILD_NOOPT case Development # verbose value -DNN_BUILD_VERBOSE case Release # release value $(EMPTY) return $(flags) #---------------------------------------------------------------------------- # Load the target compiler settings #---------------------------------------------------------------------------- include $(ROOT_OMAKE)/compilers/commondefs.cctype.$(TARGET_PLATFORM.GetCompilerType) private.CompilerClass = $(getvar Compiler$(TARGET_PLATFORM.GetCompilerType)) global.COMPILER = $(CompilerClass.new) #---------------------------------------------------------------------------- # Constant definitions #---------------------------------------------------------------------------- global.CC = $`(COMPILER.CC) global.CXX = $`(COMPILER.CXX) global.CPP = $`(COMPILER.CPP) global.AR = $`(COMPILER.AR) global.LD = $`(COMPILER.LD) global.AS = $`(COMPILER.AS) global.STRIP = $`(COMPILER.STRIP) global.DISAS = $`(COMPILER.DISAS) global.CCFLAGS_MACRO = $`(COMPILER.CCFLAGS_MACRO) global.CCFLAGS_WARNING = $`(COMPILER.CCFLAGS_WARNING) global.CCFLAGS_DEV_OPT = $`(COMPILER.CCFLAGS_DEV_OPT) global.CCFLAGS = $`(COMPILER.CCFLAGS) $`(CCFLAGS_MACRO) global.CCFLAGS_BUILD = global.CFLAGS = $`(COMPILER.CFLAGS) $`(CCFLAGS) global.CXXFLAGS = $`(COMPILER.CXXFLAGS) $`(CCFLAGS) global.CSCANFLAGS = $`(COMPILER.CSCANFLAGS) global.LDFLAGS_WARNING = $`(COMPILER.LDFLAGS_WARNING) global.LDFLAGS_INFO = $`(COMPILER.LDFLAGS_INFO) global.ARFLAGS = $`(COMPILER.ARFLAGS) global.RANLIB = $`(COMPILER.RANLIB) global.INCLUDES_OPT = $`(COMPILER.INCLUDES_OPT) global.YACC = $`(COMPILER.YACC) global.LEX = $`(COMPILER.LEX) global.LDFLAGS = $`(COMPILER.LDFLAGS) global.LDRESP = $`(COMPILER.LDRESP) global.CCOUT = $`(COMPILER.CCOUT) global.LDOUT = $`(COMPILER.LDOUT) global.ASOUT = $`(COMPILER.ASOUT) global.ASFLAGS = $`(COMPILER.ASFLAGS) global.ENTRYPOINT = __ctr_start global.INCLUDES[] = $(ROOT_INCLUDE) $(HORIZON_ROOT_INCLUDE) global.LIBS = $`(DEFAULT_LIBS) global.LIBFILES = global.LIBRARY_LIBFILES = global.MINIMUM_LIBS = global.DEFAULT_LIBS = global.LLIBS = global.USE_GNU_EXTENTIONS = true global.PREFIXED_INCLUDES = $`(addprefix $(INCLUDES_OPT), $(set $(absname $(INCLUDES))))