1#! bash
2###############################################################################
3# BuildScript for SampleTool
4#
5# Copyright (C) 2005-2006 Nintendo.  All rights reserved.
6#
7# These coded instructions, statements, and computer programs contain
8# proprietary information of Nintendo of America Inc. and/or Nintendo
9# Company Ltd., and are protected by Federal copyright law.  They may
10# not be disclosed to third parties or copied or duplicated in any form,
11# in whole or in part, without the prior written consent of Nintendo.
12###############################################################################
13
14#
15# compile sampletool Executable
16#
17# Usage: buildscript              compile all the solution or projects
18#        buildscript /clean       deletes all the intermediate files
19#        buildscript /rebuild     rebuild all the solution or projects
20#        buildscript /project     build/rebuild/clean/ the projects
21#
22# if Visual Studio is not installed, do nothing.
23#
24
25############################################################################
26# setup
27############################################################################
28# MODULENAME is *.sln filename. It is same as $(SDK)/build/tools/$MODULENAME.
29MODULENAME="hio2demo"
30
31PROJECTS="dual multi simple"
32
33# select one suffix of target file. "exe" or "dll", "lib", "bin"...
34BINSUFFIX=exe
35
36
37############################################################################
38# do operation
39############################################################################
40
41HIO2DEMO_INSTALL_ROOT=../../../x86/hio2demo
42
43# Visual C++ IDE install path
44MSDEV=${VS80COMNTOOLS}/../IDE/devenv.com
45MSDEV_EXPRESS=${VS80COMNTOOLS}/../IDE/VCExpress.exe
46
47if [ ! -e "$MSDEV" ]; then
48    if [ -e "$MSDEV_EXPRESS" ]; then
49        MSDEV=${MSDEV_EXPRESS}
50    fi
51fi
52
53if [ "$NDEBUG" ]
54then
55    tgt="Release";
56else
57    tgt="Debug";
58fi
59
60if [ "$1" == "/clean" ]
61then
62    "${MSDEV}" vc++/${MODULENAME}.sln /clean Debug;
63    "${MSDEV}" vc++/${MODULENAME}.sln /clean Release;
64else
65
66    if [ "${VS80COMNTOOLS}" == "" ]
67    then
68        echo Visual Studio is not installed. Do nothing.
69    else
70
71		if [ ! -d ${HIO2DEMO_INSTALL_ROOT} ] ; then \
72			echo "Creating ${HIO2DEMO_INSTALL_ROOT}..." ; \
73			mkdir -p ${HIO2DEMO_INSTALL_ROOT} ; \
74		fi ; \
75
76        for p in $PROJECTS; do \
77            "${MSDEV}" vc++/${MODULENAME}.sln /rebuild ${tgt} /project ${p};
78            if [ "${tgt}" == "Release" ]
79            then
80                echo "Copying RELEASE version..."
81                cp -f vc++/${p}/Release/${p}.${BINSUFFIX} ${HIO2DEMO_INSTALL_ROOT}
82            else
83                echo "Copying DEBUG version..."
84            	cp -f vc++/${p}/Debug/${p}.${BINSUFFIX} ${HIO2DEMO_INSTALL_ROOT}/${p}D.${BINSUFFIX}
85            fi
86        done
87
88    fi
89fi
90