############################################################################### # Global common definitions for build system # # Copyright 2005-2009 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 # MAKE_PLATFORM := $(shell uname | sed 's/_.*//') ifeq ($(MAKE_VERSION),3.79.1) MAKE_ON_MSYS = TRUE else ifeq ($(MAKE_VERSION),3.80) MAKE_ON_CYGWIN = TRUE else __version: @echo ---- Sorry, this makefile is for \'make\' version 3.80 for Cygwin @echo or version 3.79.1 for MSYS @make -v endif 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 #============================================================================= 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 ifndef NDEBUG DEBUG = TRUE BUILD_TARGET = DEBUG else # NDEBUG BUILD_TARGET = NDEBUG endif # NDEBUG INSTALL_ROOT = $(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 LIB_ROOT = $(BUILD_ROOT)/libraries DEMO_ROOT = $(BUILD_ROOT)/demos DOL_INC_ROOT = $(INC_ROOT) TEST_ROOT = $(BUILD_ROOT)/tests SAMPLE_ROOT = $(BUILD_ROOT)/samplebuild TOOL_ROOT = $(BUILD_ROOT)/tools AUTOTEST_DVDROOT = $(ROOT)/autodata AUTOTEST_DVDROOT_TESTS = $(AUTOTEST_DVDROOT)/tests AUTOTEST_DVDROOT_IMPORT = $(AUTOTEST_DVDROOT)/import AUTOTEST_DVDROOT_DATA = $(AUTOTEST_DVDROOT)/datatitle AUTOTEST_DVDROOT_DATA_ARC = $(AUTOTEST_DVDROOT_DATA)/archives AUTOTEST_STUB_PATH = $(INSTALL_ROOT)/bin/tests/autotest AUTOTEST_STUB = autotest_stub AUTOTEST_MAKEPATH = $(TEST_ROOT)/autotest # 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 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 -proc $(PROCESSOR) -xm l LDFLAGS = -nodefaults -proc $(PROCESSOR) REL_LDFLAGS = -nodefaults -proc $(PROCESSOR) -nostdlib PREREL_LDFLAGS = -nodefaults -proc $(PROCESSOR) -nostdlib CCFLAGS += -enc SJIS 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 CCFLAGS += -pragma "cats off" 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 CCFLAGS += -DTRK_INTEGRATION EPPCMWLIBS += $(MWDIR)/PowerPC_EABI_Support/MetroTRK/TRK_Hollywood_Revolution.a EPPCMWLIBS += $(NDEVDIR)/../lib/NdevExi2A$(LIBSUFFIX) 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/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/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/darch$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/esp$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/midi$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/hid$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/kbd$(LIBSUFFIX) \ $(INSTALL_ROOT)/lib/kpr$(LIBSUFFIX) \ # $(INSTALL_ROOT)/lib/autotest$(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 ifndef HOLLYWOOD_REV 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/bte$(LIBSUFFIX) # 24-Dec-08 Following libs are involved into wpad. # $(INSTALL_ROOT)/lib/wud$(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 COUNTRY_REGION REGION_SUFFIX ?= _$(COUNTRY_REGION) else REGION_SUFFIX ?= endif 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 MCHSUFFIX = D.mch LZ77SUFFIX = D.lz7 else # DEBUG LIBSUFFIX = .a BINSUFFIX = .elf DOLSUFFIX = .dol PLFSUFFIX = .plf PREPLFSUFFIX = .preplf RELSUFFIX = .rel STRSUFFIX = .str LCFSUFFIX = .lcf LSTSUFFIX = .lst WADSUFFIX = .wad ASUFFIX = MCHSUFFIX = .mch LZ77SUFFIX = .lz7 endif # DEBUG DEPSUFFIX = .d NANDAPPSUFFIX = .nandapp COMPILE = -c CC = $(MWCLDIR)/mwcceppc.exe AS = $(MWCLDIR)/mwasmeppc.exe LD = $(MWCLDIR)/mwldeppc.exe AR = $(MWCLDIR)/mwldeppc.exe # New 2007/10/17 ifdef NANDAPP CCFLAGS += -DNANDAPP endif # 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 -W noimplicitconv 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 # -gdwarf-2 - generate full debug symbolics LDFLAGS += -gdwarf-2 CCFLAGS += -gdwarf-2 ASFLAGS += -gdwarf-2 REL_LDFLAGS += -gdwarf-2 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 directirve # -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 += -gdwarf-2 CCFLAGS += -gdwarf-2 ASFLAGS += -gdwarf-2 REL_LDFLAGS += -gdwarf-2 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