6 ## This script is invoked by Xcode external targets.
8 ## We must guarantee no jobserver is passed through since the file-descriptors
9 ## have been clobbered by Xcode. If this is not done then make behaves as if
10 ## it is allowed to run an infinite number of jobs.
15 ## sanity check - the build system only supports 1 arch at a time
16 archcount=`echo $ARCHS | awk '{ print NF }'`
17 if [ "$archcount" -ne 1 ]; then
18 echo "*********************************************************************"
20 echo "*** ERROR: invalid number of architectures: $ARCHS"
21 echo "*** This build system builds one (1) archtecture at a time."
23 echo "*********************************************************************"
27 ## compute if re/configure necessary
28 if [ $EXTERNAL_METHOD != 'xcode' ]; then
29 reconfigure="terminal -> Xcode"
30 elif [ ! -f $EXTERNAL_BUILD/GNUmakefile ]; then
31 reconfigure="no configuration present"
32 elif [ $EXTERNAL_SRC/make/configure.py -nt $EXTERNAL_BUILD/GNUmakefile ]; then
33 reconfigure="configure script was updated"
38 ## perform re/configure
39 if [ -n "$reconfigure" ]; then
40 echo "reconfiguring ($reconfigure)"
42 case "$CONFIGURATION" in
44 debug="--debug=max --optimize=none"
51 ## invoke configure with (hidden) option which indicates conf performed by xcode
52 (set -x; $EXTERNAL_SRC/configure --force $EXTERNAL_CONFARGS \
53 --build=$EXTERNAL_BUILD --arch=$ARCHS $debug --conf-method=xcode PATH=$PATH )
56 ## compute goals; these correlate with TARGET_NAME and ACTION from Xcode
57 spec="$TARGET_NAME:$ACTION"
58 echo "env specification: $spec"
70 if [ -z "$EXTERNAL_GOALS" ]; then
73 goals="$EXTERNAL_GOALS"
83 echo "ERROR: invalid env specification: $spec"
88 ## safeguard against passing blank value which would result in unlimited jobs
89 if [ -z "$EXTERNAL_JOBS" ]; then
92 jobs=--jobs=$EXTERNAL_JOBS
95 ## log environment as provided by Xcode
96 logdir=$EXTERNAL_BUILD/log
97 if [ ! -d $logdir ]; then
100 env | sort > $logdir/xcodemake.env.txt
103 ## must set BUILD.method != terminal to prevent inifinite recursion
105 exec make -C $EXTERNAL_BUILD BUILD.method=xcode $jobs $goals $EXTERNAL_VARS