[MLton-commit] r7188

Matthew Fluet fluet at mlton.org
Sun Jun 21 12:20:24 PDT 2009


Fix and improve bin/add-cross script.
----------------------------------------------------------------------

U   mlton/trunk/Makefile
U   mlton/trunk/bin/add-cross

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

Modified: mlton/trunk/Makefile
===================================================================
--- mlton/trunk/Makefile	2009-06-21 19:20:19 UTC (rev 7187)
+++ mlton/trunk/Makefile	2009-06-21 19:20:23 UTC (rev 7188)
@@ -204,14 +204,20 @@
 		basis-library/config/c/$(TARGET_ARCH)-$(TARGET_OS)/c-types.sml
 	$(CP) runtime/gen/basis-ffi.sml \
 		basis-library/primitive/basis-ffi.sml
+ifeq ($(OMIT_BYTECODE), yes)
+else
 	$(CP) runtime/bytecode/opcodes "$(LIB)/"
+endif
 	$(CP) runtime/*.h "$(INC)/"
 	mv "$(INC)/c-types.h" "$(LIB)/$(TARGET)/include"
 	for d in basis basis/Real basis/Word gc platform util; do	\
 		mkdir -p "$(INC)/$$d";					\
 		$(CP) runtime/$$d/*.h "$(INC)/$$d";			\
 	done
+ifeq ($(OMIT_BYTECODE), yes)
+else
 	$(CP) runtime/bytecode/interpret.h "$(INC)"
+endif
 	for x in "$(LIB)"/"$(TARGET)"/*.a; do $(RANLIB) "$$x"; done
 
 .PHONY: script

Modified: mlton/trunk/bin/add-cross
===================================================================
--- mlton/trunk/bin/add-cross	2009-06-21 19:20:19 UTC (rev 7187)
+++ mlton/trunk/bin/add-cross	2009-06-21 19:20:23 UTC (rev 7188)
@@ -12,11 +12,8 @@
 #    Examples of $crossTarget are i386-pc-cygwin and sparc-sun-solaris.
 #
 # 2. <crossArch> specifies the target architecture.
-#    The posibilities are: amd64, hppa, sparc, x86.
 #
 # 3. <crossOS> specifies the target OS.
-#    The possibilities are: aix, cygwin, darwin, freebsd, hpux, linux, mingw,
-#    netbsd, openbsd, solaris.
 #
 # 4. <machine> specifies a remote machine of the target type.  This script
 #    will ssh to $machine to compile the runtime and to compile and run the
@@ -76,15 +73,21 @@
 
 tmp='/tmp/mlton-add-cross'
 
-( cd "$src" && mmake dirs )
+( cd "$src" &&
+        mmake TARGET=$crossTarget TARGET_ARCH=$crossArch TARGET_OS=$crossOS \
+                dirs )
 
 ssh $machine "rm -rf $tmp && mkdir $tmp"
 
-echo 'Making runtime.'
-( cd "$src" && tar cf - Makefile basis-library bin include runtime ) |
-        ssh $machine "cd $tmp && tar xf - && cd runtime &&
-                ../bin/mmake COMPILE_FAST=yes CPPFLAGS=\"$CPPFLAGS\" OMIT_BYTECODE=yes LDFLAGS=\"$LDFLAGS\" TARGET_ARCH=$crossArch TARGET_OS=$crossOS clean all &&
-		cd .. && make CPPFLAGS=\"$CPPFLAGS\" LDFLAGS=\"$LDFLAGS\" dirs runtime"
+echo "Copying files."
+( cd "$src" && tar cf - --exclude '*.o' --exclude '*.a' Makefile basis-library bin include runtime ) |
+        ssh $machine "cd $tmp && tar xf - &&
+                if [ ! $crossArch == \`./bin/host-arch\` ]; then echo $machine is \`./bin/host-arch\`, not $crossArch; exit 1; fi &&
+                if [ ! $crossOS == \`./bin/host-os\` ]; then echo $machine is \`./bin/host-os\`, not $crossOS; exit 1; fi"
+
+echo "Making runtime on $machine."
+ssh $machine "cd $tmp && ./bin/mmake CPPFLAGS=\"$CPPFLAGS\" LDFLAGS=\"$LDFLAGS\" COMPILE_FAST=yes OMIT_BYTECODE=yes clean dirs runtime"
+
 ssh $machine "cd $tmp/build/lib/self && tar cf - ." |
         ( cd "$lib/$crossTarget" && tar xf - )
 ssh $machine "cd $tmp/basis-library/config/c && tar cf - $crossArch-$crossOS" |
@@ -129,10 +132,10 @@
         osOpts=''
 ;;
 darwin)
-        osOpts='-I/opt/local/include -I/sw/include -L/opt/local/lib -L/sw/lib -lgmp'
+        osOpts='-I/usr/local/include -I/opt/local/include -I/sw/include -L/usr/local/lib -L/opt/local/lib -L/sw/lib'
 ;;
 freebsd)
-        osOpts='-I/usr/local/include -L/usr/local/lib/ -lgmp'
+        osOpts='-I/usr/local/include -L/usr/local/lib/'
 ;;
 hpux)
         osOpts=''
@@ -141,13 +144,13 @@
         osOpts=''
 ;;
 mingw)
-	libs='-lws2_32 -lkernel32 -lpsapi -lnetapi32'
+	libs='-lws2_32 -lkernel32 -lpsapi -lnetapi32 -lwinmm'
 ;;
 netbsd)
-        osOpts='-I/usr/pkg/include -Wl,-R/usr/pkg/lib -L/usr/pkg/lib/ -lgmp'
+        osOpts='-I/usr/pkg/include -Wl,-R/usr/pkg/lib -L/usr/pkg/lib/'
 ;;
 openbsd)
-        osOpts='-I/usr/local/include -L/usr/local/lib/ -lgmp'
+        osOpts='-I/usr/local/include -L/usr/local/lib/'
 ;;
 solaris)
         osOpts='-lnsl -lsocket -lrt'




More information about the MLton-commit mailing list