1#! make -f
2#----------------------------------------------------------------------------
3# Project:  RVLDWC - Library - build - buildtools
4# File:     commondefs.cctype.CW3
5#
6#  Copyright 2005 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# $Revision: 1.10 $
15#----------------------------------------------------------------------------
16
17EMPTY	 		?=
18SPACE 			?= $(EMPTY) $(EMPTY)
19
20
21# -----------------------------------------------------------------------------
22#
23#	CodeWarrior directory setting.
24#
25
26CWFOLDER		?= C:\CW_RVL
27CWFOLDER_RVL	?= $(CWFOLDER)
28
29CW_ROOT			:= $(subst $(SPACE),\ ,$(subst \,/,$(CWFOLDER_RVL)))
30LM_LICENSE_FILE	:= $(subst /,\,$(CWFOLDER_RVL))\license.dat
31
32CW_BINDIR		:= $(CW_ROOT)/PowerPC_EABI_TOOLS/Command_Line_Tools
33CW_PPCDIR		:= $(CW_ROOT)/PowerPC_EABI_Support
34
35
36# -----------------------------------------------------------------------------
37#
38#	CodeWarrior command line tool.
39#
40
41CC				:= $(CW_BINDIR)/mwcceppc.exe
42AS				:= $(CW_BINDIR)/mwasmeppc.exe
43LD				:= $(CW_BINDIR)/mwldeppc.exe
44AR				:= $(CW_BINDIR)/mwldeppc.exe
45
46
47# -----------------------------------------------------------------------------
48#
49#	CodeWarrior include file and library settings.
50#
51
52CW_INCDIRS	= $(CW_PPCDIR)/MSL/MSL_C/PPC_EABI/Include					\
53			  $(CW_PPCDIR)/MSL/MSL_C/MSL_Common/Include					\
54			  $(CW_PPCDIR)/MSL/MSL_C/MSL_Common_Embedded/Math/Include	\
55			  $(CW_PPCDIR)/MSL/MSL_C++/MSL_Common/Include				\
56			  $(CW_PPCDIR)/MSL/MSL_C++/PPC_EABI/Include					\
57			  $(CW_PPCDIR)/Runtime/Inc
58
59CW_LIBDIRS	= $(CW_PPCDIR)/Runtime/Lib					\
60			  $(CW_PPCDIR)/MSL/MSL_C/PPC_EABI/Lib		\
61			  $(CW_PPCDIR)/MSL/MSL_C++/PPC_EABI/Lib
62
63CW_LIBS		= Runtime.PPCEABI.H.a		\
64			  MSL_C.PPCEABI.bare.H.a	\
65			  MSL_C++.PPCEABI.bare.H.a
66
67ifdef TRK_INTEGRATION
68CW_LIBDIRS += $(CW_PPCDIR)/MetroTRK
69
70ifdef HOLLYWOOD_REV
71CW_LIBS	   += TRK_Hollywood_Revolution.a
72else
73CW_LIBS	   += TRK_MINNOW_DOLPHIN.a
74endif
75
76endif
77
78
79# -----------------------------------------------------------------------------
80#
81#  CodeWarrior standard include file and library environment variable settings.
82#
83
84export	MWCIncludes    := $(subst \;, ,$(subst $(SPACE),;,$(CW_INCDIRS)))
85export	MWLibraries    := $(subst \;, ,$(subst $(SPACE),;,$(CW_LIBDIRS)))
86export	MWLibraryFiles := $(subst \;, ,$(subst $(SPACE),;,$(CW_LIBS)))
87
88
89###############################################################################
90#
91#    COMMON COMPILER FLAGS
92#
93###############################################################################
94
95
96# -----------------------------------------------------------------------------
97# for CodeWarrior
98#
99# -nodefaults       - required so the compiler does not search all the
100#                      Codewarrior paths
101# -proc 750         - which CPU
102# -align powerpc    - 4 byte alignment by default
103# -xm l             - create a library
104
105CCFLAGS			= -lang c -proc $(PROCESSOR) -align powerpc -enum int -DRVL -D_REVOLUTION
106CXXFLAGS		= -lang c++ -proc $(PROCESSOR) -align powerpc -enum int -DRVL -D_REVOLUTION
107ASFLAGS			= -proc $(PROCESSOR)
108ARFLAGS			= -xm l
109LDFLAGS			= -listclosure
110PLF_LDFLAGS		= -nodefaults -nostdlib
111
112
113# -----------------------------------------------------------------------------
114#	Encoding settings.
115#
116
117ifeq	($(RVLDWC_LANG),jp)
118CCFLAGS  += -encoding SJIS
119CXXFLAGS += -encoding SJIS
120else
121CCFLAGS  += -encoding ascii
122CXXFLAGS += -encoding ascii
123endif # RVLDWC_LANG
124
125
126###############################################################################
127#
128#    EPPC-SPECIFIC Build Flags and Variables
129#
130###############################################################################
131
132
133# -----------------------------------------------------------------------------
134# for CodeWarrior
135#
136# -fp hardware      - allow use of hardware FP instructions
137# -Cpp_exceptions   - turns off C++ exceptions.
138
139CCFLAGS			+= -char signed -fp hardware -Cpp_exceptions off
140CXXFLAGS		+= -char signed -fp hardware -Cpp_exceptions off
141
142
143# -----------------------------------------------------------------------------
144# for CATS
145#
146
147ifndef CATS_ON
148CCFLAGS			+= -pragma "cats off"
149CXXFLAGS		+= -pragma "cats off"
150endif # CATS_ON
151
152
153# -----------------------------------------------------------------------------
154# -map              - create a .MAP file that shows final memory layout of
155#                     all sections
156# -unused           - show unused symbols
157# -fp hardware      - linker must use same fp settings as compiler
158# Note that LDFLAGS automagically includes the required Metrowerks library
159#
160
161LDFLAGS			+= -fp hardware
162PLF_LDFLAGS		+= -fp hardware
163
164
165#----------------------------------------------------------------------------
166#  Relocatable module
167#
168
169ifdef TARGET_RSO
170CCFLAGS		+= -sdata 0 -sdata2 0
171CXXFLAGS	+= -sdata 0 -sdata2 0
172ASFLAGS		+= -sdata 0 -sdata2 0
173endif
174
175
176# -----------------------------------------------------------------------------
177# flag to generate object data...unfortunately it differs between
178# MACOS and EPPC
179COMPILE      = -c
180
181CCFLAGS      += $(SDK_MACROFLAGS) $(RVLDWC_MACROFLAGS)
182CXXFLAGS     += $(SDK_MACROFLAGS) $(RVLDWC_MACROFLAGS)
183ASFLAGS      += $(SDK_MACROFLAGS) $(RVLDWC_MACROFLAGS)
184
185
186###############################################################################
187#
188#    Dolphin SDK build configuration settings
189#    This section can be skipped by defining DOLPHIN_MINFLAGS for building
190#    application program.
191#
192###############################################################################
193
194#### ifndef DOLPHIN_MINFLAGS
195
196# -----------------------------------------------------------------------------
197# for CodeWarror
198#
199
200CCFLAGS			+= -W all -W nofilecaps -W nosysfilecaps
201CXXFLAGS		+= -W all -W nofilecaps -W nosysfilecaps
202
203LDFLAGS			+= -unused -map ${@:.elf=.map}
204PLF_LDFLAGS		+= -unused -map ${@:.plf=.map} -m _prolog -r1 -strip_partial
205
206
207ifeq ($(RVLDWC_BUILDNAME),DEBUG)
208
209# -----------------------------------------------------------------------------
210# debug related flags
211#
212# -opt off          - The debugger is very unhappy with any optimizations at all.
213# -inline off       - disable all inlining
214#
215
216CCFLAGS			+= -opt off -inline off
217CXXFLAGS		+= -opt off -inline off
218
219
220# -----------------------------------------------------------------------------
221# make DEBUG=TRUE NDEBUGINFO=TRUE
222#  for DEBUG lib without debug information
223#
224# -g                - generate full debug symbolics
225#
226
227ifndef	RVLDWC_NODEBUGINFO
228LDFLAGS			+= -g
229CCFLAGS			+= -g
230CXXFLAGS		+= -g
231ASFLAGS			+= -g
232PLF_LDFLAGS		+= -g
233endif # RVLDWC_NODEBUGINFO
234
235
236else  # $(RVLDWC_BUILDNAME is RELEASE or FINAL
237
238# -----------------------------------------------------------------------------
239# -O4,p             - full optimizations, optimize for speed (not code size)
240# -inline auto      - inline small functions where possible,
241#                     even without inline directive
242# -unused           - show unused symbols
243
244CCFLAGS  += -ipa file  -O4,p -inline auto -pragma "warn_notinlined off"
245CXXFLAGS += -ipa file  -O4,p -inline auto -pragma "warn_notinlined off"
246
247
248# -----------------------------------------------------------------------------
249# make NDEBUG=TRUE DEBUGINFO=TRUE
250#  for NDEBUG lib with debug information
251#
252
253ifdef	RVLDWC_DEBUGINFO
254LDFLAGS 		+= -g
255CCFLAGS 		+= -g
256CXXFLAGS 		+= -g
257ASFLAGS			+= -g
258PLF_LDFLAGS		+= -g
259endif # RVLDWC_DEBUGINFO
260
261endif # ifeq ($(RVLDWC_BUILDNAME),DEBUG)
262
263#### endif  #DOLPHIN_MINFLAGS
264
265#----- End of commondefs.cctype.CW3 -----
266