[MLton-commit] r7031
Ville Laurikari
ville at mlton.org
Sat Apr 4 09:14:47 PST 2009
Use the same (relevant) gcc flags which mlton uses by default.
Things like -mlp64 have an effect on what system headers will look
like, for example. While it is possible to use -cppopt with
mlnlffigen to get correct headers, it makes sense to by default use
the same flags as mlton.
----------------------------------------------------------------------
U mlton/trunk/mlnlffigen/Makefile
A mlton/trunk/mlnlffigen/gen-cppcmd
U mlton/trunk/mlnlffigen/gen.sml
U mlton/trunk/mlnlffigen/sources.mlb
----------------------------------------------------------------------
Modified: mlton/trunk/mlnlffigen/Makefile
===================================================================
--- mlton/trunk/mlnlffigen/Makefile 2009-04-04 16:43:02 UTC (rev 7030)
+++ mlton/trunk/mlnlffigen/Makefile 2009-04-04 17:14:46 UTC (rev 7031)
@@ -1,4 +1,4 @@
-## Copyright (C) 2005-2006 Henry Cejtin, Matthew Fluet, Suresh
+## Copyright (C) 2005-2009 Henry Cejtin, Matthew Fluet, Suresh
# Jagannathan, and Stephen Weeks.
#
# MLton is released under a BSD-style license.
@@ -17,6 +17,9 @@
all: $(NAME)
+cppcmd.sml : gen-cppcmd
+ ./gen-cppcmd > $@
+
$(NAME): $(NAME).mlb $(shell PATH="$(BIN):$$PATH" && "$(MLTON)" -stop f $(NAME).mlb)
@echo 'Compiling $(NAME)'
$(MLTON) $(FLAGS) $(NAME).mlb
Added: mlton/trunk/mlnlffigen/gen-cppcmd
===================================================================
--- mlton/trunk/mlnlffigen/gen-cppcmd 2009-04-04 16:43:02 UTC (rev 7030)
+++ mlton/trunk/mlnlffigen/gen-cppcmd 2009-04-04 17:14:46 UTC (rev 7031)
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+
+set -e
+
+dir=`dirname "$0"`
+src=`cd "$dir/.." && pwd`
+lib="$src/build/lib"
+eval `"$lib/platform"`
+
+output () {
+ echo "val defaultCppCmd = \"gcc $1 -E -U__GNUC__ %o %s > %t\""
+}
+
+# The flags here should match the flags used by mlton. At least the
+# 64 vs 32 bit flags have an effect on what the system headers look
+# like.
+case "$HOST_OS-$HOST_ARCH" in
+aix-*)
+ output "-maix64"
+ ;;
+*-ia64)
+ output "-mlp64"
+ ;;
+*-amd64)
+ output "-m64"
+ ;;
+*-x86)
+ output "-m32"
+ ;;
+*-sparc)
+ output "-m32"
+ ;;
+*)
+ output ""
+ ;;
+esac
Property changes on: mlton/trunk/mlnlffigen/gen-cppcmd
___________________________________________________________________
Name: svn:executable
+ *
Modified: mlton/trunk/mlnlffigen/gen.sml
===================================================================
--- mlton/trunk/mlnlffigen/gen.sml 2009-04-04 16:43:02 UTC (rev 7030)
+++ mlton/trunk/mlnlffigen/gen.sml 2009-04-04 17:14:46 UTC (rev 7031)
@@ -1,7 +1,7 @@
(* gen.sml
* 2005 Matthew Fluet (mfluet at acm.org)
* Adapted for MLton.
-(* Copyright (C) 2005-2008 Henry Cejtin, Matthew Fluet, Suresh
+(* Copyright (C) 2005-2009 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
*
* MLton is released under a BSD-style license.
@@ -178,7 +178,7 @@
val cpp_tmpl =
Option.fold
(Process.getEnv "FFIGEN_CPP",
- "gcc -E -U__GNUC__ %o %s > %t",
+ defaultCppCmd,
fn (cpp_tmpl,_) => cpp_tmpl)
val cpp_tmpl =
String.substituteFirst
Modified: mlton/trunk/mlnlffigen/sources.mlb
===================================================================
--- mlton/trunk/mlnlffigen/sources.mlb 2009-04-04 16:43:02 UTC (rev 7030)
+++ mlton/trunk/mlnlffigen/sources.mlb 2009-04-04 17:14:46 UTC (rev 7031)
@@ -1,4 +1,4 @@
-(* Copyright (C) 2005-2008 Henry Cejtin, Matthew Fluet, Suresh
+(* Copyright (C) 2005-2009 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
*
* MLton is released under a BSD-style license.
@@ -24,6 +24,9 @@
sizes-sparc.sml
sizes-x86.sml
end
+
+ cppcmd.sml
+
local open basis_lib pp_lib in
cpif-dev.sml
pp.sml
More information about the MLton-commit
mailing list