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
44#MSDEV=${VS71COMNTOOLS}/../IDE/devenv
45MSDEV=${VS80COMNTOOLS}/../IDE/devenv.com
46MSDEV_EXPRESS=${VS80COMNTOOLS}/../IDE/VCExpress.exe
47
48if [ ! -e "$MSDEV" ]; then
49    if [ -e "$MSDEV_EXPRESS" ]; then
50        MSDEV=${MSDEV_EXPRESS}
51    fi
52fi
53
54if [ "$NDEBUG" ]
55then
56    tgt="Release";
57else
58    tgt="Debug";
59fi
60
61if [ "$1" == "/clean" ]
62then
63    "${MSDEV}" vc++/${MODULENAME}.sln /clean Debug;
64    "${MSDEV}" vc++/${MODULENAME}.sln /clean Release;
65else
66
67    if [ "${VS80COMNTOOLS}" == "" ]
68    then
69        echo Visual Studio is not installed. Do nothing.
70    else
71
72		if [ ! -d ${HIO2DEMO_INSTALL_ROOT} ] ; then \
73			echo "Creating ${HIO2DEMO_INSTALL_ROOT}..." ; \
74			mkdir -p ${HIO2DEMO_INSTALL_ROOT} ; \
75		fi ; \
76
77        for p in $PROJECTS; do \
78            "${MSDEV}" vc++/${MODULENAME}.sln /rebuild ${tgt} /project ${p};
79            if [ "${tgt}" == "Release" ]
80            then
81                echo "Copying RELEASE version..."
82                cp -f vc++/${p}/Release/${p}.${BINSUFFIX} ${HIO2DEMO_INSTALL_ROOT}
83            else
84                echo "Copying DEBUG version..."
85            	cp -f vc++/${p}/Debug/${p}.${BINSUFFIX} ${HIO2DEMO_INSTALL_ROOT}/${p}D.${BINSUFFIX}
86            fi
87        done
88
89    fi
90fi
91