1############################################################################### 2# Makefile for rsodemo 3# 4# Copyright (C) 2006-2008 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 14# commondefs must be included near the top so that all common variables 15# will be defined before their use. 16include $(REVOLUTION_SDK_ROOT)/build/buildtools/commondefs 17 18# build any code modules and module name string table 19all: setup build install 20 21# Add Suffix for RSO Files 22ifdef NDEBUG 23SELSUFFIX = .sel 24RSOSUFFIX = .rso 25DDFSUFFIX = .ddf 26else 27SELSUFFIX = D.sel 28RSOSUFFIX = D.rso 29DDFSUFFIX = D.ddf 30endif 31 32HBM_LIB = $(INSTALL_ROOT)/lib/homebuttonLib$(LIBSUFFIX) 33TPL_LIB = $(INSTALL_ROOT)/lib/tpl$(LIBSUFFIX) 34 35# module name should be set to the name of this subdirectory 36# DEMO = TRUE indicates that this module resides under the "demos" subtree. 37# The list of selectable paths can be found in modulerules. 38MODULENAME = hbmdemo/rsodemo 39DEMO = TRUE 40 41# small data sections are not supported by relocatable modules 42CCFLAGS += -sdata 0 -sdata2 0 43ifdef MAC 44 45else 46# EPPC 47 48# CSRCS lists all C files that should be built 49# The makefile determines which objects are linked into which binaries 50# based on the dependencies you fill in at the bottom of this file 51CSRCS_D = rsomodule.c 52CSRCS_S = 53CSRCS = $(CSRCS_D) $(CSRCS_S) 54 55# CPPSRCS lists all C++ files that should be built 56# The makefile determines which objects are linked into which binaries 57# based on the dependencies you fill in at the bottom of this file 58CPPSRCS_D = 59CPPSRCS_S =rsodemo.cpp 60CPPSRCS = $(CPPSRCS_D) $(CPPSRCS_S) 61 62# BINNAMES specifies the static portion of the program. Note that no suffix 63# is required, as that will depend on whether this is a DEBUG build or not. 64# The final name of the binaries will be $(STATIC)$(BINSUFFIX) 65BINNAMES = rsodemo 66 67RSO_DVDROOT = $(REVOLUTION_SDK_ROOT)/dvddata/hbmdemo 68 69# RELNAMES lists all relocatable modules that will be linked. 70# Note that no suffix is required, as that will depend on whether 71# this is a DEBUG build or not. 72# The final name of the modules will be $(RELNAMES)$(RELSUFFIX) 73 74# 75#RELNAMES = $(basename $(CPPSRCS_D)) $(basename $(CSRCS_D)) 76TARGET_PLFS = $(addprefix $(FULLBIN_ROOT)/,$(addsuffix $(PLFSUFFIX), $(basename $(CSRCS_D)))) 77TARGET_PLFS += $(addprefix $(FULLBIN_ROOT)/,$(addsuffix $(PLFSUFFIX), $(basename $(CPPSRCS_D)))) 78 79#TARGET_RSOS = $(addprefix $(FULLBIN_ROOT)/,$(addsuffix $(RSOSUFFIX), $(RELNAMES))) 80TARGET_RSOS = $(addprefix $(FULLBIN_ROOT)/,$(addsuffix $(RSOSUFFIX), $(basename $(CSRCS_D)))) 81TARGET_RSOS += $(addprefix $(FULLBIN_ROOT)/,$(addsuffix $(RSOSUFFIX), $(basename $(CPPSRCS_D)))) 82 83 84# linker command file for building the static module 85LCF_FILE = $(FULLBIN_ROOT)/rsodemo$(LCFSUFFIX) 86 87# linker command file for building relocatable modules (for 1st step) 88PREREL_LCF_FILE = $(INC_ROOT)/dolphin/eppc.lcf 89 90# linker command file for building relocatable modules (for 2nd step) 91REL_LCF_FILE = $(FULLBIN_ROOT)/partial$(LCFSUFFIX) 92 93# linker command file for building static modules 94STATIC_LCF_FILE = $(INC_ROOT)/revolution/eppc.$(ARCH_TARGET).lcf 95 96# filename of the force active symbol name list 97#LST_FILE = $(FULLBIN_ROOT)/active$(LSTSUFFIX) 98 99# filename of the symbol name list 100SYMBOL_LST_FILE = $(FULLBIN_ROOT)/symbol$(LSTSUFFIX) 101 102endif 103 104# modulerules contains the rules that will use the above variables 105# and dependencies below to construct the binaries specified. 106include $(REVOLUTION_SDK_ROOT)/build/buildtools/modulerules 107 108INCLUDES += -I./include 109 110# all build targets that depend on 'setup' target must be listed as 111# prerequisites for 'dobuild'. 112dobuild: $(FULLBIN_ROOT)/$(BINNAMES)$(SELSUFFIX) $(FULLBIN_ROOT)/$(BINNAMES)$(DDFSUFFIX) 113 114$(FULLBIN_ROOT)/$(BINNAMES)$(DDFSUFFIX): $(TARGET_BINS) 115 mkdir -p $(RSO_DVDROOT) 116 cp $(FULLBIN_ROOT)/rsomodule$(RSOSUFFIX) $(RSO_DVDROOT)/rsomodule$(RSOSUFFIX) 117 cp $(FULLBIN_ROOT)/rsodemo$(SELSUFFIX) $(RSO_DVDROOT)/rsodemo$(SELSUFFIX) 118 #@echo "[Input]" >> $@ 119 #@echo "DvdRoot=\"`cygpath -w '$(RSO_DVDROOT)'`\"" >> $@ 120 121# generate the module name string table. 122$(FULLBIN_ROOT)/$(BINNAMES)$(SELSUFFIX): $(TARGET_BINS) $(SYMBOL_LST_FILE) 123 @echo 124 @echo ">> $(notdir $+) --> $@" 125 cd $(FULLBIN_ROOT); $(ROOT)/X86/bin/makerso.exe $(notdir $(TARGET_BINS)) -e $(notdir $(SYMBOL_LST_FILE)) -a 126 127# $(PREPLFSUFFIX) are for the 1st .plf file build without .lcf file 128# $(PLFSUFFIX) are for the 2nd .plf file build with .lcf file 129 130#$(TARGET_PREPLFS) : $(FULLBIN_ROOT)/%$(PREPLFSUFFIX): $(FULLBINOBJ_ROOT)/%.o $(BINOBJ_ROOT)/global_destructor_chain.o 131 132$(TARGET_BINS): $(CPPSRCS_S:.cpp=.o) $(CSRCS_S:.c=.o) $(LCF_FILE) $(INSTALL_ROOT)/lib/rso$(LIBSUFFIX) 133$(TARGET_BINS): $(REVOLUTION_LIBS) $(TPL_LIB) 134 135$(TARGET_PLFS) : $(FULLBIN_ROOT)/%$(PLFSUFFIX) : $(FULLBINOBJ_ROOT)/%.o $(BINOBJ_ROOT)/global_destructor_chain.o $(REL_LCF_FILE) 136$(TARGET_PLFS) : $(HBM_LIB) 137 138# generate force active symbol list. 139#$(LST_FILE): $(TARGET_PREPLFS) 140# @echo 141# @echo ">> $(notdir $+) --> $@" 142# cd $(FULLBIN_ROOT); "$(ROOT)/X86/bin/makerelD.exe" $(+F) 143# cat $(FULLBIN_ROOT)/import.lst > $(LST_FILE) 144 145# generate linker command file for the static module. 146$(LCF_FILE) $(SYMBOL_LST_FILE) : $(TARGET_RSOS) $(STATIC_LCF_FILE) 147 $(ROOT)/X86/bin/makelcf.exe -o $(LCF_FILE) -s $(SYMBOL_LST_FILE) -t $(STATIC_LCF_FILE) $(TARGET_RSOS) 148 149# generate linker command file for relocatable modules. 150$(REL_LCF_FILE): #$(LST_FILE) 151 @echo 152 @echo ">> $+ --> $@" 153 cat $(PREREL_LCF_FILE) > $@ 154 echo "FORCEFILES { " >> $@ 155 echo " rsomodule.o" >> $@ 156 echo " }" >> $@ 157 echo "FORCEACTIVE { " >> $@ 158 echo " __global_destructor_chain" >> $@ 159 echo "}" >> $@ 160 161%$(RSOSUFFIX): %$(PLFSUFFIX) 162 cd $(FULLBIN_ROOT); $(ROOT)/X86/bin/makerso.exe $(notdir $(+)) -a 163 164clean: 165 rm -f $(FULLBIN_ROOT)/*.lst 166 rm -f $(FULLBIN_ROOT)/*.lcf 167 168$(BINOBJ_ROOT)/global_destructor_chain.o: 169 $(CC) $(CCFLAGS) -pragma "warning off (10423)" $(INCLUDES) \ 170 $(COMPILE) $(MWDIR)/PowerPC_EABI_Support/Runtime/Src/global_destructor_chain.c \ 171 -o $@ 172