diff options
Diffstat (limited to 'make/xcodemake')
-rwxr-xr-x | make/xcodemake | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/make/xcodemake b/make/xcodemake new file mode 100755 index 000000000..a75cd3ed6 --- /dev/null +++ b/make/xcodemake @@ -0,0 +1,85 @@ +#!/bin/sh +# + +set -e + +## This script is invoked by Xcode external targets. +## +## We must guarantee no jobserver is passed through since the file-descriptors +## have been clobbered by Xcode. If this is not done then make behaves as if +## it is allowed to run an infinite number of jobs. +## +MAKEFLAGS= +MFLAGS= + +cd $EXTERNAL_BUILD + +## re/configure if not configured by Xcode or if missing top-makefile +if [ $EXTERNAL_METHOD != 'xcode' -o ! -f $EXTERNAL_BUILD/GNUmakefile ]; then + ## compute --arch value based on Xcode configuration naming convention + case "$CONFIGURATION" in + *.i386) + args="--arch=i386" + ;; + *.x86_64) + args="--arch=x86_64" + ;; + *.ppc) + args="--arch=ppc" + ;; + *.ppc64) + args="--arch=ppc64" + ;; + *) + args= + ;; + esac + + ## invoke configure with (hidden) option which indicates conf performed by xcode + $EXTERNAL_PROJECT/configure PATH=$PATH --conf-method=xcode $args +fi + +## safeguard against passing blank value which would result in unlimited jobs +if [ -z "$EXTERNAL_JOBS" ]; then + jobs= +else + jobs=--jobs=$EXTERNAL_JOBS +fi + +spec="$TARGET_NAME:$ACTION" +echo "env specification: $spec" + +## compute goals +case "$spec" in + contrib:clean) + goals=contrib.xclean + ;; + contrib:*) + goals=contrib.install + ;; + external:clean) + goals=clean + ;; + external:*) + if [ -z "$EXTERNAL_GOALS" ]; then + goals=build + else + goals="$EXTERNAL_GOALS" + fi + vars="$EXTERNAL_VARS" + ;; + libhb:clean) + goals=libhb.clean + ;; + libhb:*) + goals=libhb.build + ;; + *) + echo "ERROR: invalid env specification: $spec" + exit 1 + ;; +esac + +## handoff +set -x +make -C $EXTERNAL_BUILD BUILD.method=xcode $jobs $goals $vars |