summaryrefslogtreecommitdiffstats
path: root/make/xcodemake
blob: fde684cdf4c24fbc93c4128178ddcdd28fcc29d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/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=

## 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_SRC/configure --force --build=$EXTERNAL_BUILD --conf-method=xcode PATH=$PATH $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