cc.darwin revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
28ff4d4c01dc43440f7e6fde73ab783e7e0999d6Paolo Torrini: unix wrapper for mac osx cc : 2012-01-20 :
28ff4d4c01dc43440f7e6fde73ab783e7e0999d6Paolo Torrini
28ff4d4c01dc43440f7e6fde73ab783e7e0999d6Paolo TorriniHOSTTYPE=darwin.generic
28ff4d4c01dc43440f7e6fde73ab783e7e0999d6Paolo Torrini
28ff4d4c01dc43440f7e6fde73ab783e7e0999d6Paolo Torrinicase " $* " in
28ff4d4c01dc43440f7e6fde73ab783e7e0999d6Paolo Torrini*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
28ff4d4c01dc43440f7e6fde73ab783e7e0999d6Paolo Torriniesac
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von SchroederCC=/usr/bin/cc
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroederop=init
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroederfor arg
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroederdo case $op in
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder init) op=ld
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder set ''
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder ;;
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder esac
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder case $arg in
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder -c) op=cc
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder ;;
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder -E) op=cpp
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder continue
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder ;;
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder -G) op=dll
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder continue
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder ;;
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder -lc) continue
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder ;;
28ff4d4c01dc43440f7e6fde73ab783e7e0999d6Paolo Torrini -lm) continue
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder ;;
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder -O) continue
28ff4d4c01dc43440f7e6fde73ab783e7e0999d6Paolo Torrini ;;
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder esac
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder set "$@" "$arg"
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroederdone
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroedercase $# in
28ff4d4c01dc43440f7e6fde73ab783e7e0999d6Paolo Torrini0) ;;
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder*) shift ;;
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroederesac
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroedercase $* in
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder-v) $CC "$@"; exit ;;
28ff4d4c01dc43440f7e6fde73ab783e7e0999d6Paolo Torriniesac
28ff4d4c01dc43440f7e6fde73ab783e7e0999d6Paolo Torrinicase $op in
28ff4d4c01dc43440f7e6fde73ab783e7e0999d6Paolo Torriniinit) echo "cc: arguments expected" >&2
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder exit 1
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder ;;
28ff4d4c01dc43440f7e6fde73ab783e7e0999d6Paolo Torrinicpp) $CC -E "$@"
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder ;;
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroedercc) $CC -DCLK_TCK=100 "$@"
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder ;;
28ff4d4c01dc43440f7e6fde73ab783e7e0999d6Paolo Torrinidll) # what a compatibility mess -- surely they can get the apis to play nice
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder tmp=/tmp/cc.${USER:-$LOGNAME}.$$.err
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder trap "rm -f $tmp" EXIT
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder case `MACOSX_DEPLOYMENT_TARGET=10.3 ld -undefined dynamic_lookup 2>&1` in
28ff4d4c01dc43440f7e6fde73ab783e7e0999d6Paolo Torrini *undefined*dynamic_lookup*)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder ld -m -flat_namespace -undefined suppress -dylib -dynamic \
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder -ldylib1.o "$@" -lcc_dynamic -framework System >$tmp 2>&1
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder status=$?
28ff4d4c01dc43440f7e6fde73ab783e7e0999d6Paolo Torrini ;;
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder *) MACOSX_DEPLOYMENT_TARGET=10.3 $CC -Wl,-flat_namespace -dynamiclib -undefined dynamic_lookup "$@" >$tmp 2>&1
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder status=$?
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder ;;
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder esac
28ff4d4c01dc43440f7e6fde73ab783e7e0999d6Paolo Torrini egrep -v ' (warning .*multiple definitions|definition) of ' $tmp >&2
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder exit $status
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder ;;
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroederld) tmp=/tmp/cc.${USER:-$LOGNAME}.$$.err
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder trap "rm -f $tmp" EXIT
28ff4d4c01dc43440f7e6fde73ab783e7e0999d6Paolo Torrini $CC -Wl,-m -DCLK_TCK=100 "$@" >$tmp 2>&1
28ff4d4c01dc43440f7e6fde73ab783e7e0999d6Paolo Torrini status=$?
28ff4d4c01dc43440f7e6fde73ab783e7e0999d6Paolo Torrini egrep -v ' (warning .*multiple definitions of|definition of|as lazy binding|not from earlier dynamic) ' $tmp >&2
28ff4d4c01dc43440f7e6fde73ab783e7e0999d6Paolo Torrini exit $status
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder ;;
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroederesac
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder