1############################################################################### 2# Global common definitions for build system 3# 4# Copyright 2005-2009 Nintendo. All rights reserved. 5# 6# These coded instructions, statements, and computer programs contain 7# proprietary information of Nintendo of America Inc. and/or Nintendo 8# Company Ltd., and are protected by Federal copyright law. They may 9# not be disclosed to third parties or copied or duplicated in any form, 10# in whole or in part, without the prior written consent of Nintendo. 11############################################################################### 12 13# This file contains common definitions that exist across the build 14 15# 16# Check make version 17# 18MAKE_PLATFORM := $(shell uname | sed 's/_.*//') 19 20ifeq ($(MAKE_VERSION),3.79.1) 21 MAKE_ON_MSYS = TRUE 22else 23 ifeq ($(MAKE_VERSION),3.80) 24 MAKE_ON_CYGWIN = TRUE 25 else 26__version: 27 @echo ---- Sorry, this makefile is for \'make\' version 3.80 for Cygwin 28 @echo or version 3.79.1 for MSYS 29 @make -v 30 endif 31endif 32 33############################################################################### 34# 35# COMMON BUILD FLAGS AND CONSTANTS 36# 37############################################################################### 38 39# This is where all directories will live. 40# Note that if you change ROOT, you must change the BUILDTOOLS_ROOT 41# environment variable. 42empty := 43space := $(empty) $(empty) 44comma := , 45 46#============================================================================= 47# REVOLUTION_SDK_ROOT 48#============================================================================= 49ROOT := $(subst $(space),\$(space),$(subst \,/,$(REVOLUTION_SDK_ROOT))) 50 51# Default destination install directory, where installs will occur 52BASEINSTALL_ROOT = $(ROOT) 53 54# determine the architecture target 55# If PLATFORM is not set, it will default to RVL 56ifeq ($(origin PLATFORM), undefined) 57 PLATFORM := RVL 58endif 59 60ARCH_TARGET = $(PLATFORM) 61 62ifeq ($(PLATFORM), RVL) 63 RVL_OS = TRUE 64 HOLLYWOOD_REV = 1 65 BROADWAY_REV = 1 66 IOP_REV = 1 67 EPPC = TRUE 68 PROCESSOR = gekko 69 TRK_INTEGRATION = TRUE 70endif #RVL 71 72ifndef NDEBUG 73 DEBUG = TRUE 74 BUILD_TARGET = DEBUG 75else # NDEBUG 76 BUILD_TARGET = NDEBUG 77endif # NDEBUG 78 79INSTALL_ROOT = $(ROOT)/$(ARCH_TARGET) 80 81# Default binaries/tools directory 82BIN = $(INSTALL_ROOT)/bin 83 84# Default location of the sources and makefiles 85INC_ROOT = $(ROOT)/include 86BUILD_ROOT = $(ROOT)/build 87MAKE_ROOT = $(BUILD_ROOT)/buildtools 88LIB_ROOT = $(BUILD_ROOT)/libraries 89DEMO_ROOT = $(BUILD_ROOT)/demos 90DOL_INC_ROOT = $(INC_ROOT) 91TEST_ROOT = $(BUILD_ROOT)/tests 92SAMPLE_ROOT = $(BUILD_ROOT)/samplebuild 93TOOL_ROOT = $(BUILD_ROOT)/tools 94 95AUTOTEST_DVDROOT = $(ROOT)/autodata 96AUTOTEST_DVDROOT_TESTS = $(AUTOTEST_DVDROOT)/tests 97AUTOTEST_DVDROOT_IMPORT = $(AUTOTEST_DVDROOT)/import 98AUTOTEST_DVDROOT_DATA = $(AUTOTEST_DVDROOT)/datatitle 99AUTOTEST_DVDROOT_DATA_ARC = $(AUTOTEST_DVDROOT_DATA)/archives 100AUTOTEST_STUB_PATH = $(INSTALL_ROOT)/bin/tests/autotest 101AUTOTEST_STUB = autotest_stub 102AUTOTEST_MAKEPATH = $(TEST_ROOT)/autotest 103 104# Default location of the Metrowerks. CWFOLDER is set by the 105# Codewarrior installer. Change the backslashes into normal slashes, 106# and backslash any spaces in the path. 107ifdef CWFOLDER_RVL 108 MWDIR = $(subst $(space),\$(space),$(subst \,/,$(CWFOLDER_RVL))) 109else 110 MWDIR = $(subst $(space),\$(space),$(subst \,/,$(CWFOLDER))) 111endif 112 113NDEVDIR = $(subst $(space),\$(space),$(subst \,/,$(NDEV_TOOLS))) 114 115############################################################################### 116# 117# COMMON COMPILER FLAGS 118# 119############################################################################### 120 121# 122# for CodeWarrior 123# 124# -nodefaults - required so the compiler does not search all the 125# Codewarrior paths 126# -proc 750 - which CPU 127# -align powerpc - 4 byte alignment by default 128# -xm l - create a library 129 130CCFLAGS = -nodefaults -proc $(PROCESSOR) -D$(ARCH_TARGET) -align powerpc -enum int 131ASFLAGS = -nodefaults -proc $(PROCESSOR) -D$(ARCH_TARGET) 132ARFLAGS = -nodefaults -proc $(PROCESSOR) -xm l 133LDFLAGS = -nodefaults -proc $(PROCESSOR) 134 135REL_LDFLAGS = -nodefaults -proc $(PROCESSOR) -nostdlib 136PREREL_LDFLAGS = -nodefaults -proc $(PROCESSOR) -nostdlib 137 138CCFLAGS += -enc SJIS 139 140ifdef MULTIBYTE 141 CCFLAGS += -multibyte -char unsigned 142endif #MULTIBYTE 143 144# common debug related flags 145ifdef DEBUG 146# _DEBUG is our symbol for saying "debug version". The absence of NDEBUG 147# can also be used by code. 148 CCFLAGS += -D_DEBUG 149 ASFLAGS += -D_DEBUG 150else # DEBUG 151# NDEBUG is our symbol for saying "no debug version". The absence of _DEBUG 152# can also be used by code. 153 CCFLAGS += -DNDEBUG 154 ASFLAGS += -DNDEBUG 155endif # DEBUG 156 157# SDK switch 158ifneq ($(SDK), DOL) 159 CCFLAGS += -DRVL_SDK 160 ASFLAGS += -DRVL_SDK 161endif 162 163############################################################################### 164# 165# EPPC-SPECIFIC Build Flags and Variables 166# 167############################################################################### 168 169# 170# for CodeWarrior 171# 172# -fp hardware - allow use of hardware FP instructions 173# -Cpp_exceptions - turns off C++ exceptions. 174CCFLAGS += -fp hardware -Cpp_exceptions off 175CCFLAGS += -pragma "cats off" 176 177MWCLDIR = $(MWDIR)/PowerPC_EABI_TOOLS/Command_Line_Tools 178MWLIBDIR = $(MWDIR)/PowerPC_EABI_Support/Runtime/Lib 179 180# H is for hardware floating point 181EPPCMWLIBS = $(MWLIBDIR)/Runtime.PPCEABI.H.a \ 182 $(MWDIR)/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Lib/MSL_C.PPCEABI.bare.H.a \ 183 $(MWDIR)/PowerPC_EABI_Support/MSL/MSL_C++/PPC_EABI/Lib/MSL_C++.PPCEABI.bare.H.a 184 185ifdef TRK_INTEGRATION 186 187CCFLAGS += -DTRK_INTEGRATION 188EPPCMWLIBS += $(MWDIR)/PowerPC_EABI_Support/MetroTRK/TRK_Hollywood_Revolution.a 189EPPCMWLIBS += $(NDEVDIR)/../lib/NdevExi2A$(LIBSUFFIX) 190 191endif # TRK_INTEGRATION 192 193# NOTE: If editing REVOLUTION_LIBS, ensure that the library you're adding is 194# also built by the top-level makefile (/dolphin/build/makefile) 195# for this target (EPPC) 196 197# We use full paths so that we can depend on $( REVOLUTION_LIBS) 198# libsn.a will be prepended to link line to override __start 199 200REVOLUTION_LIBS = $(INSTALL_ROOT)/lib/base$(LIBSUFFIX) \ 201 $(INSTALL_ROOT)/lib/os$(LIBSUFFIX) \ 202 $(INSTALL_ROOT)/lib/exi$(LIBSUFFIX) \ 203 $(INSTALL_ROOT)/lib/si$(LIBSUFFIX) \ 204 $(INSTALL_ROOT)/lib/vi$(LIBSUFFIX) \ 205 $(INSTALL_ROOT)/lib/mtx$(LIBSUFFIX) \ 206 $(INSTALL_ROOT)/lib/gx$(LIBSUFFIX) \ 207 $(INSTALL_ROOT)/lib/dvd$(LIBSUFFIX) \ 208 $(INSTALL_ROOT)/lib/demo$(LIBSUFFIX) \ 209 $(INSTALL_ROOT)/lib/ai$(LIBSUFFIX) \ 210 $(INSTALL_ROOT)/lib/ax$(LIBSUFFIX) \ 211 $(INSTALL_ROOT)/lib/axfx$(LIBSUFFIX) \ 212 $(INSTALL_ROOT)/lib/mem$(LIBSUFFIX) \ 213 $(INSTALL_ROOT)/lib/cx$(LIBSUFFIX) \ 214 $(INSTALL_ROOT)/lib/mix$(LIBSUFFIX) \ 215 $(INSTALL_ROOT)/lib/sp$(LIBSUFFIX) \ 216 $(INSTALL_ROOT)/lib/axart$(LIBSUFFIX) \ 217 $(INSTALL_ROOT)/lib/syn$(LIBSUFFIX) \ 218 $(INSTALL_ROOT)/lib/seq$(LIBSUFFIX) \ 219 $(INSTALL_ROOT)/lib/dsp$(LIBSUFFIX) \ 220 $(INSTALL_ROOT)/lib/hio2$(LIBSUFFIX) \ 221 $(INSTALL_ROOT)/lib/nand$(LIBSUFFIX) \ 222 $(INSTALL_ROOT)/lib/sc$(LIBSUFFIX) \ 223 $(INSTALL_ROOT)/lib/wenc$(LIBSUFFIX) \ 224 $(INSTALL_ROOT)/lib/enc$(LIBSUFFIX) \ 225 $(INSTALL_ROOT)/lib/arc$(LIBSUFFIX) \ 226 $(INSTALL_ROOT)/lib/darch$(LIBSUFFIX) \ 227 $(INSTALL_ROOT)/lib/esp$(LIBSUFFIX) \ 228 $(INSTALL_ROOT)/lib/midi$(LIBSUFFIX) \ 229 $(INSTALL_ROOT)/lib/hid$(LIBSUFFIX) \ 230 $(INSTALL_ROOT)/lib/kbd$(LIBSUFFIX) \ 231 $(INSTALL_ROOT)/lib/kpr$(LIBSUFFIX) \ 232 233# $(INSTALL_ROOT)/lib/autotest$(LIBSUFFIX) \ 234 235# $(INSTALL_ROOT)/lib/cnt$(LIBSUFFIX) \ 236# $(INSTALL_ROOT)/lib/mcc$(LIBSUFFIX) \ 237# $(INSTALL_ROOT)/lib/hio$(LIBSUFFIX) \ 238 239####################################################################### 240# Libraries available with existence of IO processor firmware 241####################################################################### 242# 11-Mar-06 IPC lib was activated for all IO processor available targets. 243 244ifdef IOP_REV 245 REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/ipc$(LIBSUFFIX) \ 246 $(INSTALL_ROOT)/lib/fs$(LIBSUFFIX) 247else 248 REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/isfsEmu$(LIBSUFFIX) \ 249 $(INSTALL_ROOT)/lib/sdwp$(LIBSUFFIX) 250endif 251 252ifndef HOLLYWOOD_REV 253 REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/ipcRegEmu$(LIBSUFFIX) 254endif 255 256######################################################################## 257# Conditionals for list of REVOLUTION libraries. Because when you care 258# enough to emulate... 259######################################################################## 260 261# 262# 20-Jan-06 The fabled WK library. For emulation platforms ONLY. @EUG 263# 264ifeq ($(PLATFORM), RVL_EMU) 265 REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/wk$(LIBSUFFIX) 266endif 267 268# 29-Jan-06 We will keep ARAM around for RVL_EMU and PRE_RVL targets (so sound can work). 269# This means we must get rid of ARAM (and related libraries) for real HOLLYWOOD. @EUG 270# 271ifndef HOLLYWOOD_REV 272 REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/ar$(LIBSUFFIX) \ 273 $(INSTALL_ROOT)/lib/am$(LIBSUFFIX) 274endif 275 276# 277# 06-Feb-06 If in RVL_EMU environment, DIEMU API is called from DVD lib. 278# 279ifndef DI_DIRECT 280ifdef IOP_EMU 281 REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/diemu$(LIBSUFFIX) \ 282 $(INSTALL_ROOT)/lib/wk$(LIBSUFFIX) \ 283 $(INSTALL_ROOT)/lib/wkmc$(LIBSUFFIX) 284endif # IOP_EMU 285endif # DI_DIRECT 286 287# 288# 07-Feb-06 For backward compatibility. @EUG 289# 17-May-06 Added preprocessor macro WPADEMU. 290# 16-Jun-06 Added KPAD/KPADEmu/wireless WPAD libraries. 291# 292ifndef WPADEMU_LIB 293 REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/pad$(LIBSUFFIX) 294 REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/wpad$(LIBSUFFIX) 295 REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/kpad$(LIBSUFFIX) 296else # we're using the emulated WPAD library 297 REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/padempty$(LIBSUFFIX) 298 REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/wpadEmu$(LIBSUFFIX) 299 REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/kpadEmu$(LIBSUFFIX) 300 CCFLAGS += -DWPADEMU 301endif 302 303# 22-Feb-06 To enable Mr.EXI serial report output. 304# 305ifdef HOLLYWOOD_REV 306 REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/euart$(LIBSUFFIX) 307endif 308 309# 16-Jun-06 USB and wireless UI. 310# 311REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/usb$(LIBSUFFIX) \ 312 $(INSTALL_ROOT)/lib/bte$(LIBSUFFIX) 313 314# 24-Dec-08 Following libs are involved into wpad. 315# $(INSTALL_ROOT)/lib/wud$(LIBSUFFIX) \ 316 317 318LINCLUDES = -I$(MODULE_ROOT)/include 319 320# -i- delimits user paths from system paths. 321# By default, the only user path points to the local include tree. 322GINCLUDES = -I$(INC_ROOT) \ 323 -ir $(MWDIR)/PowerPC_EABI_Support/Msl/Msl_c \ 324 -I$(MWDIR)/PowerPC_EABI_Support/Runtime/Inc 325INCLUDES = $(LINCLUDES) -i- $(GINCLUDES) 326 327LIB_PATH = -L$(INSTALL_ROOT)/lib 328 329# -map - create a .MAP file that shows final memory layout of 330# all sections 331# -unused - show unused symbols 332# -fp hardware - linker must use same fp settings as compiler 333# Note that LDFLAGS automagically includes the required Metrowerks library 334LDFLAGS += $(LIB_PATH) -fp hardware $(EPPCMWLIBS) 335REL_LDFLAGS += -fp hardware 336PREREL_LDFLAGS += -fp hardware 337 338ifdef COUNTRY_REGION 339 REGION_SUFFIX ?= _$(COUNTRY_REGION) 340else 341 REGION_SUFFIX ?= 342endif 343 344ifdef DEBUG 345 LIBSUFFIX = D.a 346 BINSUFFIX = D.elf 347 DOLSUFFIX = D.dol 348 PLFSUFFIX = D.plf 349 PREPLFSUFFIX = D.preplf 350 RELSUFFIX = D.rel 351 STRSUFFIX = D.str 352 LCFSUFFIX = D.lcf 353 LSTSUFFIX = D.lst 354 WADSUFFIX = D.wad 355 ASUFFIX = D 356 MCHSUFFIX = D.mch 357 LZ77SUFFIX = D.lz7 358else # DEBUG 359 LIBSUFFIX = .a 360 BINSUFFIX = .elf 361 DOLSUFFIX = .dol 362 PLFSUFFIX = .plf 363 PREPLFSUFFIX = .preplf 364 RELSUFFIX = .rel 365 STRSUFFIX = .str 366 LCFSUFFIX = .lcf 367 LSTSUFFIX = .lst 368 WADSUFFIX = .wad 369 ASUFFIX = 370 MCHSUFFIX = .mch 371 LZ77SUFFIX = .lz7 372endif # DEBUG 373 374DEPSUFFIX = .d 375NANDAPPSUFFIX = .nandapp 376COMPILE = -c 377 378CC = $(MWCLDIR)/mwcceppc.exe 379AS = $(MWCLDIR)/mwasmeppc.exe 380LD = $(MWCLDIR)/mwldeppc.exe 381AR = $(MWCLDIR)/mwldeppc.exe 382 383# New 2007/10/17 384ifdef NANDAPP 385 CCFLAGS += -DNANDAPP 386endif 387 388# New 2006/02/15 389ifdef RVL_OS 390 CCFLAGS += -DRVL_OS 391 ASFLAGS += -DRVL_OS 392endif # RVL_OS 393 394ifdef EPPC 395 CCFLAGS += -DEPPC 396 ASFLAGS += -DEPPC 397endif # EPPC 398 399ifeq ($(PROCESSOR), gekko) 400 GEKKO = TRUE 401 CCFLAGS += -DGEKKO 402 ASFLAGS += -DGEKKO 403endif # gekko 404 405# New Code 2005/12/16 406ifdef HOLLYWOOD_REV 407 CCFLAGS += -DHOLLYWOOD_REV=$(HOLLYWOOD_REV) 408 ASFLAGS += -DHOLLYWOOD_REV=$(HOLLYWOOD_REV) 409endif # HOLLYWOOD_REV 410 411ifdef BROADWAY_REV 412 CCFLAGS += -DBROADWAY_REV=$(BROADWAY_REV) 413 ASFLAGS += -DBROADWAY_REV=$(BROADWAY_REV) 414endif # BROADWAY_REV 415 416ifdef IOP_REV 417 CCFLAGS += -DIOP_REV=$(IOP_REV) 418 ASFLAGS += -DIOP_REV=$(IOP_REV) 419endif # IOP_REV 420 421# for RVL_EMU 422ifdef HOLLYWOOD_EMU 423 CCFLAGS += -DHOLLYWOOD_EMU 424 ASFLAGS += -DHOLLYWOOD_EMU 425endif # HOLLYWOOD_EMU 426 427ifdef BROADWAY_EMU 428 CCFLAGS += -DBROADWAY_EMU 429 ASFLAGS += -DBROADWAY_EMU 430endif # BROADWAY_EMU 431 432ifdef IOP_EMU 433 CCFLAGS += -DIOP_EMU 434 ASFLAGS += -DIOP_EMU 435endif # IOP_EMU 436 437ifdef DI_DIRECT 438 CCFLAGS += -DDI_DIRECT 439 ASFLAGS += -DDI_DIRECT 440endif # DI_DIRECT 441 442ifdef NO_AHBPI_DSEA 443 CCFLAGS += -DNO_AHBPI_DSEA 444 ASFLAGS += -DNO_AHBPI_DSEA 445endif # NO_AHBPI_DSEA 446 447############################################################################### 448# 449# Dolphin SDK build configuration settings 450# This section can be skipped by defining DOLPHIN_MINFLAGS for building 451# application program. 452# 453############################################################################### 454 455ifndef DOLPHIN_MINFLAGS 456 457# 458# for CodeWarror 459# 460# Reduced warning level from "ALL" to "MOST", got rid of 461# intercapping complaints in header filenames. 462# 463CCFLAGS += -W all -W nofilecaps -W nosysfilecaps -W noimplicitconv 464 465WARNLV_SDKINC = -W padding,notused 466WARNLV_SDKLIB = 467 468LDFLAGS += -unused -map ${@:.elf=.map} 469REL_LDFLAGS += -unused -map ${@:.plf=.map} -m _prolog -r1 -strip_partial 470PREREL_LDFLAGS += -unused -map ${@:.preplf=.premap} -m _prolog -r 471 472# debug related flags 473ifdef DEBUG 474# -opt off - The debugger is very unhappy with any optimizations at all. 475# -inline off - disable all inlining 476CCFLAGS += -opt off -inline off 477 478# 479# make DEBUG=TRUE NDEBUGINFO=TRUE 480# for DEBUG lib without debug information 481# 482ifndef NDEBUGINFO 483# -gdwarf-2 - generate full debug symbolics 484 LDFLAGS += -gdwarf-2 485 CCFLAGS += -gdwarf-2 486 ASFLAGS += -gdwarf-2 487 REL_LDFLAGS += -gdwarf-2 488 PREREL_LDFLAGS += 489endif 490 491else # DEBUG 492# -O4,p - full optimizations, optimize for speed (not code size) 493# -inline auto - inline small functions where possible, 494# even without inline directirve 495# -unused - show unused symbols 496CCFLAGS += -ipa file -O4,p -inline auto -pragma "warn_notinlined off" 497ASFLAGS += 498 499# 500# make NDEBUG=TRUE DEBUGINFO=TRUE 501# for NDEBUG lib with debug information 502# 503ifdef DEBUGINFO 504 LDFLAGS += -gdwarf-2 505 CCFLAGS += -gdwarf-2 506 ASFLAGS += -gdwarf-2 507 REL_LDFLAGS += -gdwarf-2 508 PREREL_LDFLAGS += 509endif # DEBUGINFO 510 511endif # DEBUG 512 513endif #DOLPHIN_MINFLAGS 514 515 516############################################################################### 517# 518# Dolphin configuration settings 519# This section is only for Nintendo internal use. 520# 521############################################################################### 522 523# if REALDEBUGGER is TRUE, then DBInit will not initialize the low memory 524# structure 525REALDEBUGGER = TRUE 526