############################################################################### # Top level makefile for build system # # Copyright 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. ############################################################################### # Valid targets # "make" by itself builds and installs everything listed in LIBS, DEMOS and # TESTS. Default target is HW1 DEBUG # "make clean" cleans everything listed in LIBS, DEMOS and # TESTS. Only MACOS DEBUG versions are cleaned # "make NDEBUG=TRUE" builds nondebug versions. # "make NDEBUG=TRUE clean" cleans only nondebug versions. include buildtools/commondefs ############################################################################### # Dependencies ############################################################################### # THE ORDER OF THE LIBRARIES LISTED IS ALSO THE LIBRARY BUILD ORDER # XXX All libraries that are included in commondefs->REVOLUTION_LIBS must be listed # XXX here under $(LIBS), or else executables will fail to link ifdef EPPC ################### # EPPC BUILDS ################### LIBS = ai \ amcnotstub \ amcstubs \ odemustubs \ odenotstub \ ax \ base \ card \ cx \ dsp \ dvd \ exi \ fa \ faw \ gx \ kmpls \ kpad \ kpadOld \ mem \ midi \ mtx \ os \ pad \ si \ vi \ G2D \ axart \ axfx \ demo \ gd \ mix \ perf \ sample \ seq \ sp \ syn \ thp \ tpl \ nand \ sc \ euart \ ipc \ hio2 \ sdi \ socket \ usb \ arc \ dvdvideo \ wud \ bte \ enc \ cnt \ fnt \ esp \ usbcmn \ scutil \ kbd \ kpr \ darch \ hid \ ga \ pd \ vsm \ wbc \ wpadGtr \ wpadTrn \ wpadDrm \ wpadTbl \ wpadTko \ wpadBlk \ autotest \ lint \ wpad \ ven \ usbmic \ shopsd \ pmic \ cntsd \ ntdtest \ db \ ifdef RVLDWC_ROOT LIBS += vct \ endif LIBS_INTERNAL = wk \ oslog \ wkmc \ sdwp \ simplekit \ es \ wad \ cunit \ fs \ iprof \ cntcache \ LIBS += ${LIBS_INTERNAL} DEMOS = axdemo \ dvddemo \ fademo \ gxdemo \ kpaddemo \ kpadOlddemo \ memdemo \ osdemo \ sample \ spdemo \ videmo \ wpaddemo \ nanddemo \ reldemo \ paddemo \ thpdemo \ scprivatedemo \ scdemo \ carddemo \ gddemo \ hio2demo \ arcdemo \ darchdemo \ encdemo \ cxdemo \ fntdemo \ kbddemo \ kprdemo \ mididemo \ limitdemo \ launchdemo \ discnanddemo \ rsodemo \ hiddemo \ cntdemo \ pddemo \ wbcdemo \ usbmicdemo \ pmicdemo \ cntsddemo \ oslogdemo \ jpegdemo \ ifdef RVLDWC_ROOT DEMOS += vctdemo \ endif TESTS = os \ card \ sample \ exi \ sdwp \ nand \ pad \ sc \ dvd \ di \ fs \ es \ sdi \ socket \ usb \ wpad \ abuse \ Nmenu \ enc \ installer \ cx \ updatecheck \ sdkchecker \ autotest \ cntcache \ cntsd \ dummyviewer \ cnt \ deleteSharedCnt \ AUTOTESTS = fa/fa_sync \ fa/fa_async \ fa/fa_format_test \ fa/valid_test \ sdi \ TESTS += ${AUTOTESTS} endif # EPPC ifdef X86 HOST_LIBS = gd \ hio2Host HOST_DEMOS = gddemo \ hio2demo HOST_TOOLS = sample \ dls1wt \ dspadpcm \ dsptool \ sndconv \ soundfile \ thpaudio \ thpcore \ thputilities \ THPConv \ darch \ ntcompress endif # X86 LIBDIRS = $(addprefix $(LIB_ROOT)/,$(LIBS)) TESTDIRS = $(addprefix $(TEST_ROOT)/,$(TESTS)) DEMODIRS = $(addprefix $(DEMO_ROOT)/,$(DEMOS)) AUTOTESTDIRS = $(addprefix $(TEST_ROOT)/,$(AUTOTESTS)) HOSTLIBDIRS = $(addprefix $(LIB_ROOT)/,$(HOST_LIBS)) HOSTDEMODIRS = $(addprefix $(DEMO_ROOT)/,$(HOST_DEMOS)) ADPCMLIBDIRS = $(addprefix $(LIB_ROOT)/,$(ADPCMLIB)) SOUNDFILELIBDIRS = $(addprefix $(LIB_ROOT)/,$(SOUNDFILELIB)) HOSTTOOLDIRS = $(addprefix $(TOOL_ROOT)/,$(HOST_TOOLS)) # NOTE: the order of these directories determines build order. # In this case, we want libs first, tests second, demos last SUBDIRS = $(addprefix $(LIB_ROOT)/,$(LIBS)) \ $(addprefix $(TEST_ROOT)/,$(TESTS)) \ $(addprefix $(DEMO_ROOT)/,$(DEMOS)) \ $(addprefix $(LIB_ROOT)/,$(HOST_LIBS)) \ $(addprefix $(DEMO_ROOT)/,$(HOST_DEMOS)) \ $(addprefix $(LIB_ROOT)/,$(SOUNDFILELIB)) \ $(addprefix $(LIB_ROOT)/,$(ADPCMLIB)) # The following changes the Makefile include path to include a # definition of which architecture we're building for ARCH_PATH = $(MAKE_ROOT)/$(ARCH_TARGET) all: $(MAKE) setup $(MAKE) subdirectories setup: @if [ ! -d $(INSTALL_ROOT) ] ; then \ echo "Creating $(INSTALL_ROOT)" ; \ rm -rf $(INSTALL_ROOT) ; \ mkdir $(BASEINSTALL_ROOT) ; \ mkdir $(BASEINSTALL_ROOT)/$(ARCH_TARGET) ; \ mkdir $(INSTALL_ROOT)/lib ; \ mkdir $(INSTALL_ROOT)/bin ; \ else \ echo "Install directory ready" ;\ fi # the following lines build up the flags for the recursive make commands BUILDFLAGS = X86=$(X86) PLATFORM=$(PLATFORM) DBREL="$(DBREL)" BUILDTOOLS_ROOT=$(MAKE_ROOT) ifdef NDEBUG BUILDFLAGS += NDEBUG=TRUE else BUILDFLAGS += DEBUG=TRUE endif ifdef BUILD BUILDFLAGS += build endif ifdef INSTALL BUILDFLAGS += install endif .PHONY: alllibs libraries demos tests hostlibs hostdemos adpcmlib subdirectories: @for d in $(SUBDIRS) ; do \ echo "------------------------------------------------------------------" ; \ echo "Building $$d" ; \ if [ ! -d $$d ] ; then \ echo "Module $$d is missing...skipping" ; \ else \ $(MAKE) -C $$d $(BUILDFLAGS) ; \ fi ; \ done ; alllibs: libraries hostlibs libraries: @for d in $(LIBDIRS) ; do \ echo "------------------------------------------------------------------" ; \ echo "Building $$d" ; \ if [ ! -d $$d ] ; then \ echo "Module $$d is missing...skipping" ; \ else \ $(MAKE) -C $$d $(BUILDFLAGS) ; \ fi ; \ done ; libraries.%: @echo "------------------------------------------------------------------" ; \ echo "Building libraries/$*" ; \ $(MAKE) -C $(LIB_ROOT)/$* $(BUILDFLAGS) hostlibs: @for d in $(HOSTLIBDIRS) ; do \ echo "------------------------------------------------------------------" ; \ echo "Building $$d" ; \ if [ ! -d $$d ] ; then \ echo "Module $$d is missing...skipping" ; \ else \ $(MAKE) -C $$d $(BUILDFLAGS) ; \ fi ; \ done ; hostlibs.%: @echo "------------------------------------------------------------------" ; \ echo "Building libraries/$*" ; \ $(MAKE) -C $(LIB_ROOT)/$* $(BUILDFLAGS) demos: @for d in $(DEMODIRS) ; do \ echo "------------------------------------------------------------------" ; \ echo "Building $$d" ; \ if [ ! -d $$d ] ; then \ echo "Module $$d is missing...skipping" ; \ else \ $(MAKE) -C $$d $(BUILDFLAGS) ; \ fi ; \ done ; demos.%: @echo "------------------------------------------------------------------" ; \ echo "Building demos/$*" ; \ $(MAKE) -C $(DEMO_ROOT)/$* $(BUILDFLAGS) hostdemos: @for d in $(HOSTDEMODIRS) ; do \ echo "------------------------------------------------------------------" ; \ echo "Building $$d" ; \ if [ ! -d $$d ] ; then \ echo "Module $$d is missing...skipping" ; \ else \ $(MAKE) -C $$d $(BUILDFLAGS) ; \ fi ; \ done ; hostdemos.%: @echo "------------------------------------------------------------------" ; \ echo "Building demos/$*" ; \ $(MAKE) -C $(DEMO_ROOT)/$* $(BUILDFLAGS) hosttools: @for d in $(HOSTTOOLDIRS) ; do \ echo "------------------------------------------------------------------" ; \ echo "Building $$d" ; \ if [ ! -d $$d ] ; then \ echo "Module $$d is missing...skipping" ; \ else \ $(MAKE) -C $$d $(BUILDFLAGS) ; \ fi ; \ done ; hosttools.%: @echo "------------------------------------------------------------------" ; \ echo "Building demos/$*" ; \ $(MAKE) -C $(TOOL_ROOT)/$* $(BUILDFLAGS) tests: @for d in $(TESTDIRS) ; do \ echo "------------------------------------------------------------------" ; \ echo "Building $$d" ; \ if [ ! -d $$d ] ; then \ echo "Module $$d is missing...skipping" ; \ else \ $(MAKE) -C $$d $(BUILDFLAGS) ; \ fi ; \ done ; tests.%: @echo "------------------------------------------------------------------" ; \ echo "Building tests/$*" ; \ $(MAKE) -C $(TEST_ROOT)/$* $(BUILDFLAGS) adpcmlib: @for d in $(ADPCMLIBDIRS) ; do \ echo "------------------------------------------------------------------" ; \ echo "Building $$d" ; \ if [ ! -d $$d ] ; then \ echo "Module $$d is missing...skipping" ; \ else \ $(MAKE) -C $$d $(BUILDFLAGS) ; \ fi ; \ done ; update: @if [ ! -f $(SS) ] ; then \ echo "SourceSafe is not installed! Please go to \\ntd-pdc\Vss\Dolphin Readme" ; \ exit 1; \ fi @echo "Changing Sourcesafe project to $(SSROOT), performing full GET." @$(SS) cp $(SSROOT) -I-Y -y$(SSUSER) @cd $(ROOT) @$(SS) get \*.\* -R -I-Y -y$(SSUSER) -r -gf clean clobber superclobber: @echo ">>> Cleaning $(ARCH_TARGET) target" ; @for d in $(SUBDIRS) ; do \ echo "------------------------------------------------------------------" ; \ echo "Cleaning $$d" ; \ if [ ! -d $$d ] ; then \ echo "Module $$d is missing...skipping" ; \ else \ $(MAKE) -C $$d $@ $(BUILDFLAGS) ; \ fi ; \ done ; clean_libraries: @echo ">>> Cleaning $(ARCH_TARGET) target" ; @for d in $(LIBDIRS) ; do \ echo "------------------------------------------------------------------" ; \ echo "Cleaning $$d" ; \ if [ ! -d $$d ] ; then \ echo "Module $$d is missing...skipping" ; \ else \ $(MAKE) -C $$d clean $(BUILDFLAGS) ; \ fi ; \ done ; autotest_setdvdroot: @echo "" @setndenv DvdRoot "$(AUTOTEST_DVDROOT)" @ if [ ! -f $(AUTOTEST_STUB_PATH)/$(AUTOTEST_STUB).elf ] || [ ! -f $(AUTOTEST_DVDROOT)/autotest.dol ] ; then \ echo ">>> Building autotest module" ; \ make -C $(AUTOTEST_MAKEPATH) NDEBUG=TRUE; \ fi autotest_targets: @for d in $(AUTOTESTDIRS) ; do \ echo "------------------------------------------------------------------" ; \ echo "Installing $$d for autotest" ; \ if [ ! -d $$d ] ; then \ echo "Module $$d is missing...skipping" ; \ else \ $(MAKE) -C $$d autotest_targets $(BUILDFLAGS) ; \ fi ; \ done ; autotest: autotest_targets autotest_setdvdroot @ if [ -e "$(ROOT)/build/tests/autotest_modules.txt" ] ; then \ cp $(ROOT)/build/tests/autotest_modules.txt $(AUTOTEST_DVDROOT_TESTS)/autotest_modules.txt; \ else \ echo no $(ROOT)/build/tests/autotest_modules.txt; \ fi @ if [ "$(ARGS)" != "" ] ; then \ ndrun $(AUTOTEST_STUB_PATH)/$(AUTOTEST_STUB).elf -a $(ARGS); \ else \ ndrun $(AUTOTEST_STUB_PATH)/$(AUTOTEST_STUB).elf; \ fi @ echo "Opening serial port..."; \ AUTOTEST_LOG=autotest_`date +%y%m%d%H%M`.txt; \ if [ "$(TIMEOUT)" != "" ] ; then \ uterm "" $$AUTOTEST_LOG "" "" $(TIMEOUT); \ else \ uterm "" $$AUTOTEST_LOG "" "" 900; \ fi; \ if [ $$? -ne 0 ] ; then \ ndstop; \ echo error; \ else \ echo ok; \ fi; \ grep -i 'AutoTest: ' $$AUTOTEST_LOG; \ grep -i 'Failed' $$AUTOTEST_LOG; \ echo "Log: $$AUTOTEST_LOG" autotest_rvm: autotest_targets autotest_setdvdroot @ if [ -e "$(ROOT)/build/tests/autotest_modules.txt" ] ; then \ cp $(ROOT)/build/tests/autotest_modules.txt $(AUTOTEST_DVDROOT_TESTS)/autotest_modules.txt; \ else \ echo no $(ROOT)/build/tests/autotest_modules.txt; \ fi @ setsmem2size 64 # @ setcountrycode jp # developer must set up country code manually # @ setfirmware 53 # developer must set up firmware version manually @ ndrun $(AUTOTEST_STUB_PATH)/$(AUTOTEST_STUB).elf -a -manual @ makemasterNF $(AUTOTEST_STUB_PATH)/$(AUTOTEST_STUB).dlf $(AUTOTEST_STUB_PATH)/$(AUTOTEST_STUB).rvm # Below does not build and install the $(TESTDOL) because we don't know what module it is in. # It is better to call this from module's makefile to run one so $(TESTDOL) is dependent on build + install autotest_runone: autotest_setdvdroot ndrun $(AUTOTEST_STUB_PATH)/$(AUTOTEST_STUB).elf -a -runone $(TESTDOL) $(ARGS) @ echo "Opening serial port..."; \ AUTOTEST_LOG=autotest_`date +%y%m%d%H%M`.txt; \ if [ "$(TIMEOUT)" != "" ] ; then \ uterm "" $$AUTOTEST_LOG "" "" $(TIMEOUT); \ else \ uterm "" $$AUTOTEST_LOG "" "" 900; \ fi; \ if [ $$? -ne 0 ] ; then \ ndstop; \ echo error; \ else \ echo ok; \ fi; \ grep -i 'AutoTest: ' $$AUTOTEST_LOG; \ grep -i 'Failed' $$AUTOTEST_LOG; \ echo "Log: $$AUTOTEST_LOG" autotest_manual: autotest_setdvdroot @ if [ "$(ARGS)" != "" ] ; then \ ndrun $(AUTOTEST_STUB_PATH)/$(AUTOTEST_STUB).elf -a $(ARGS); \ else \ ndrun $(AUTOTEST_STUB_PATH)/$(AUTOTEST_STUB).elf -a -manual; \ fi autotest_clean: rm -rf $(AUTOTEST_DVDROOT_TESTS); \ rm -rf $(AUTOTEST_DVDROOT_IMPORT)