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############################################################################
28MODULENAME="soundfile"
29
30# PROJECTS lists all VC project that will be linked.
31PROJECTS="soundfile"
32
33# select one suffix of target file. "exe" or "dll", "lib", "bin"...
34BINSUFFIX=dll
35
36
37############################################################################
38# do operation
39############################################################################
40
41case "${BINSUFFIX}" in
42    "exe")
43    X86_INSTALL_ROOT=${REVOLUTION_SDK_ROOT}/X86/bin
44;;
45    "dll")
46    X86_INSTALL_ROOT=${REVOLUTION_SDK_ROOT}/X86/bin
47;;
48    "lib")
49    X86_INSTALL_ROOT=${REVOLUTION_SDK_ROOT}/X86/lib
50;;
51    "bin")
52    X86_INSTALL_ROOT=${REVOLUTION_SDK_ROOT}/X86/bin
53;;
54esac
55
56# Visual C++ IDE install path
57MSDEV=${VS71COMNTOOLS}/../IDE/devenv
58
59if [ "$NDEBUG" ]
60then
61    tgt="Release";
62else
63    tgt="Debug";
64fi
65
66if [ "$1" == "/clean" ]
67then
68    "${MSDEV}" vc++/${MODULENAME}.sln /clean Debug;
69    "${MSDEV}" vc++/${MODULENAME}.sln /clean Release;
70else
71
72    if [ "${VS71COMNTOOLS}" == "" ]
73    then
74        echo Visual Studio is not installed. Do nothing.
75    else
76
77		if [ ! -d ${X86_INSTALL_ROOT} ] ; then \
78			echo "Creating ${X86_INSTALL_ROOT}..." ; \
79			mkdir -p ${X86_INSTALL_ROOT} ; \
80		fi ; \
81
82        for p in $PROJECTS; do \
83            "${MSDEV}" vc++/${MODULENAME}.sln /rebuild ${tgt} /project ${p};
84            if [ "${tgt}" == "Release" ]
85            then
86                echo "Copying RELEASE version..."
87                cp -f vc++/Release/${p}.${BINSUFFIX} ${X86_INSTALL_ROOT}
88            else
89                echo "Copying DEBUG version..."
90	            cp -f vc++/Debug/${p}.${BINSUFFIX} ${X86_INSTALL_ROOT}/${p}D.${BINSUFFIX}
91            fi
92        done
93
94    fi
95fi
96