@@ -1,42 +1,53 @@
1−# Xcode support script. Intended to be added to and called from "Run Script" build phase.
1+# Xcode support script. Intended to be used with an "External Build System" target.
22#
33#!/bin/sh
44
5−echo "CONFIGURATION =" "$CONFIGURATION"
6−echo "ARCHITECTURES =" "$ARCHS"
5+if [[ "$ACTION" == "clean" ]] ; then
6+ echo "Cleaning all PureScript products..."
7+ make clean
78
8−IS_DEBUG="$PROJECT_TEMP_DIR/is_debug"
9−IS_RELEASE="$PROJECT_TEMP_DIR/is_release"
10−
11−if [[ "$CONFIGURATION" == "Debug" ]] ; then
12− if [ ! -f "$IS_DEBUG" ] ; then
13− make clean
14− touch "$IS_DEBUG"
15− fi
16− rm "$IS_RELEASE" > /dev/null 2>&1 || true
17− OBJECT_TYPE=debug
189else
19− if [ ! -f "$IS_RELEASE" ] ; then
20− make clean
21− touch "$IS_RELEASE"
22− fi
23− rm "$IS_DEBUG" > /dev/null 2>&1 || true
24− OBJECT_TYPE=release
25−fi
10+ echo "CONFIGURATION =" "$CONFIGURATION"
11+ echo "ARCHITECTURES =" "$ARCHS"
2612
27−## Create compiler switches for architectures
28−#
29−for arch_ in $ARCHS ; do
30− ARCH_OPTS+="-arch $arch_ "
31− if ! file output/bin/purescript.o | grep -q $arch_; then
32− make clean
33− fi
34− # TODO: make this more future-proof
35− # Note: -flto optimization causes problems with the source-level
36− # debugger. Disable bitcode temporarily if necessary.
37− if [[ $ENABLE_BITCODE == YES && $arch == arm64 ]] ; then
38− FLTO="-flto"
13+ IS_DEBUG="$PROJECT_TEMP_DIR/is_debug"
14+ IS_RELEASE="$PROJECT_TEMP_DIR/is_release"
15+
16+ if [[ "$CONFIGURATION" == "Debug" ]] ; then
17+ if [ ! -f "$IS_DEBUG" ] ; then
18+ make clean
19+ touch "$IS_DEBUG"
20+ fi
21+ rm "$IS_RELEASE" > /dev/null 2>&1 || true
22+ OBJECT_TYPE=debug
23+ else
24+ if [ ! -f "$IS_RELEASE" ] ; then
25+ make clean
26+ touch "$IS_RELEASE"
27+ fi
28+ rm "$IS_DEBUG" > /dev/null 2>&1 || true
29+ OBJECT_TYPE=release
3930 fi
40−done
4131
42−make $OBJECT_TYPE CXXFLAGS="$ARCH_OPTS $FLTO -isysroot $SDKROOT" LDFLAGS="-r -nostdlib $ARCH_OPTS" BIN=purescript.o -j`sysctl -n hw.ncpu`
32+ ## Create compiler switches for architectures
33+ #
34+ for arch_ in $ARCHS ; do
35+ ARCH_OPTS+="-arch $arch_ "
36+ if ! file output/bin/purescript.o | grep -q $arch_; then
37+ make clean
38+ fi
39+ # TODO: make this more future-proof
40+ # Note: -flto optimization causes problems with the source-level
41+ # debugger. Disable bitcode temporarily if necessary.
42+ if [[ $ENABLE_BITCODE == YES && $arch == arm64 ]] ; then
43+ FLTO="-flto"
44+ fi
45+ done
46+
47+ make $OBJECT_TYPE \
48+ PCCFLAGS=--brief-errors \
49+ CXXFLAGS="$ARCH_OPTS $FLTO -isysroot $SDKROOT" \
50+ LDFLAGS="-r -nostdlib $ARCH_OPTS" \
51+ BIN=purescript.o \
52+ -j`sysctl -n hw.ncpu`
53+fi