1#!/bin/sh 2# 3# usage: pbxbuild.sh [options] [assignments...] 4# options: -target <tname> Build only the target named <tname> 5# -buildstyle <bsname> Use the build style named <bsname> 6# 7 8USAGE_TEXT='usage: pbxbuild.sh [options] [actions...] [assignments...] 9 options: -target <tname> Build only the target named <tname> 10 -buildstyle <bsname> Use the build style named <bsname>' 11 12 13Target= 14BuildStyle= 15Actions= 16Assignments= 17 18# We change into the directory that contains the pbxbuild.sh script. 19cd "`dirname -- "$0"`" 20 21IFS=' 22' 23 24while [ $# -gt 0 ] ; do 25 case ${1} in 26 -h | -help | -usage) 27 echo "$USAGE_TEXT" 28 exit 0 29 ;; 30 -target) 31 shift 32 if [ ! -z ${1} ]; then 33 Target="${1}" 34 fi 35 shift 36 ;; 37 -buildstyle) 38 shift 39 if [ ! -z ${1} ]; then 40 BuildStyle="${1}" 41 fi 42 shift 43 ;; 44 -*) 45 echo "pbxbuild: invalid option '"${1}"'" 46 echo "$USAGE_TEXT" 47 exit 1 48 ;; 49 *=*) 50 if [ -z ${Assignments} ]; then 51 Assignments="${1}" 52 else 53 Assignments="${Assignments}${IFS}${1}" 54 fi 55 shift 56 ;; 57 *) 58 if [ -z ${Actions} ]; then 59 Actions="${1}" 60 else 61 Actions="${Actions}${IFS}${1}" 62 fi 63 shift 64 ;; 65 esac 66done 67 68# Set up access paths 69DataPath=pbxbuild.data 70 71# The default action is 'build' 72if [ -z "${Actions}" ]; then 73 Actions=build 74fi 75 76# Set up target information 77. "${DataPath}/TargetNames" 78 79for Action in ${Actions}; do 80 for Target in ${Targets}; do 81 TargetPath="${DataPath}/${Target}.build" 82 echo 83 echo "*** ${Action} ${Target} ***" 84 echo jam -d2 ${Action} JAMFILE=\"${TargetPath}/Jamfile.jam\" JAMBASE=pbxbuild.data/ProjectBuilderJambase TARGETNAME=\"${Target}\" BUILD_STYLE="${BuildStyle}" ACTION=${Action} OS=darwin NATIVE_ARCH=`arch` SRCROOT=\"`pwd`\" OBJROOT=\"`pwd`/obj\" SYMROOT=\"`pwd`/sym\" DSTROOT=\"`pwd`/dst\" ${Assignments} 85 /Developer/Private/jam -d2 ${Action} JAMFILE="${TargetPath}/Jamfile.jam" JAMBASE=pbxbuild.data/ProjectBuilderJambase TARGETNAME="${Target}" BUILD_STYLE="${BuildStyle}" ACTION=${Action} OS=darwin NATIVE_ARCH=`arch` SRCROOT="`pwd`" OBJROOT="`pwd`/obj" SYMROOT="`pwd`/sym" DSTROOT="`pwd`/dst" ${Assignments} 86 if [ $? != 0 ]; then 87 echo "*** ${Action} ${Target} FAILED ***" 88 exit 1 89 fi 90 done 91done 92 93echo 94echo "*** BUILD SUCCEEDED ***" 95 96exit 0 97