OSDN Git Service

BuildSystem: general, configure and Xcode updates.
[handbrake-jp/handbrake-jp-git.git] / make / xcodemake
1 #!/bin/sh
2 #
3
4 set -e
5
6 ## This script is invoked by Xcode external targets.
7 ##
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.
11 ##
12 MAKEFLAGS=
13 MFLAGS=
14
15 ## re/configure if not configured by Xcode or if missing top-makefile
16 if [ $EXTERNAL_METHOD != 'xcode' -o ! -f $EXTERNAL_BUILD/GNUmakefile ]; then
17     ## compute --arch value based on Xcode configuration naming convention
18     case "$CONFIGURATION" in
19     *.i386)
20         args="--arch=i386"
21         ;;
22     *.x86_64)
23         args="--arch=x86_64"
24         ;;
25     *.ppc)
26         args="--arch=ppc"
27         ;;
28     *.ppc64)
29         args="--arch=ppc64"
30         ;;
31     *)
32         args=
33         ;;
34     esac
35
36     ## invoke configure with (hidden) option which indicates conf performed by xcode
37     $EXTERNAL_SRC/configure --force --build=$EXTERNAL_BUILD --conf-method=xcode PATH=$PATH $args
38 fi
39
40 ## safeguard against passing blank value which would result in unlimited jobs
41 if [ -z "$EXTERNAL_JOBS" ]; then
42     jobs=
43 else
44     jobs=--jobs=$EXTERNAL_JOBS
45 fi
46
47 spec="$TARGET_NAME:$ACTION"
48 echo "env specification: $spec"
49
50 ## compute goals
51 case "$spec" in
52     contrib:clean)
53         goals=contrib.xclean
54         ;;
55     contrib:*)
56         goals=contrib.install
57         ;;
58     external:clean)
59         goals=clean
60         ;;
61     external:*)
62         if [ -z "$EXTERNAL_GOALS" ]; then
63             goals=build
64         else
65             goals="$EXTERNAL_GOALS"
66         fi
67         vars="$EXTERNAL_VARS"
68         ;;
69     libhb:clean)
70         goals=libhb.clean
71         ;;
72     libhb:*)
73         goals=libhb.build
74         ;;
75     *)
76         echo "ERROR: invalid env specification: $spec"
77         exit 1
78         ;;
79 esac
80
81 ## handoff
82 set -x
83 make -C $EXTERNAL_BUILD BUILD.method=xcode $jobs $goals $vars