[MLton-commit] r7037

Matthew Fluet fluet at mlton.org
Tue Apr 7 13:04:45 PDT 2009


RTLD_* flags are platform dependent.

Generate them into a platform specific file.

If one were using mlnlffi-lib with a cross compiler, then one needs to
generate the platform specific rtld-flags.$(TARGET_OS).sml file on the
target platform and move it back to the host machine.  This isn't done
automatically, but one will at least get a 
"File rtld-flags.<TARGET_OS>.mlb does not exist." error message rather
than silently using the constants from the host platform.


----------------------------------------------------------------------

_U  mlton/trunk/lib/mlnlffi/
U   mlton/trunk/lib/mlnlffi/Makefile
D   mlton/trunk/lib/mlnlffi/memory/.ignore
U   mlton/trunk/lib/mlnlffi/memory/memory.unix.mlb
_U  mlton/trunk/lib/mlnlffi/memory/platform/
A   mlton/trunk/lib/mlnlffi/memory/platform/.ignore

----------------------------------------------------------------------


Property changes on: mlton/trunk/lib/mlnlffi
___________________________________________________________________
Name: svn:ignore
   + gen-rtld-flags
gen-rtld-flags.exe


Modified: mlton/trunk/lib/mlnlffi/Makefile
===================================================================
--- mlton/trunk/lib/mlnlffi/Makefile	2009-04-07 19:02:13 UTC (rev 7036)
+++ mlton/trunk/lib/mlnlffi/Makefile	2009-04-07 20:04:44 UTC (rev 7037)
@@ -1,9 +1,25 @@
+PATH := ../bin:$(shell echo $$PATH)
+
 CC := gcc -std=gnu99
 CFLAGS := -Wall
 
+EXE :=
+
+TARGET_ARCH := $(shell ../../bin/host-arch)
+TARGET_OS := $(shell ../../bin/host-os)
+
+ifeq ($(TARGET_OS), cygwin)
+EXE := .exe
+endif
+
+ifeq ($(TARGET_OS), mingw)
+EXE := .exe
+endif
+
 .DELETE_ON_ERROR:
-all: memory/rtld-flags.sml
+all: memory/platform/rtld-flags.$(TARGET_OS).sml
 
-memory/rtld-flags.sml: gen-rtld-flags.c
+memory/platform/rtld-flags.$(TARGET_OS).sml: gen-rtld-flags.c
 	$(CC) $(CFLAGS) -o gen-rtld-flags gen-rtld-flags.c
-	./gen-rtld-flags > memory/rtld-flags.sml
+	./gen-rtld-flags > memory/platform/rtld-flags.$(TARGET_OS).sml
+	rm -f gen-rtld-flags$(EXE)

Deleted: mlton/trunk/lib/mlnlffi/memory/.ignore
===================================================================
--- mlton/trunk/lib/mlnlffi/memory/.ignore	2009-04-07 19:02:13 UTC (rev 7036)
+++ mlton/trunk/lib/mlnlffi/memory/.ignore	2009-04-07 20:04:44 UTC (rev 7037)
@@ -1 +0,0 @@
-rtld-flags.sml

Modified: mlton/trunk/lib/mlnlffi/memory/memory.unix.mlb
===================================================================
--- mlton/trunk/lib/mlnlffi/memory/memory.unix.mlb	2009-04-07 19:02:13 UTC (rev 7036)
+++ mlton/trunk/lib/mlnlffi/memory/memory.unix.mlb	2009-04-07 20:04:44 UTC (rev 7037)
@@ -11,7 +11,7 @@
       local
          linkage.sig
          ann "allowFFI true" in
-            rtld-flags.sml
+            platform/rtld-flags.$(TARGET_OS).sml
             linkage-libdl.sml
          end
          bitop-fn.sml


Property changes on: mlton/trunk/lib/mlnlffi/memory/platform
___________________________________________________________________
Name: svn:ignore
   + rtld-flags.*.sml


Added: mlton/trunk/lib/mlnlffi/memory/platform/.ignore
===================================================================
--- mlton/trunk/lib/mlnlffi/memory/platform/.ignore	2009-04-07 19:02:13 UTC (rev 7036)
+++ mlton/trunk/lib/mlnlffi/memory/platform/.ignore	2009-04-07 20:04:44 UTC (rev 7037)
@@ -0,0 +1 @@
+rtld-flags.*.sml




More information about the MLton-commit mailing list