############################################################################### # Global common definitions for build system # # Copyright 2005-2006 Nintendo. 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. ############################################################################### # This file contains common definitions that exist across the build # # Check make version # ifneq ($(MAKE_VERSION),3.80) __version: @echo ---- Sorry, this makefile is for \'make\' version 3.80 @make -v @exit 1 endif ############################################################################### # # COMMON BUILD FLAGS AND CONSTANTS # ############################################################################### # This is where all directories will live. # Note that if you change ROOT, you must change the BUILDTOOLS_ROOT # environment variable. empty:= space:= $(empty) $(empty) comma:= , #============================================================================= # REVOLUTION_SDK_ROOT #============================================================================= #REVOLUTION_SDK_ROOT:=C:\RevolutionSDK ROOT:= $(subst $(space),\$(space),$(subst \,/,$(REVOLUTION_SDK_ROOT))) # Default destination install directory, where installs will occur BASEINSTALL_ROOT= $(ROOT) # determine the architecture target # If PLATFORM is not set, it will default to RVL ifeq ($(origin PLATFORM), undefined) PLATFORM:=RVL endif ARCH_TARGET = $(PLATFORM) ifeq ($(PLATFORM), RVL) RVL_OS = TRUE HOLLYWOOD_REV = 1 BROADWAY_REV = 1 IOP_REV = 1 EPPC = TRUE PROCESSOR = gekko TRK_INTEGRATION = TRUE endif #RVL # RVL0 (former RVL_AHBPI) ifeq ($(PLATFORM), RVL0) RVL_OS = TRUE HOLLYWOOD_REV = 1 BROADWAY_REV = 1 IOP_REV = 1 DI_DIRECT = TRUE EPPC = TRUE PROCESSOR = gekko TRK_INTEGRATION = TRUE endif #RVL0 ifeq ($(PLATFORM), RVL_LEGACYDI) RVL_OS = TRUE HOLLYWOOD_REV = 1 BROADWAY_REV = 1 IOP_REV = 1 DI_DIRECT = TRUE NO_AHBPI_DSEA = TRUE EPPC = TRUE PROCESSOR = gekko TRK_INTEGRATION = TRUE endif #RVL_LEGACYDI ifeq ($(PLATFORM), RVL_EMU) RVL_OS = TRUE BROADWAY_EMU = TRUE HOLLYWOOD_EMU = TRUE IOP_EMU = TRUE NO_AHBPI_DSEA = TRUE EPPC = TRUE PROCESSOR = gekko TRK_INTEGRATION = TRUE endif #RVL_EMU ifeq ($(PLATFORM), PRE_RVL) RVL_OS = TRUE DI_DIRECT = TRUE NO_AHBPI_DSEA = TRUE EPPC = TRUE PROCESSOR = gekko TRK_INTEGRATION = TRUE endif # PRE_RVL ifndef NDEBUG DEBUG = TRUE BUILD_TARGET = DEBUG else # NDEBUG BUILD_TARGET = NDEBUG endif # NDEBUG INSTALL_ROOT = $(BASEINSTALL_ROOT)/$(ARCH_TARGET) # Default binaries/tools directory BIN = $(INSTALL_ROOT)/bin # Default location of the sources and makefiles INC_ROOT = $(ROOT)/include BUILD_ROOT = $(ROOT)/build MAKE_ROOT = $(BUILD_ROOT)/buildtools DOL_INC_ROOT = $(INC_ROOT) LIB_ROOT = $(BUILD_ROOT)/libraries DEMO_ROOT = $(BUILD_ROOT)/demos TEST_ROOT = $(BUILD_ROOT)/tests SAMPLE_ROOT = $(BUILD_ROOT)/samplebuild TOOL_ROOT = $(BUILD_ROOT)/tools # Default location of the Metrowerks. CWFOLDER is set by the # Codewarrior installer. Change the backslashes into normal slashes, # and backslash any spaces in the path. ifdef CWFOLDER_RVL MWDIR = $(subst $(space),\$(space),$(subst \,/,$(CWFOLDER_RVL))) else MWDIR = $(subst $(space),\$(space),$(subst \,/,$(CWFOLDER))) endif AMCDIR = $(subst $(space),\$(space),$(subst \,/,$(AMCDDKBIN))) ODEDIR = $(subst $(space),\$(space),$(subst \,/,$(ODEMUSDKBIN))) NDEVDIR = $(subst $(space),\$(space),$(subst \,/,$(NDEV_TOOLS))) ############################################################################### # # COMMON COMPILER FLAGS # ############################################################################### # # for CodeWarrior # # -nodefaults - required so the compiler does not search all the # Codewarrior paths # -proc 750 - which CPU # -align powerpc - 4 byte alignment by default # -xm l - create a library CCFLAGS = -nodefaults -proc $(PROCESSOR) -D$(ARCH_TARGET) -align powerpc -enum int ASFLAGS = -nodefaults -proc $(PROCESSOR) -D$(ARCH_TARGET) ARFLAGS = -nodefaults -xm l LDFLAGS = -nodefaults REL_LDFLAGS = -nodefaults -nostdlib PREREL_LDFLAGS = -nodefaults -nostdlib # add yasuh-to 2005/12/28 CCFLAGS += -enc SJIS # ifeq ($(REVOLUTION_SDK_LANG),en) # CCFLAGS += -enc ascii # else # CCFLAGS += -enc SJIS # endif ifdef MULTIBYTE CCFLAGS += -multibyte -char unsigned endif #MULTIBYTE # common debug related flags ifdef DEBUG # _DEBUG is our symbol for saying "debug version". The absence of NDEBUG # can also be used by code. CCFLAGS += -D_DEBUG ASFLAGS += -D_DEBUG else # DEBUG # NDEBUG is our symbol for saying "no debug version". The absence of _DEBUG # can also be used by code. CCFLAGS += -DNDEBUG ASFLAGS += -DNDEBUG endif # DEBUG # SDK switch ifneq ($(SDK), DOL) CCFLAGS += -DRVL_SDK ASFLAGS += -DRVL_SDK endif ############################################################################### # # EPPC-SPECIFIC Build Flags and Variables # ############################################################################### # # for CodeWarrior # # -fp hardware - allow use of hardware FP instructions # -Cpp_exceptions - turns off C++ exceptions. CCFLAGS += -fp hardware -Cpp_exceptions off ifndef CATS_ON CCFLAGS += -pragma "cats off" endif # CATS_ON MWCLDIR = $(MWDIR)/PowerPC_EABI_TOOLS/Command_Line_Tools MWLIBDIR = $(MWDIR)/PowerPC_EABI_Support/Runtime/Lib # H is for hardware floating point EPPCMWLIBS = $(MWLIBDIR)/Runtime.PPCEABI.H.a \ $(MWDIR)/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Lib/MSL_C.PPCEABI.bare.H.a \ $(MWDIR)/PowerPC_EABI_Support/MSL/MSL_C++/PPC_EABI/Lib/MSL_C++.PPCEABI.bare.H.a ifdef TRK_INTEGRATION ifdef HOLLYWOOD_REV EPPCMWLIBS += $(MWDIR)/PowerPC_EABI_Support/MetroTRK/TRK_Hollywood_Revolution.a else EPPCMWLIBS += $(MWDIR)/PowerPC_EABI_Support/MetroTRK/TRK_MINNOW_DOLPHIN.a endif ifeq ($(PLATFORM), RVL) ifdef NDEV EPPCMWLIBS += $(NDEVDIR)/../lib/NdevExi2A$(LIBSUFFIX) -lodenotstub$(LIBSUFFIX) else EPPCMWLIBS += -lodemustubs$(LIBSUFFIX) endif endif ifeq ($(PLATFORM), RVL0) ifdef NDEV EPPCMWLIBS += $(NDEVDIR)/../lib/NdevExi2A$(LIBSUFFIX) -lodenotstub$(LIBSUFFIX) else EPPCMWLIBS += -lodemustubs$(LIBSUFFIX) endif endif ifeq ($(PLATFORM), RVL_LEGACYDI) ifdef NDEV EPPCMWLIBS += $(NDEVDIR)/../lib/NdevExi2$(LIBSUFFIX) -lodenotstub$(LIBSUFFIX) else EPPCMWLIBS += -lodemustubs$(LIBSUFFIX) endif endif ifeq ($(PLATFORM), PRE_RVL) ifdef NDEV EPPCMWLIBS += $(NDEVDIR)/../lib/NdevExi2$(LIBSUFFIX) -lodenotstub$(LIBSUFFIX) else ifdef ODEMUSDKBIN EPPCMWLIBS += $(ODEDIR)/../lib/odemuexi2.a -lodenotstub$(LIBSUFFIX) else # not (NDEV and GDEV) EPPCMWLIBS += -lodemustubs$(LIBSUFFIX) endif endif ifdef AMCDDKBIN EPPCMWLIBS += $(AMCDIR)/../lib/AmcExi2.a -lamcnotstub$(LIBSUFFIX) else EPPCMWLIBS += -lamcstubs$(LIBSUFFIX) endif endif ifeq ($(PLATFORM), RVL_EMU) ifdef NDEV EPPCMWLIBS += $(NDEVDIR)/../lib/NdevExi2$(LIBSUFFIX) -lodenotstub$(LIBSUFFIX) else ifdef ODEMUSDKBIN EPPCMWLIBS += $(ODEDIR)/../lib/odemuexi2.a -lodenotstub$(LIBSUFFIX) else # not (NDEV and GDEV) EPPCMWLIBS += -lodemustubs$(LIBSUFFIX) endif endif ifdef AMCDDKBIN EPPCMWLIBS += $(AMCDIR)/../lib/AmcExi2.a -lamcnotstub$(LIBSUFFIX) else EPPCMWLIBS += -lamcstubs$(LIBSUFFIX) endif endif CCFLAGS += -DTRK_INTEGRATION endif # TRK_INTEGRATION # NOTE: If editing REVOLUTION_LIBS, ensure that the library you're adding is # also built by the top-level makefile (/dolphin/build/makefile) # for this target (EPPC) # We use full paths so that we can depend on $( REVOLUTION_LIBS) # libsn.a will be prepended to link line to override __start REVOLUTION_LIBS = $(INSTALL_ROOT)/lib/base$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/os$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/exi$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/si$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/db$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/vi$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/mtx$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/gx$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/dvd$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/demo$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/ai$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/ax$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/axfx$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/mem$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/cx$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/mix$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/sp$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/axart$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/syn$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/seq$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/dsp$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/card$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/hio2$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/nand$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/sc$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/wenc$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/enc$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/arc$(LIBSUFFIX) # $(INSTALL_ROOT)/lib/cnt$(LIBSUFFIX) \ # $(INSTALL_ROOT)/lib/mcc$(LIBSUFFIX) \ # $(INSTALL_ROOT)/lib/hio$(LIBSUFFIX) \ ####################################################################### # Libraries available with existence of IO processor firmware ####################################################################### # 11-Mar-06 IPC lib was activated for all IO processor available targets. ifdef IOP_REV REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/ipc$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/fs$(LIBSUFFIX) else REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/isfsEmu$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/sdwp$(LIBSUFFIX) endif ifdef HOLLYWOOD_REV else REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/ipcRegEmu$(LIBSUFFIX) endif ######################################################################## # Conditionals for list of REVOLUTION libraries. Because when you care # enough to emulate... ######################################################################## # # 20-Jan-06 The fabled WK library. For emulation platforms ONLY. @EUG # ifeq ($(PLATFORM), RVL_EMU) REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/wk$(LIBSUFFIX) endif # 29-Jan-06 We will keep ARAM around for RVL_EMU and PRE_RVL targets (so sound can work). # This means we must get rid of ARAM (and related libraries) for real HOLLYWOOD. @EUG # ifndef HOLLYWOOD_REV REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/ar$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/am$(LIBSUFFIX) endif # # 06-Feb-06 If in RVL_EMU environment, DIEMU API is called from DVD lib. # ifndef DI_DIRECT ifdef IOP_EMU REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/diemu$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/wk$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/wkmc$(LIBSUFFIX) endif # IOP_EMU endif # DI_DIRECT # # 07-Feb-06 For backward compatibility. @EUG # 17-May-06 Added preprocessor macro WPADEMU. # 16-Jun-06 Added KPAD/KPADEmu/wireless WPAD libraries. # ifndef WPADEMU_LIB REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/pad$(LIBSUFFIX) REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/wpad$(LIBSUFFIX) REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/kpad$(LIBSUFFIX) else # we're using the emulated WPAD library REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/padempty$(LIBSUFFIX) REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/wpadEmu$(LIBSUFFIX) REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/kpadEmu$(LIBSUFFIX) CCFLAGS += -DWPADEMU endif # 22-Feb-06 To enable Mr.EXI serial report output. # ifdef HOLLYWOOD_REV REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/euart$(LIBSUFFIX) endif # 16-Jun-06 USB and wireless UI. # REVOLUTION_LIBS += $(INSTALL_ROOT)/lib/usb$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/wud$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/bte$(LIBSUFFIX) LINCLUDES = -I$(MODULE_ROOT)/include # -i- delimits user paths from system paths. # By default, the only user path points to the local include tree. GINCLUDES = -I$(INC_ROOT) \ -ir $(MWDIR)/PowerPC_EABI_Support/Msl/Msl_c \ -I$(MWDIR)/PowerPC_EABI_Support/Runtime/Inc INCLUDES = $(LINCLUDES) -i- $(GINCLUDES) LIB_PATH = -L$(INSTALL_ROOT)/lib # -map - create a .MAP file that shows final memory layout of # all sections # -unused - show unused symbols # -fp hardware - linker must use same fp settings as compiler # Note that LDFLAGS automagically includes the required Metrowerks library LDFLAGS += $(LIB_PATH) -fp hardware $(EPPCMWLIBS) REL_LDFLAGS += -fp hardware PREREL_LDFLAGS += -fp hardware ifdef DEBUG LIBSUFFIX = D.a BINSUFFIX = D.elf DOLSUFFIX = D.dol PLFSUFFIX = D.plf PREPLFSUFFIX = D.preplf RELSUFFIX = D.rel STRSUFFIX = D.str LCFSUFFIX = D.lcf LSTSUFFIX = D.lst WADSUFFIX = D.wad ASUFFIX = D else # DEBUG LIBSUFFIX = .a BINSUFFIX = .elf DOLSUFFIX = .dol PLFSUFFIX = .plf PREPLFSUFFIX = .preplf RELSUFFIX = .rel STRSUFFIX = .str LCFSUFFIX = .lcf LSTSUFFIX = .lst WADSUFFIX = .wad ASUFFIX = endif # DEBUG DEPSUFFIX = .d CC = $(MWCLDIR)/mwcceppc.exe AS = $(MWCLDIR)/mwasmeppc.exe LD = $(MWCLDIR)/mwldeppc.exe AR = $(MWCLDIR)/mwldeppc.exe COMPILE = -c # New 2006/02/15 ifdef RVL_OS CCFLAGS += -DRVL_OS ASFLAGS += -DRVL_OS endif # RVL_OS ifdef EPPC CCFLAGS += -DEPPC ASFLAGS += -DEPPC endif # EPPC ifeq ($(PROCESSOR), gekko) GEKKO = TRUE CCFLAGS += -DGEKKO ASFLAGS += -DGEKKO endif # gekko # New Code 2005/12/16 ifdef HOLLYWOOD_REV CCFLAGS += -DHOLLYWOOD_REV=$(HOLLYWOOD_REV) ASFLAGS += -DHOLLYWOOD_REV=$(HOLLYWOOD_REV) endif # HOLLYWOOD_REV ifdef BROADWAY_REV CCFLAGS += -DBROADWAY_REV=$(BROADWAY_REV) ASFLAGS += -DBROADWAY_REV=$(BROADWAY_REV) endif # BROADWAY_REV ifdef IOP_REV CCFLAGS += -DIOP_REV=$(IOP_REV) ASFLAGS += -DIOP_REV=$(IOP_REV) endif # IOP_REV # for RVL_EMU ifdef HOLLYWOOD_EMU CCFLAGS += -DHOLLYWOOD_EMU ASFLAGS += -DHOLLYWOOD_EMU endif # HOLLYWOOD_EMU ifdef BROADWAY_EMU CCFLAGS += -DBROADWAY_EMU ASFLAGS += -DBROADWAY_EMU endif # BROADWAY_EMU ifdef IOP_EMU CCFLAGS += -DIOP_EMU ASFLAGS += -DIOP_EMU endif # IOP_EMU ifdef DI_DIRECT CCFLAGS += -DDI_DIRECT ASFLAGS += -DDI_DIRECT endif # DI_DIRECT ifdef NO_AHBPI_DSEA CCFLAGS += -DNO_AHBPI_DSEA ASFLAGS += -DNO_AHBPI_DSEA endif # NO_AHBPI_DSEA ############################################################################### # # Dolphin SDK build configuration settings # This section can be skipped by defining DOLPHIN_MINFLAGS for building # application program. # ############################################################################### ifndef DOLPHIN_MINFLAGS # # for CodeWarror # # Reduced warning level from "ALL" to "MOST", got rid of # intercapping complaints in header filenames. # CCFLAGS += -W all -W nofilecaps -W nosysfilecaps WARNLV_SDKINC = -W padding,notused WARNLV_SDKLIB = LDFLAGS += -unused -map ${@:.elf=.map} REL_LDFLAGS += -unused -map ${@:.plf=.map} -m _prolog -r1 -strip_partial PREREL_LDFLAGS += -unused -map ${@:.preplf=.premap} -m _prolog -r # debug related flags ifdef DEBUG # -opt off - The debugger is very unhappy with any optimizations at all. # -inline off - disable all inlining CCFLAGS += -opt off -inline off # # make DEBUG=TRUE NDEBUGINFO=TRUE # for DEBUG lib without debug information # ifndef NDEBUGINFO # -g - generate full debug symbolics LDFLAGS += -g CCFLAGS += -g ASFLAGS += -g REL_LDFLAGS += -g PREREL_LDFLAGS += endif else # DEBUG # -O4,p - full optimizations, optimize for speed (not code size) # -inline auto - inline small functions where possible, # even without inline directive # -unused - show unused symbols CCFLAGS += -ipa file -O4,p -inline auto -pragma "warn_notinlined off" ASFLAGS += # # make NDEBUG=TRUE DEBUGINFO=TRUE # for NDEBUG lib with debug information # ifdef DEBUGINFO LDFLAGS += -g CCFLAGS += -g ASFLAGS += -g REL_LDFLAGS += -g PREREL_LDFLAGS += endif # DEBUGINFO endif # DEBUG endif #DOLPHIN_MINFLAGS ############################################################################### # # Dolphin configuration settings # This section is only for Nintendo internal use. # ############################################################################### # if REALDEBUGGER is TRUE, then DBInit will not initialize the low memory # structure REALDEBUGGER = TRUE