1#!/usr/bin/env omake
2#----------------------------------------------------------------------------
3# Project: Horizon
4# File:    commondefs.cctype.GCC-i386.om
5#
6# Copyright 2007-2009 Nintendo.  All rights reserved.
7#
8# These coded instructions, statements, and computer programs contain
9# proprietary information of Nintendo of America Inc. and/or Nintendo
10# Company Ltd., and are protected by Federal copyright law.  They may
11# not be disclosed to third parties or copied or duplicated in any form,
12# in whole or in part, without the prior written consent of Nintendo.
13#
14# $Date:: 2010-11-23#$
15# $Rev: 31762 $
16# $Author: okubata_ryoma $
17#----------------------------------------------------------------------------
18
19Compiler. =
20    class Compiler
21
22    new() =
23        return $(this)
24
25    getCCFlagsDebug(config) =
26        eff =
27            switch($(config.effort))
28            case fast
29                value -Otime
30            case small
31                value -Ospace
32        eff +=
33            switch($(config.buildtype))
34            case $"Debug"
35                value -O0 --retain=calls
36            case $"Development"
37                if $(BUILD_APPLICATION)
38                    value $(CCFLAGS_DEV_OPT)
39                else
40                    value -O3
41            case $"Release"
42                value -O3
43        return $(eff)
44
45    getLDFlagsDebug(config) =
46        return $(EMPTY)
47
48    toSymbol(str) =
49        stdout = $(open-out-string)
50        fsubst($(open-in-string $(str)))
51        case $'[-\.]' g
52            value $'_'
53        result = $(out-contents $(stdout))
54        close($(stdout))
55        return $(uppercase $(result))
56
57    getCCFlags(config) =
58        return $(getCCFlagsDebug $(config)) $(getCCFlagsLtcg $(config)) $(getCCFlagsCPU $(config))
59
60    getLDFlags(config) =
61        return $(getLDFlagsDebug $(config)) $(getLDFlagsLtcg $(config))
62
63    getASFlags(config) =
64        return $(getASFlagsCPU $(config))
65
66    getMacroFlags(config) =
67        export flags
68        flags  =
69            switch($(config.effort))
70            case fast
71                value -DNN_EFFORT_FAST
72            case small
73                value -DNN_EFFORT_SMALL
74
75        flags += -DNN_PLATFORM_$(toSymbol $(config.platform))
76        flags += -DNN_HARDWARE_$(toSymbol $(config.hardware))
77        flags += -DNN_SYSTEM_$(toSymbol $(config.systemname))
78
79        #                     noopt   verbose release Debug   Dev.    Release
80        # DISABLE_DEBUG       �~      �~      ��      �~      �~      ��
81        # DISABLE_DEBUG_SDK   �~      �~      ��      �~      �~      ��
82        # DISABLE_ASSERT      �~      �~      ��      �~      �~      ��
83        # DISABLE_ASSERT_SDK  �~      �~      ��      �~      �~      ��
84        # ENABLE_HOST         ��      ��      �~      ��      ��      �~
85        #
86        # BUILD_NOOPT         ��      �~      �~      ��      �~      �~
87        # BUILD_VERBOSE       ��      ��      �~      ��      ��      �~
88        # BUILD_DEBUG         �~      �~      �~      ��      �~      �~
89        # BUILD_DEVELOPMENT   �~      �~      �~      �~      ��      �~
90        # BUILD_RELEASE       �~      �~      �~      �~      �~      ��
91        #
92
93        if $(equal $(config.buildtype),Release)
94            DEBUG_PRINT_DEFAULT        = false
95            DEBUG_PRINT_SDK_DEFAULT    = false
96            ASSERT_WARNING_DEFAULT     = false
97            ASSERT_WARNING_SDK_DEFAULT = false
98            export
99        else
100            DEBUG_PRINT_DEFAULT        = true
101            DEBUG_PRINT_SDK_DEFAULT    = true
102            ASSERT_WARNING_DEFAULT     = true
103            ASSERT_WARNING_SDK_DEFAULT = true
104            export
105
106        if $(not $(DEBUG_PRINT))
107            flags += -DNN_SWITCH_DISABLE_DEBUG_PRINT=1
108        if $(not $(DEBUG_PRINT_SDK))
109            flags += -DNN_SWITCH_DISABLE_DEBUG_PRINT_FOR_SDK=1
110        if $(not $(ASSERT_WARNING))
111            flags += -DNN_SWITCH_DISABLE_ASSERT_WARNING=1
112        if $(not $(ASSERT_WARNING_SDK))
113            flags += -DNN_SWITCH_DISABLE_ASSERT_WARNING_FOR_SDK=1
114        if $(config.isHostIoEnable)
115            flags += -DNN_SWITCH_ENABLE_HOST_IO=1
116
117        if $(or $(BUILD_APPLICATION), $(BUILD_KERNEL))
118            flags += -DNN_BUILD_$(toSymbol $(config.buildtype))
119
120        if $(and $(defined CTR_BUILD_1ST_STAGE_UPDATER), $(CTR_BUILD_1ST_STAGE_UPDATER))
121            flags += -DCTR_BUILD_1ST_STAGE_UPDATER
122
123        flags +=
124            switch($(config.buildtype))
125            case Debug          # noopt
126                value -DNN_BUILD_VERBOSE -DNN_BUILD_NOOPT
127            case Development    # verbose
128                value -DNN_BUILD_VERBOSE
129            case Release        # release
130                value $(EMPTY)
131
132        return $(flags)
133
134
135
136include $(ROOT_OMAKE)/commondefs.cctype.RVCT
137include $(ROOT_OMAKE)/commondefs.cctype.GCC
138
139# ������ include ���Ă����Ȃ��ƂȂ��� .STATIC �� Fatal Error
140include $(ROOT_OMAKE)/tooldefs
141
142public.CC               = $`(COMPILER.CC)
143public.CXX              = $`(COMPILER.CXX)
144public.CPP              = $`(COMPILER.CPP)
145public.AR               = $`(COMPILER.AR)
146public.LD               = $`(COMPILER.LD)
147public.AS               = $`(COMPILER.AS)
148
149public.STRIP            = $`(COMPILER.STRIP)
150public.DISAS            = $`(COMPILER.DISAS)
151
152public.CCFLAGS_MACRO    = $`(COMPILER.CCFLAGS_MACRO)
153public.CCFLAGS_WARNING  = $`(COMPILER.CCFLAGS_WARNING)
154public.CCFLAGS_DEV_OPT  = $`(COMPILER.CCFLAGS_DEV_OPT)
155
156public.CCFLAGS          = $`(COMPILER.CCFLAGS) $`(CCFLAGS_MACRO)
157public.CCFLAGS_BUILD    =
158
159public.CFLAGS           = $`(COMPILER.CFLAGS) $`(CCFLAGS)
160public.CXXFLAGS         = $`(COMPILER.CXXFLAGS) $`(CCFLAGS)
161public.CSCANFLAGS       = $`(COMPILER.CSCANFLAGS)
162
163public.LDFLAGS_WARNING  = $`(COMPILER.LDFLAGS_WARNING)
164public.LDFLAGS_INFO     = $`(COMPILER.LDFLAGS_INFO)
165public.ARFLAGS          = $`(COMPILER.ARFLAGS)
166public.RANLIB           = $`(COMPILER.RANLIB)
167public.INCLUDES_OPT     = $`(COMPILER.INCLUDES_OPT)
168public.YACC             = $`(COMPILER.YACC)
169public.LEX              = $`(COMPILER.LEX)
170public.LDFLAGS          = $`(COMPILER.LDFLAGS)
171public.LDRESP           = $`(COMPILER.LDRESP)
172
173public.CCOUT            = $`(COMPILER.CCOUT)
174public.LDOUT            = $`(COMPILER.LDOUT)
175public.ASOUT            = $`(COMPILER.ASOUT)
176public.ASFLAGS          = $`(COMPILER.ASFLAGS)
177
178
179public.ENTRYPOINT       = __ctr_start
180public.INCLUDES[]       = $(ROOT_INCLUDE) $(HORIZON_ROOT_INCLUDE)
181public.LIBS             = $`(DEFAULT_LIBS)
182public.LIBFILES         =
183public.MINIMUM_LIBS     =
184public.DEFAULT_LIBS     =
185public.LLIBS            =
186
187public.USE_GNU_EXTENTIONS = true
188#
189# Add the -I option to the includes lazily.
190# Don't redefine this variable unless you know what you are doing.
191#
192public.PREFIXED_INCLUDES = $`(addprefix $(INCLUDES_OPT), $(set $(absname $(INCLUDES))))
193