Backport from sid to buster
[hcoop/debian/mlton.git] / mlnlffigen / gen-cppcmd
1 #!/usr/bin/env bash
2
3 set -e
4
5 dir=`dirname "$0"`
6 src=`cd "$dir/.." && pwd`
7 eval `"$src/bin/platform"`
8
9 output () {
10 echo "val defaultCppCmd = \"gcc $1 -E -U__GNUC__ %o %s > %t\""
11 }
12
13 # The flags here should match the flags used by mlton. At least the
14 # 64 vs 32 bit flags have an effect on what the system headers look
15 # like.
16 case "$HOST_OS-$HOST_ARCH" in
17 aix-*)
18 output "-maix64"
19 ;;
20 *-ia64)
21 output "-mlp64"
22 ;;
23 *-amd64)
24 output "-m64"
25 ;;
26 *-x86)
27 output "-m32"
28 ;;
29 *-sparc)
30 output "-m32"
31 ;;
32 *)
33 output ""
34 ;;
35 esac